Skip to content

Commit

Permalink
refactor Tracer interface signature that fit to apollo-tracing specs
Browse files Browse the repository at this point in the history
  • Loading branch information
vvakame committed Oct 23, 2018
1 parent 8eb2675 commit 94b7ab0
Show file tree
Hide file tree
Showing 14 changed files with 1,423 additions and 483 deletions.
2 changes: 1 addition & 1 deletion codegen/templates/data.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion codegen/templates/field.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
{{ else }}
// nolint: vetshadow
func (ec *executionContext) _{{$object.GQLType}}_{{$field.GQLName}}(ctx context.Context, field graphql.CollectedField, {{if not $object.Root}}obj *{{$object.FullName}}{{end}}) graphql.Marshaler {
ctx = ec.Tracer.StartFieldExecution(ctx, field)
{{- if $field.Args }}
rawArgs := field.ArgumentMap(ec.Variables)
args, err := {{ $field.ArgsFunc }}(rawArgs)
Expand All @@ -49,7 +50,7 @@
Field: field,
}
ctx = graphql.WithResolverContext(ctx, rctx)
ctx = ec.Tracer.StartFieldExecution(ctx)
ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
defer ec.Tracer.EndFieldExecution(ctx)
resTmp := ec.FieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
Expand All @@ -75,6 +76,7 @@
}
res := resTmp.({{$field.Signature}})
rctx.Result = res
ctx = ec.Tracer.StartFieldChildExecution(ctx)
{{ $field.WriteJson }}
}
{{ end }}
Loading

0 comments on commit 94b7ab0

Please sign in to comment.