This library provides OpenTelemetry (OTEL) instrumentation for gqlgen
server requests.
Add the package to your project:
go get github.com/zhevron/gqlgen-opentelemetry
Add the gqlgen_opentelemetry.Tracer
extension to your server:
h := handler.NewDefaultServer(schema)
h.Use(gqlgen_opentelemetry.Tracer{})
The following options are available on the extension:
IncludeFieldSpans
: Whether to create an additional child span for each field requested. (Default: false
)
IncludeVariables
: Whether to include variables and their values in the trace span attributes. (Default: false
)
TracerProvider
: The OTEL tracer provider to instantiate a tracer from. If none is provided, the global OTEL tracer provider will be used.