...

Package apollofederatedtracingv1

import "github.com/99designs/gqlgen/graphql/handler/apollofederatedtracingv1"
Overview
Index
Subdirectories

Overview ▾

type NodeMap

type NodeMap struct {
    // contains filtered or unexported fields
}

type Tracer

type Tracer struct {
    ClientName string
    Version    string
    Hostname   string
}

func (Tracer) ExtensionName

func (Tracer) ExtensionName() string

ExtensionName returns the name of the extension

func (*Tracer) InterceptField

func (t *Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (interface{}, error)

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

type TreeBuilder struct {
    Trace *generated.Trace
    // contains filtered or unexported fields
}

func NewTreeBuilder

func NewTreeBuilder() *TreeBuilder

NewTreeBuilder is used to start the node tree with a default root node, along with the related tree nodes map entry

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)

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

Subdirectories

Name Synopsis
..
generated