github.com/robertoortis/gqlgenm@v0.7.2/graphql/tracer.go (about) 1 package graphql 2 3 import ( 4 "context" 5 ) 6 7 var _ Tracer = (*NopTracer)(nil) 8 9 type Tracer interface { 10 StartOperationParsing(ctx context.Context) context.Context 11 EndOperationParsing(ctx context.Context) 12 StartOperationValidation(ctx context.Context) context.Context 13 EndOperationValidation(ctx context.Context) 14 StartOperationExecution(ctx context.Context) context.Context 15 StartFieldExecution(ctx context.Context, field CollectedField) context.Context 16 StartFieldResolverExecution(ctx context.Context, rc *ResolverContext) context.Context 17 StartFieldChildExecution(ctx context.Context) context.Context 18 EndFieldExecution(ctx context.Context) 19 EndOperationExecution(ctx context.Context) 20 } 21 22 type NopTracer struct{} 23 24 func (NopTracer) StartOperationParsing(ctx context.Context) context.Context { 25 return ctx 26 } 27 28 func (NopTracer) EndOperationParsing(ctx context.Context) { 29 } 30 31 func (NopTracer) StartOperationValidation(ctx context.Context) context.Context { 32 return ctx 33 } 34 35 func (NopTracer) EndOperationValidation(ctx context.Context) { 36 } 37 38 func (NopTracer) StartOperationExecution(ctx context.Context) context.Context { 39 return ctx 40 } 41 42 func (NopTracer) StartFieldExecution(ctx context.Context, field CollectedField) context.Context { 43 return ctx 44 } 45 46 func (NopTracer) StartFieldResolverExecution(ctx context.Context, rc *ResolverContext) context.Context { 47 return ctx 48 } 49 50 func (NopTracer) StartFieldChildExecution(ctx context.Context) context.Context { 51 return ctx 52 } 53 54 func (NopTracer) EndFieldExecution(ctx context.Context) { 55 } 56 57 func (NopTracer) EndOperationExecution(ctx context.Context) { 58 }