-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Tracer for OpenCensus #402
Conversation
https://circleci.com/gh/99designs/gqlgen/786
|
Yeah, probably need to bump the wait time, or poll with a longer timeout. |
gqlopencensus/option.go
Outdated
} | ||
|
||
// Option is anything that can configure Tracer. | ||
type Option interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for consistency with the rest of gqlgen, this should be:
type Option func(cfg *config)
gqlopencensus/option.go
Outdated
} | ||
|
||
// WithStartOperationExecution returns option that execute some process on StartOperationExecution step. | ||
func WithStartOperationExecution(f func(ctx context.Context) context.Context) Option { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what all are these for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it would be better for developers to have hooks if they want to add something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already an interface there, this should be batteries included but opinionated, and if the user wants more they should be able to write their own in <100 lines.
More than half this PR is just hooks that aren't being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense. I'll omit it later.
|
||
func (t *tracerImpl) StartFieldExecution(ctx context.Context, field graphql.CollectedField) context.Context { | ||
ctx, span := trace.StartSpan(ctx, field.ObjectDefinition.Name+"/"+field.Name) | ||
if !span.IsRecordingEvents() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does opencencus handle a request that wasn't sampled, but ends up causing an error? does try to promote it to being sampled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If our code doesn't have if !span.IsRecordingEvents()
section, It works fine as well too.
OpenCensus doesn't change API behavior by sampling or not.
https://godoc.org/go.opencensus.io/trace#Span.IsRecordingEvents
I just pushed some commit 👀 |
NOTE: This change needs update when after #404 merged. |
ah... I want to add some code after #403 merged. |
ready for merge! |
@vektah thanks to fix CI! |
add Tracer for OpenCensus
add Tracer implementation for OpenCensus.
I choose package name that
gqlopencensus
. because do not duplicate names with other packages.I have: