-
Notifications
You must be signed in to change notification settings - Fork 798
otelkit: Allow specifying a custom span type #4044
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,6 +47,9 @@ type config struct { | |
| // GetAttributes is an optional function that can extract trace attributes | ||
| // from the context and add them to the span. | ||
| GetAttributes func(ctx context.Context) []attribute.KeyValue | ||
|
|
||
| // SpanKind is the kind of span to be created by this middleware. | ||
| SpanKind trace.SpanKind | ||
| } | ||
|
|
||
| // Option configures an EndpointMiddleware. | ||
|
|
@@ -106,3 +109,11 @@ func WithAttributeGetter(fn func(ctx context.Context) []attribute.KeyValue) Opti | |
| o.GetAttributes = fn | ||
| }) | ||
| } | ||
|
|
||
| // WithSpanKind sets the span kind for spans created by this middleware. | ||
| // If this option is not provided, then trace.SpanKindServer is used. | ||
| func WithSpanKind(kind trace.SpanKind) Option { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that only two values of
Can we change and add Credits to @Aneurysm9
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've been using The
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not following. Why would you set to
How would you modify the span kind? If it would be possible then you would not even need this functionality. However, now I see that go-kit transport/endpoint can also be a "consumer" or "client" so probably it is better to keep as it is. Approving again 😉
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked what the instrumentation does and it does not do any context extraction or injection, so is kind of makes internal spans... Also I do not think it applies any OTel Semantic Conventions. I start to feel that this module should be deprecated and moved to https://github.com/go-kit/kit/tree/master/tracing 😬 |
||
| return optionFunc(func(o *config) { | ||
| o.SpanKind = kind | ||
| }) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.