movio / bramble

A federated GraphQL API gateway
https://movio.github.io/bramble/
MIT License
497 stars 55 forks source link

feat: OpenTelemetry tracing and metrics #246

Closed asger-noer closed 8 months ago

asger-noer commented 9 months ago

Telemetry

This PR adds build-in support for OpenTelemetry. All GraphQL queries to the federated services served from bramble are instrumented, this includes service schema updates, service list updates, as well as federated queries from users. The telemetry is exported using the gRPC exporter.

Configuration

Since telemetry is build into bramble the configuration also lives in the bramble root config.json.

enabled will enable telemetry. url are the url for the collector other system capable of receiving OTLP metrics and spans. insecure allows skipping the TLS check when communicating with the collector. service_name allows for the span service name to be set. Useful in multi-deployment settings.

GraphQLClient changes

The GraphQL client has been changed so it now returns the raw timeout error if such error is received. This allows for easier error type checking the processing the error.

Testing

Modified the TestQueryExecutionServiceTimeout to check on the type instead of an error string. This required some modifications to the run function, that now take a function that will test the response, moving the actual testing back into the overall test function itself. Nice.

codecov-commenter commented 9 months ago

Codecov Report

Attention: 205 lines in your changes are missing coverage. Please review.

Comparison is base (a19dd63) 72.34% compared to head (2fecc7d) 69.51%.

Files Patch % Lines
telemetry.go 0.00% 149 Missing :warning:
config.go 4.00% 24 Missing :warning:
executable_schema.go 54.76% 18 Missing and 1 partial :warning:
client.go 83.01% 7 Missing and 2 partials :warning:
execution.go 92.50% 3 Missing :warning:
gateway.go 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #246 +/- ## ========================================== - Coverage 72.34% 69.51% -2.84% ========================================== Files 27 28 +1 Lines 3920 4212 +292 ========================================== + Hits 2836 2928 +92 - Misses 934 1132 +198 - Partials 150 152 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.