@@ -11,8 +11,8 @@ import (
1111 "github.com/opentracing/opentracing-go/log"
1212)
1313
14- type TraceQueryFinishFunc func ([]* errors.QueryError )
15- type TraceFieldFinishFunc func (* errors.QueryError )
14+ type TraceQueryFinishFunc func ([]byte , [] * errors.QueryError )
15+ type TraceFieldFinishFunc func ([] byte , * errors.QueryError )
1616
1717type Tracer interface {
1818 TraceQuery (ctx context.Context , queryString string , operationName string , variables map [string ]interface {}, varTypes map [string ]* introspection.Type ) (context.Context , TraceQueryFinishFunc )
@@ -33,7 +33,7 @@ func (OpenTracingTracer) TraceQuery(ctx context.Context, queryString string, ope
3333 span .LogFields (log .Object ("graphql.variables" , variables ))
3434 }
3535
36- return spanCtx , func (errs []* errors.QueryError ) {
36+ return spanCtx , func (data [] byte , errs []* errors.QueryError ) {
3737 if len (errs ) > 0 {
3838 msg := errs [0 ].Error ()
3939 if len (errs ) > 1 {
@@ -58,7 +58,7 @@ func (OpenTracingTracer) TraceField(ctx context.Context, label, typeName, fieldN
5858 span .SetTag ("graphql.args." + name , value )
5959 }
6060
61- return spanCtx , func (err * errors.QueryError ) {
61+ return spanCtx , func (data [] byte , err * errors.QueryError ) {
6262 if err != nil {
6363 ext .Error .Set (span , true )
6464 span .SetTag ("graphql.error" , err .Error ())
@@ -67,30 +67,14 @@ func (OpenTracingTracer) TraceField(ctx context.Context, label, typeName, fieldN
6767 }
6868}
6969
70- func (OpenTracingTracer ) TraceValidation (ctx context.Context ) TraceValidationFinishFunc {
71- span , _ := opentracing .StartSpanFromContext (ctx , "Validate Query" )
72-
73- return func (errs []* errors.QueryError ) {
74- if len (errs ) > 0 {
75- msg := errs [0 ].Error ()
76- if len (errs ) > 1 {
77- msg += fmt .Sprintf (" (and %d more errors)" , len (errs )- 1 )
78- }
79- ext .Error .Set (span , true )
80- span .SetTag ("graphql.error" , msg )
81- }
82- span .Finish ()
83- }
84- }
85-
86- func noop (* errors.QueryError ) {}
70+ func noop ([]byte , * errors.QueryError ) {}
8771
8872type NoopTracer struct {}
8973
9074func (NoopTracer ) TraceQuery (ctx context.Context , queryString string , operationName string , variables map [string ]interface {}, varTypes map [string ]* introspection.Type ) (context.Context , TraceQueryFinishFunc ) {
91- return ctx , func (errs []* errors.QueryError ) {}
75+ return ctx , func (data [] byte , errs []* errors.QueryError ) {}
9276}
9377
9478func (NoopTracer ) TraceField (ctx context.Context , label , typeName , fieldName string , trivial bool , args map [string ]interface {}) (context.Context , TraceFieldFinishFunc ) {
95- return ctx , func (err * errors.QueryError ) {}
79+ return ctx , func (data [] byte , err * errors.QueryError ) {}
9680}
0 commit comments