From cb0f66d176e558415f3075e20a4af536d4eb4295 Mon Sep 17 00:00:00 2001 From: Maxim Korolyov Date: Fri, 6 Mar 2020 12:17:31 +0300 Subject: [PATCH] opCtx.Operation could be nil --- gqlopentracing/tracer.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gqlopentracing/tracer.go b/gqlopentracing/tracer.go index 0fced47..487f596 100644 --- a/gqlopentracing/tracer.go +++ b/gqlopentracing/tracer.go @@ -41,10 +41,13 @@ func (OpenTracingTracer) InterceptResponse(ctx context.Context, next graphql.Res if opCtx.Operation != nil { opName = opCtx.Operation.Name } - if opName == "" { + if opName == "" && opCtx.Operation != nil { //parent response case opName = string(opCtx.Operation.Operation) } + if opName == "" { + opName = opCtx.OperationName + } span, ctx := opentracing.StartSpanFromContext(ctx, opName) defer span.Finish() ext.SpanKind.Set(span, "server")