ravilushqa / otelgqlgen

OpenTelemetry instrumentation for 99designs/gqlgen
Apache License 2.0
66 stars 14 forks source link

use semantic conventions for http status code as a span attribute #175

Open esara opened 9 months ago

esara commented 9 months ago

the current otel trace instrumentation does not set the http status code for the graphql response as it is condition required if received as per https://opentelemetry.io/docs/specs/semconv/http/http-spans/#common-attributes

ravilushqa commented 2 months ago

Hello @esara, sorry for the delayed response—I was thinking about how best to approach this. I appreciate the contribution, but I’m not sure adding HTTP status codes to GraphQL spans is the right fit for the library. Since GraphQL operates over HTTP and often returns errors with 200 OK responses, logging HTTP status codes could be misleading. Errors are typically handled in the response body rather than the status code itself.

I’m open to further discussion if you have other ideas. Thanks again for your efforts!