-
Notifications
You must be signed in to change notification settings - Fork 795
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
feat: add semconv generator for semantic-conventions
-package
#2083
feat: add semconv generator for semantic-conventions
-package
#2083
Conversation
Adds a build script which generate the files for the `semenatic-conventions`-package so it always in sync with the definitions in the `specifications`-repo A few unspecified attributes are added manually to the semconv template to allow existing code to pass, these are: // HTTP HTTP_ERROR_NAME: 'http.error_name', HTTP_ERROR_MESSAGE: 'http.error_message', HTTP_STATUS_TEXT: 'http.status_text', // GRPC GRPC_KIND: 'grpc.kind', // SERVER or CLIENT GRPC_METHOD: 'grpc.method', GRPC_STATUS_CODE: 'grpc.status_code', GRPC_ERROR_NAME: 'grpc.error_name', GRPC_ERROR_MESSAGE: 'grpc.error_message',
Updates the different packages to fix the breaking change were there is only `SemanticAttribute` and `ResourceAttribute`-class defined in the `@opentelemetry/semantic-conventations`-package
Codecov Report
@@ Coverage Diff @@
## main #2083 +/- ##
==========================================
+ Coverage 92.53% 92.59% +0.05%
==========================================
Files 133 137 +4
Lines 4851 4872 +21
Branches 1002 1005 +3
==========================================
+ Hits 4489 4511 +22
+ Misses 362 361 -1
|
Changed `generate.sh` to ensure it generates the files against the latest published version of the otel specification which is v1.1.0. To allow this version of the spec files to work with the `semconv` the version of this tool had to be lowered to 0.2.1 as there is a breaking change in 0.3.0 which removes support for the `number`-type.
|
||
{%- if class == "SemanticAttribute" %} | ||
|
||
// Manually defined and not YET in the YAML |
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.
is there plan to add them upstream ?
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.
Good question, I am not sure. Might be worth considering. I have added them to avoid needing to change too much code
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.
Most of these sound like obsolete attributes that are represented/named differently
grpc.kind
should be represented as the Span Kindgrpc.status_code
should berpc.grpc.status_code
grpc.error_name
is redundant with the codegprc.status_message
is probably worth filing a spec PR for (asrpc.grpc.status_message
). The span status message might not be ideal to use for it, for the same reason we don't mark spans as failed in RecordException.http.status_text
was deemed useless and removed without replacement, see Remove semantic convention for http.status_text opentelemetry-specification#950.http.error_name
,http.status_text
: No idea what these are.
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 they shouldn't be defined here anyway if they aren't in the semantic conventions. Anything in this package should be only things approved by spec and by including them we are giving them our implicit approval for third parties. Most people will assume anything they find in autocomplete here is "official"
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 have moved them into the packages and updated the code accordingly
Also made sure that we use rpc.grpc.status_code
instead of the previous one
I have to make some more changes related to this ticket: open-telemetry/build-tools#41 But looking forward hearing if this approach is fine. Having a second look I am not sure if we want to name it |
I would for sure prefer |
- Removed all the semantic convention constants from the `@opentelemetry/semantic-conventions`-package that are not part of the Opentelemetry Specification v1.1.0 - Renamed the `ResourceAttribute`-class to `ResourceAttributes` - Renamed the `SemanticAttribute`-class to `SemanticAttributes` as `SpanAttributes` name conflicts with the interface defined in the `api`-package - Updated references in the packages to use the new names
I have renamed |
…ator # Conflicts: # packages/opentelemetry-plugin-grpc-js/src/client/utils.ts # packages/opentelemetry-plugin-grpc-js/src/server/clientStreamAndUnary.ts # packages/opentelemetry-plugin-grpc-js/src/server/patchServer.ts # packages/opentelemetry-plugin-grpc-js/src/server/serverStreamAndBidi.ts # packages/opentelemetry-plugin-grpc/src/grpc.ts # packages/opentelemetry-plugin-http/src/utils.ts # packages/opentelemetry-plugin-http/test/functionals/http-enable.test.ts # packages/opentelemetry-plugin-http/test/functionals/utils.test.ts # packages/opentelemetry-plugin-http/test/integrations/http-enable.test.ts # packages/opentelemetry-plugin-http/test/utils/assertSpan.ts # packages/opentelemetry-plugin-https/test/functionals/https-enable.test.ts # packages/opentelemetry-plugin-https/test/integrations/https-enable.test.ts # packages/opentelemetry-plugin-https/test/utils/assertSpan.ts
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.
Something is wrong during merging with main branch you have restored all the removed plugins
Yes, sorry about that, I noticed that too. Think it's resolved now. Sourcetree is confusing with displaying deleted files when you have changes to the same files |
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.
works like a charm, one small suggestion
Thank you for approving :D |
Which problem is this PR solving?
Adds a build script which generate the files for the
semantic-conventions
-packageso it always in sync with the definitions in the
specifications
-repoA few unspecified attributes are added manually to the semconv template to
allow existing code to pass, these are:
Fixes #2064
Short description of the changes
This change introduces a script
generate.sh
in the directoryscripts/semconv
which allows you to generate the constants which are defined in the semantic conventions section of the Opentelemetry specification.The following to files are generated:
SemanticAttribute
ResourceAttribute
All the packages that depend on the
@opentelemetry/semantic-conventions
-package has been updated to accommodate this change.To allow this version of the spec files to work with the
semconv
theversion of this tool had to be lowered to 0.2.1 as there is a breaking
change in 0.3.0 which removes support for the
number
-type andbecause the latest published version of the otel spec is v1.1.0 which
still uses this
number
-type.