graphql-engine/server/src-lib/Hasura/RQL/DDL
Antoine Leblanc cf531b05cb Rewrite Tracing to allow for only one TraceT in the entire stack.
This PR is on top of #7789.

### Description

This PR entirely rewrites the API of the Tracing library, to make `interpTraceT` a thing of the past. Before this change, we ran traces by sticking a `TraceT` on top of whatever we were doing. This had several major drawbacks:
- we were carrying a bunch of `TraceT` across the codebase, and the entire codebase had to know about it
- we needed to carry a second class constraint around (`HasReporterM`) to be able to run all of those traces
- we kept having to do stack rewriting with `interpTraceT`, which went from inconvenient to horrible
- we had to declare several behavioral instances on `TraceT m`

This PR rewrite all of `Tracing` using a more conventional model: there is ONE `TraceT` at the bottom of the stack, and there is an associated class constraint `MonadTrace`: any part of the code that happens to satisfy `MonadTrace` is able to create new traces. We NEVER have to do stack rewriting, `interpTraceT` is gone, and `TraceT` and `Reporter` become  implementation details that 99% of the code is blissfully unaware of: code that needs to do tracing only needs to declare that the monad in which it operates implements `MonadTrace`.

In doing so, this PR revealed **several bugs in the codebase**: places where we were expecting to trace something, but due to the default instance of `HasReporterM IO` we would actually not do anything. This PR also splits the code of `Tracing` in more byte-sized modules, with the goal of potentially moving to `server/lib` down the line.

### Remaining work

This PR is a draft; what's left to do is:
- [x] make Pro compile; i haven't updated `HasuraPro/Main` yet
- [x] document Tracing by writing a note that explains how to use the library, and the meaning of "reporter", "trace" and "span", as well as the pitfalls
- [x] discuss some of the trade-offs in the implementation, which is why i'm opening this PR already despite it not fully building yet
- [x] it depends on #7789 being merged first

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7791
GitOrigin-RevId: cadd32d039134c93ddbf364599a2f4dd988adea8
2023-03-13 17:38:39 +00:00
..
Metadata server: warning in replace_metadata API 2023-02-20 14:20:38 +00:00
Permission Resolve LogicalModelMetadata permissions into LogicalModelInfo 2023-03-06 15:08:08 +00:00
Relationship Fixing omit_tracked argument to suggest_relationships API to be more granular 2023-02-10 01:53:30 +00:00
Schema Rewrite Tracing to allow for only one TraceT in the entire stack. 2023-03-13 17:38:39 +00:00
Webhook server: bring graphql-parser-hs GHC options in line with main code 2023-01-09 15:31:20 +00:00
Action.hs Remove MetadataStorageT, clean up error handling. 2023-02-03 01:05:09 +00:00
ApiLimit.hs multitenant, server: throw a warning if user sets a time limit greater than the system limit 2023-03-13 11:45:45 +00:00
ComputedField.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
ConnectionTemplate.hs server/pro/multitenant: Postgres connection routing using kriti templates 2023-01-25 07:14:31 +00:00
CustomTypes.hs Upgrade Ormolu to v0.5. 2022-11-02 20:55:13 +00:00
DataConnector.hs Rewrite Tracing to allow for only one TraceT in the entire stack. 2023-03-13 17:38:39 +00:00
Endpoint.hs Remove MetadataStorageT, clean up error handling. 2023-02-03 01:05:09 +00:00
EventTrigger.hs server: warning in replace_metadata API 2023-02-20 14:20:38 +00:00
FeatureFlag.hs server: introduce Native Query Interface prototype feature flag 2023-01-23 13:37:13 +00:00
GraphqlSchemaIntrospection.hs Remove RQL/Types.hs 2022-04-27 13:58:47 +00:00
Headers.hs server: event trigger codecs 2022-12-15 20:38:21 +00:00
InheritedRoles.hs Collect Metadata dependencies in a Sequence rather than a list 2022-11-30 18:13:31 +00:00
Metadata.hs multitenant, server: throw a warning if user sets a time limit greater than the system limit 2023-03-13 11:45:45 +00:00
Network.hs console: support suffix for tls allow list 2023-02-15 10:26:41 +00:00
OpenTelemetry.hs server: update metadata api for the OpenTelemetry exporter 2022-11-23 07:54:53 +00:00
Permission.hs Resolve LogicalModelMetadata permissions into LogicalModelInfo 2023-03-06 15:08:08 +00:00
QueryCollection.hs Clean up Hasura.Prelude a bit 2022-10-03 21:50:53 +00:00
QueryTags.hs Replace BackendSourceMetadata type alias with a newtype 2022-08-29 00:59:18 +00:00
Relationship.hs Collect Metadata dependencies in a Sequence rather than a list 2022-11-30 18:13:31 +00:00
RemoteRelationship.hs Block adding remote relationships where they are not supported by the Data Connector agent 2023-03-08 06:01:04 +00:00
ScheduledTrigger.hs Remove MetadataStorageT, clean up error handling. 2023-02-03 01:05:09 +00:00
Schema.hs Import pg-client-hs as PG 2022-09-20 19:55:51 +00:00
SourceKinds.hs Remove suffix from source kind display name 2023-02-17 23:18:54 +00:00
Warnings.hs server: warning in replace_metadata API 2023-02-20 14:20:38 +00:00