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")