package apollofederatedtracingv1
import "github.com/99designs/gqlgen/graphql/handler/apollofederatedtracingv1"
Index ¶
- Constants
- type ErrorOptions
- type NodeMap
- type Tracer
- func (Tracer) ExtensionName() string
- func (t *Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (any, error)
- func (t *Tracer) InterceptOperation(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler
- func (t *Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response
- func (Tracer) Validate(graphql.ExecutableSchema) error
- type TreeBuilder
- func NewTreeBuilder(errorOptions *ErrorOptions, logger tracing_logger.Logger) *TreeBuilder
- func (tb *TreeBuilder) DidEncounterErrors(ctx context.Context, gqlErrors gqlerror.List)
- func (tb *TreeBuilder) StartTimer(ctx context.Context)
- func (tb *TreeBuilder) StopTimer(ctx context.Context)
- func (tb *TreeBuilder) WillResolveField(ctx context.Context) func()
Constants ¶
const ( ERROR_MASKED = "masked" ERROR_UNMODIFIED = "all" ERROR_TRANSFORM = "transform" )
Types ¶
type ErrorOptions ¶
type ErrorOptions struct { // ErrorOptions is the option to handle errors in the trace, it can be one of the following: // - "masked": masks all errors // - "all": includes all errors // - "transform": includes all errors but transforms them using TransformFunction, which can allow users to redact sensitive information ErrorOption string TransformFunction func(g *gqlerror.Error) *gqlerror.Error }
type NodeMap ¶
type NodeMap struct {
// contains filtered or unexported fields
}
type Tracer ¶
type Tracer struct { ClientName string Version string Hostname string ErrorOptions *ErrorOptions // Logger is used to log errors that occur during the tracing process; if nil, no logging will occur // This can use the default Go logger or a custom logger (e.g. logrus or zap) Logger tracing_logger.Logger }
func (Tracer) ExtensionName ¶
ExtensionName returns the name of the extension
func (*Tracer) InterceptField ¶
InterceptField is called on each field's resolution, including information about the path and parent node. This information is then used to build the relevant Node Tree used in the FTV1 tracing format
func (*Tracer) InterceptOperation ¶
func (t *Tracer) InterceptOperation(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler
InterceptOperation acts on each Graph operation; on each operation, start a tree builder and start the tree's timer for tracing
func (*Tracer) InterceptResponse ¶
func (t *Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response
InterceptResponse is called before the overall response is sent, but before each field resolves; as a result the final marshaling is deferred to happen at the end of the operation
func (Tracer) Validate ¶
func (Tracer) Validate(graphql.ExecutableSchema) error
Validate returns errors based on the schema; since this extension doesn't require validation, we return nil
type TreeBuilder ¶
func NewTreeBuilder ¶
func NewTreeBuilder(errorOptions *ErrorOptions, logger tracing_logger.Logger) *TreeBuilder
NewTreeBuilder is used to start the node tree with a default root node, along with the related tree nodes map entry
func (*TreeBuilder) DidEncounterErrors ¶
func (tb *TreeBuilder) DidEncounterErrors(ctx context.Context, gqlErrors gqlerror.List)
func (*TreeBuilder) StartTimer ¶
func (tb *TreeBuilder) StartTimer(ctx context.Context)
StartTimer marks the time using protobuf timestamp format for use in timing calculations
func (*TreeBuilder) StopTimer ¶
func (tb *TreeBuilder) StopTimer(ctx context.Context)
StopTimer marks the end of the timer, along with setting the related fields in the protobuf representation
func (*TreeBuilder) WillResolveField ¶
func (tb *TreeBuilder) WillResolveField(ctx context.Context) func()
On each field, it calculates the time started at as now - tree.StartTime, as well as a deferred function upon full resolution of the field as (now - tree.StartTime); these are used by Apollo to calculate how fields are being resolved in the AST
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
graphql/handler/apollofederatedtracingv1/generated | |
graphql/handler/apollofederatedtracingv1/logger |
- Version
- v0.17.73 (latest)
- Published
- May 2, 2025
- Platform
- linux/amd64
- Imports
- 13 packages
- Last checked
- 2 days ago –
Tools for package owners.