Documentation ¶
Overview ¶
Package otelgqlgen instruments the github.com/99designs/gqlgen package.
Currently only the routing of a received message can be instrumented. To do it, use the Middleware function.
Index ¶
- func GetOperationName(ctx context.Context) string
- func RequestComplexityLimit(complexityLimit int64) attribute.KeyValue
- func RequestOperationComplexity(complexityLimit int64) attribute.KeyValue
- func RequestQuery(requestQuery string) attribute.KeyValue
- func RequestVariables(requestVariables map[string]interface{}) []attribute.KeyValue
- func ResolverAlias(resolverAlias string) attribute.KeyValue
- func ResolverArgs(argList ast.ArgumentList) []attribute.KeyValue
- func ResolverErrors(errorList gqlerror.List) []attribute.KeyValue
- func ResolverField(resolverField string) attribute.KeyValue
- func ResolverObject(resolverObject string) attribute.KeyValue
- func ResolverPath(resolverPath string) attribute.KeyValue
- func SetOperationName(ctx context.Context, name string) context.Context
- type FieldsPredicateFunc
- type Option
- func WithComplexityExtensionName(complexityExtensionName string) Option
- func WithCreateSpanFromFields(predicate FieldsPredicateFunc) Option
- func WithRequestVariablesAttributesBuilder(builder RequestVariablesBuilderFunc) Option
- func WithTracerProvider(provider trace.TracerProvider) Option
- func WithoutVariables() Option
- type RequestVariablesBuilderFunc
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOperationName ¶ added in v0.4.1
GetOperationName gets the operation name from the context.
func RequestComplexityLimit ¶
RequestComplexityLimit sets the complexity limit.
func RequestOperationComplexity ¶
RequestOperationComplexity sets the operation complexity.
func RequestQuery ¶
RequestQuery sets the request query.
func RequestVariables ¶
RequestVariables sets request variables.
func ResolverAlias ¶
ResolverAlias sets resolver alias.
func ResolverArgs ¶
func ResolverArgs(argList ast.ArgumentList) []attribute.KeyValue
ResolverArgs sets resolver args.
func ResolverErrors ¶
ResolverErrors sets errors.
func ResolverField ¶
ResolverField sets resolver field.
func ResolverObject ¶
ResolverObject sets resolver object.
func ResolverPath ¶
ResolverPath sets resolver path.
func SetOperationName ¶ added in v0.4.1
SetOperationName adds the operation name to the context so that the interceptors can use it. It will replace the operation name if it already exists in the context. example:
ctx = otelgqlgen.SetOperationName(r.Context(), "my-operation") r = r.WithContext(ctx)
Types ¶
type FieldsPredicateFunc ¶ added in v0.11.0
type FieldsPredicateFunc func(ctx *graphql.FieldContext) bool
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option specifies instrumentation configuration options.
func WithComplexityExtensionName ¶
WithComplexityExtensionName specifies complexity extension name.
func WithCreateSpanFromFields ¶ added in v0.11.0
func WithCreateSpanFromFields(predicate FieldsPredicateFunc) Option
WithCreateSpanFromFields allows specifying a custom function to handle the creation or not of spans regarding the GraphQL context fields.
func WithRequestVariablesAttributesBuilder ¶ added in v0.8.0
func WithRequestVariablesAttributesBuilder(builder RequestVariablesBuilderFunc) Option
WithRequestVariablesAttributesBuilder allows specifying a custom function to handle the building of the attributes for the variables.
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider) Option
WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.
func WithoutVariables ¶ added in v0.8.0
func WithoutVariables() Option
WithoutVariables allows disabling the variables attributes.
type RequestVariablesBuilderFunc ¶ added in v0.8.0
RequestVariablesBuilderFunc is the signature of the function used to build the request variables attributes.
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer is a GraphQL extension that traces GraphQL requests.
func Middleware ¶
Middleware sets up a handler to start tracing the incoming requests. The service parameter should describe the name of the (virtual) server handling the request. extension parameter may be empty string.
func (Tracer) ExtensionName ¶
ExtensionName returns the extension name.
func (Tracer) InterceptField ¶
InterceptField intercepts the incoming request.
func (Tracer) InterceptResponse ¶
func (a Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response
InterceptResponse intercepts the incoming request.