-
Notifications
You must be signed in to change notification settings - Fork 108
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
Use semconv in integration tests #660
base: main
Are you sure you want to change the base?
Conversation
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.
Hi @carrbs ! Thank you for your contribution. We will review and discuss it with the team.
One advantage of keeping the tag names hardcoded in the tests is that we could detect any breaking change derived from the update of the OTEL libraries and properly fix or document it.
Keeping the same functions to generate the tag names and to check their values could cause that any breaking change in the OTEL library remains unnoticed to us and leaking undocumented breaking changes to our users.
test/tools/helpers.go
Outdated
func KeyValueToJaegerTag(kv attribute.KeyValue) jaeger.Tag { | ||
return jaeger.Tag{ | ||
Key: string(kv.Key), | ||
Type: kv.Value.Type().String(), | ||
Value: kv.Value.AsInterface(), | ||
} | ||
} | ||
|
||
func KeyValuesToJaegerTags(kvs []attribute.KeyValue) []jaeger.Tag { |
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.
To minimize the use of generic helper files, I'd consider moving these functions to the test/integration/jaeger/jaeger.go
files and rename them to something like jaeger.FromOTEL(kv attribute.KeyValue) jaeger.Tag
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 moved the functions and renamed them. if you prefer "FromOTEL
" vs "FromOtel
" let me know and I can make that change as well 👍.
Hi @mariomac! 👋 I was also thinking about how we could best handle this. One thought I had was adding the stability as an attribute within the generated Regarding this:
Can you help me understand how the hardcoded names help to detect the breaking changes? When OTEL libraries are updated, the generated // github.com/open-telemetry/opentelemetry-go/tree/main/semconv/v1.24.0/resource.go
// ...
// Span attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts.
const (
// Deprecated, use the `otel.scope.name` attribute.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: 'io.opentelemetry.contrib.mongodb'
OtelLibraryNameKey = attribute.Key("otel.library.name")
// Deprecated, use the `otel.scope.version` attribute.
//
// Type: string
// RequirementLevel: Optional
// Stability: deprecated
// Examples: '1.0.0'
OtelLibraryVersionKey = attribute.Key("otel.library.version")
) |
Hi @carrbs! The issue here es that even if we argue that we are compliant with the latest stable specifications of OTEL, any breaking change produced after upgrading (and they are frequent), could break the stored queries in the dashboards and alerts of our users. Imagine we are using version X of OTEL libraries, and we use the unstable Then we update to the version Y of the libraries, which modified the If we used the If we directly used the It's true that the usual way to proceed would be to just deprecate the |
Hi @mariomac! Thank you for sharing this context with me, I totally understand your concern for the users. I believe there's more flexibility here. We wouldn't need to be compliant with the latest stable specifications of OTEL, in fact we can specifically say which version of the semantic conventions are supported by beyla, i.e.: import semconv "go.opentelemetry.io/otel/semconv/v1.24.0" The semantic conventions in this directory are static and when new versions of the conventions are published, new definitions are generated (and added to a new directory) in the OTEL Go library. So as an example, if Another thought: the way it is currently, (with hardcoded strings), doesn't let the users know which version of the semantic conventions are supported, which could also lead to confusion. Let me know your thoughts! If you'd like to just have this PR be a small change to the string ( i.e. |
Hi @carrbs ! Yeah, fixing the referred issue should be to just do that change, you can do it and we can merge it when we are ready to publish/report/document the breaking change. Thank you very much for you collaboration! |
Fixes: #630
This is a suggestion for possibly changing the scope of this ticket to start using the opentelemetry-go
semconv
definitions generated from semantic conventions defined by OpenTelemetry.The PR introduces a few helper methods that convert
attribute.KeyValue
s intojaeger.Tag
s. It further exercises these functions several times in one of the integration test files to give an example of usage.If this seems like an appropriate direction to take, I can finalize the PR (likely just applying the approach to the rest of this test file), and assist with rescoping the issue and opening tickets to utilize this pattern in other files.
A few thoughts if we move forward on this:
jaeger.Tag{Key: "span.kind", Type: "string", Value: "server"}
) because it wasn't defined in the semantic-conventions.