Skip to content
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

otelkit: Allow specifying a custom span type #4044

Closed

Conversation

jackwilsdon
Copy link

This is useful for when an endpoint may be wrapping a call to another service, or when an endpoint is used as a consumer (e.g. with https://github.com/alebabai/go-kit-kafka). The go-kit opentracing provider supports this via use of WithTags.

@jackwilsdon jackwilsdon requested a review from a team as a code owner July 3, 2023 09:00
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 3, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@pellared
Copy link
Member

pellared commented Jul 3, 2023

The span kind is strictly defined by the HTTP semantic conventions. See: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.21.0/specification/trace/semantic_conventions/http.md#http-server-semantic-conventions

If you want to change the semantic conventions then you should create an issue (and maybe PR) in https://github.com/open-telemetry/semantic-conventions (new repo for semantic conventions).

I think this PR should be closed or at least moved to draft.

@jackwilsdon
Copy link
Author

jackwilsdon commented Jul 3, 2023

go-kit supports transports other than HTTP (e.g. it comes with a AMQP transport) - https://github.com/open-telemetry/opentelemetry-specification/blob/4229197f45f0da0642bc7c0127e84c8aa1439489/specification/trace/semantic_conventions/messaging.md#span-kind mentions using the consumer/producer span kinds and otelkit doesn't seem to be specific to the HTTP transport.

@codecov
Copy link

codecov bot commented Jul 3, 2023

Codecov Report

Merging #4044 (416a83f) into main (9437f9b) will increase coverage by 0.0%.
The diff coverage is 100.0%.

❗ Current head 416a83f differs from pull request most recent head 4eb938c. Consider uploading reports for the commit 4eb938c to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #4044   +/-   ##
=====================================
  Coverage   79.2%   79.2%           
=====================================
  Files        165     165           
  Lines      10318   10324    +6     
=====================================
+ Hits        8173    8179    +6     
  Misses      2008    2008           
  Partials     137     137           
Impacted Files Coverage Δ
...umentation/github.com/go-kit/kit/otelkit/config.go 100.0% <100.0%> (ø)
...entation/github.com/go-kit/kit/otelkit/endpoint.go 83.0% <100.0%> (+0.5%) ⬆️

Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second review after getting more feedback.


// 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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that only two values of trace.SpanKind are valid:

  • trace.SpanKindServer
  • trace.SpanKindConsumer

Can we change and add WithSpanKindServer() and WithSpanKindConsumer() options instead?

Credits to @Aneurysm9

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been using SpanKindInternal on my endpoints and instead putting server/consumer on the transport's spans, as it's up to the transport whether the endpoint is called as part of a server or consumer. Changing this to just those two options somewhat limits the flexibility here.

The kit/tracing/opentracing package offers TraceEndpoint which allows using any span type.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not following. Why would you set to Internal?

as it's up to the transport whether the endpoint is called as part of a server or consumer

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 😉

Copy link
Member

@pellared pellared Jul 14, 2023

Choose a reason for hiding this comment

The 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 😬

pellared
pellared previously approved these changes Jul 14, 2023
@pellared pellared dismissed their stale review July 14, 2023 15:57

dismissing

@pellared
Copy link
Member

pellared commented Jul 27, 2023

Closing as during SIG meeting we agreed that we are dropping support for otelkit.
See #4085

Still, thank you for your contribution ❤️

@pellared pellared closed this Jul 27, 2023
@jackwilsdon jackwilsdon deleted the otelkit-custom-span-type branch April 11, 2024 11:44
@jackwilsdon jackwilsdon restored the otelkit-custom-span-type branch April 11, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants