@@ -2,11 +2,14 @@ package gql
22
33import (
44 "context"
5+ "fmt"
56 "net"
67 "net/http"
78 "strings"
89 "time"
910
11+ "go.opentelemetry.io/otel"
12+ "go.opentelemetry.io/otel/attribute"
1013 "go.opentelemetry.io/otel/trace"
1114
1215 "github.com/satisfactorymodding/smr-api/db/postgres"
@@ -27,22 +30,22 @@ func WrapMutationTrace(ctx context.Context, action string) (TraceWrapper, contex
2730}
2831
2932func wrapTrace (ctx context.Context , action string , actionType string ) (TraceWrapper , context.Context ) {
30- // spanCtx, span := otel.Tracer("gql").Start(ctx, "GraphQL "+action, trace.WithAttributes(
31- // attribute.String("action_type", "API.graphql."+actionType),
32- // ))
33+ spanCtx , span := otel .Tracer ("gql" ).Start (ctx , "GraphQL " + action , trace .WithAttributes (
34+ attribute .String ("action_type" , "API.graphql." + actionType ),
35+ ))
3336
3437 return TraceWrapper {
35- // Span: span,
36- }, ctx
38+ Span : span ,
39+ }, spanCtx
3740}
3841
3942func (wrapper TraceWrapper ) end () {
40- // defer wrapper.Span.End()
41- //
42- // if err := recover(); err != nil {
43- // wrapper.Span.RecordError(fmt.Errorf("panic: %v", err))
44- // panic(err)
45- // }
43+ defer wrapper .Span .End ()
44+
45+ if err := recover (); err != nil {
46+ wrapper .Span .RecordError (fmt .Errorf ("panic: %v" , err ))
47+ panic (err )
48+ }
4649}
4750
4851// SetStringINNOE sets target if value not nil or empty
0 commit comments