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

fix(spans): adhere attribute name to otel semver #185

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Strazz1337
Copy link

Updates the http span attributes to match with the updated OTEL specification.

Fixes #182

@Strazz1337 Strazz1337 requested a review from a team as a code owner October 12, 2024 12:25
span.SetAttributes(attribute.Int64("http.request_content_length", req.ContentLength),
attribute.Int("http.request_content_length", 415))
span.SetAttributes(semconv.HTTPRequestBodySize(int(req.ContentLength)),
semconv.HTTPResponseStatusCode(415))
Copy link
Author

Choose a reason for hiding this comment

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

It feels off that the second attribute is the same as the first one. So I set it to HTTPResponseStatusCode, as I expect it to equal the status code that is checked a few lines before this.

@@ -10,6 +10,7 @@ import (
abstractions "github.com/microsoft/kiota-abstractions-go"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
semconv "go.opentelemetry.io/otel/semconv/v1.24.0"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
semconv "go.opentelemetry.io/otel/semconv/v1.24.0"
semconv "go.opentelemetry.io/otel/semconv"

Should the imports include the version here? Or will they cause issue incase of an update in the go.mod file?

Copy link
Author

Choose a reason for hiding this comment

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

It did not work when I did not assign the version here. So if you manage to get it working that'd be great :)

Copy link

Choose a reason for hiding this comment

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

@andrueastman you need to reference the version and yes, it will cause runtime errors if you upgrade the otel sdk and don't have the correct version of semconv referenced. I hace seen multiple issues and proposals for this but no progress I'm aware of to mitigate having to update all references of semconv usage. See open-telemetry/opentelemetry-go#4886

Copy link
Member

Choose a reason for hiding this comment

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

In general we've faced similar issues in other languages. This dependency causes a lot of issues since they ship breaking changes without major revs (to keep the version aligned with the other packages roughly). We've resulted NOT to use this package in other languages because of that. Yes it introduces misalignment possibilities/added maintenance burden because of that.
I hope this additional context helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

http - align OTEL http attributes with latest standard
4 participants