-
Notifications
You must be signed in to change notification settings - Fork 948
fix(semantic-conventions): Remove the subset of DB_SYSTEM_NAME_VALUE_* exports that are unstable from the @opentelemetry/semantic-conventions entry point.
#5690
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
Merged
trentm
merged 11 commits into
open-telemetry:main
from
trentm:trentm-semconv-unstable-enum-values-take2
May 20, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1ecb2ee
refactor(semantic-conventions): weaver 0.13.0 supports a 'stable_only…
trentm 92a31d3
refactor(semantic-conventions): tweak the leading spacing of comments…
trentm bdd9778
refactor(semantic-conventions): use weaver 'file_name' template config
trentm 1194bca
fix(semantic-conventions): unstable enum *values* from stable enums w…
trentm 87188a8
Merge branch 'main' into trentm-semconv-unstable-enum-values-take2
trentm 4b1de98
Merge branch 'main' into trentm-semconv-unstable-enum-values-take2
trentm 4ed0bc6
changelog entry
trentm 0a96548
add some comments to the weaver config
trentm cfe1411
grandfather NETWORK_TRANSPORT_VALUE_QUIC as stable
trentm b0b3b31
tweak the changelog
trentm 36ffadd
Merge branch 'main' into trentm-semconv-unstable-enum-values-take2
trentm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
scripts/semconv/templates/registry/ts-experimental/attributes.ts.j2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| {%- import 'docstring.ts.j2' as d %} | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| //---------------------------------------------------------------------------------------------------------- | ||
| // DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/stable/attributes.ts.j2 | ||
| //---------------------------------------------------------------------------------------------------------- | ||
|
|
||
| {% for attribute in ctx.attributes | attribute_sort %} | ||
| {% if attribute.name not in params.excluded_attributes %} | ||
| {% if attribute is not stable %} | ||
| {{d.docstring(attribute, "attribute")}} | ||
| {% if attribute.type is not template_type %} | ||
| export const ATTR_{{ attribute.name | screaming_snake_case }} = '{{attribute.name}}' as const; | ||
|
|
||
| {% else %} | ||
| export const ATTR_{{ attribute.name | screaming_snake_case }} = (key: string) => `{{attribute.name}}.${key}`; | ||
|
|
||
| {% endif %} | ||
| {% endif %} | ||
| {% if attribute.type is mapping %} | ||
| {% for espec in attribute.type.members | sort(attribute='value') %} | ||
| {#- Grandfather NETWORK_TRANSPORT_VALUE_QUIC as stable until v1.34.0 is released. #} | ||
| {% if espec is not stable and not (attribute.name == 'network.transport' and espec.value == 'quic') %} | ||
| /** | ||
| * Enum value {{ espec.value | print_member_value }} for attribute {@link ATTR_{{ attribute.name | screaming_snake_case }}}. | ||
| */ | ||
| export const {{ attribute.name | screaming_snake_case }}_VALUE_{{ espec.id | screaming_snake_case }} = {{ espec.value | print_member_value }} as const; | ||
|
|
||
| {% endif %} | ||
| {% endfor %} | ||
| {% endif %} | ||
| {% endif %} | ||
| {% endfor %} |
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
scripts/semconv/templates/registry/ts-stable/docstring.ts.j2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| {% macro strong_rfc2119(string) -%}{{ string | regex_replace("\\b(MUST NOT|MUST|REQUIRED|SHALL NOT|SHALL|SHOULD NOT|SHOULD|RECOMMENDED|MAY|OPTIONAL)\\b", "**$1**") }}{% endmacro -%} | ||
|
|
||
| {% macro docstring(obj, type="value") -%} | ||
| {%- set examples_jsdoc %} | ||
| {% if obj.examples is sequence %} | ||
| {% for example in obj.examples %} | ||
| @example {{ example }} | ||
| {% endfor %} | ||
| {% elif obj.examples %} | ||
| @example {{ obj.examples | print_member_value }} | ||
| {% endif %} | ||
| {% endset -%} | ||
|
|
||
| {%- if obj.note %} | ||
| {% set note_jsdoc = "@note " ~ strong_rfc2119(obj.note) %} | ||
| {% endif -%} | ||
|
|
||
| {%- if obj.stability != "stable" %} | ||
| {% set stability_jsdoc = "@experimental This " ~ type ~ " is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`." %} | ||
| {% endif -%} | ||
|
|
||
| {%- if obj is deprecated %} | ||
| {%- set deprecated_jsdoc = "\n@deprecated " ~ strong_rfc2119(obj.deprecated.note) -%} | ||
| {%- endif -%} | ||
|
|
||
| {{ [ | ||
| strong_rfc2119(obj.brief) | trim, | ||
| "\n", | ||
| examples_jsdoc, | ||
| note_jsdoc, | ||
| stability_jsdoc, | ||
| deprecated_jsdoc, | ||
| ] | comment }} | ||
| {%- endmacro -%} |
26 changes: 26 additions & 0 deletions
26
scripts/semconv/templates/registry/ts-stable/metrics.ts.j2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| {%- import 'docstring.ts.j2' as d %} | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| //---------------------------------------------------------------------------------------------------------- | ||
| // DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/register/stable/metrics.ts.j2 | ||
| //---------------------------------------------------------------------------------------------------------- | ||
|
|
||
| {% for metric in ctx.metrics | sort(attribute="metric_name") %} | ||
| {{d.docstring(metric, "metric")}} | ||
| export const METRIC_{{ metric.metric_name | screaming_snake_case }} = '{{metric.metric_name}}' as const; | ||
|
|
||
| {% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # ts-stable/... generates the "semantic-conventions/src/stable_*.ts" files. | ||
|
|
||
| templates: | ||
| - pattern: attributes.ts.j2 | ||
| file_name: "stable_attributes.ts" | ||
| filter: > | ||
| semconv_attributes({ | ||
| "stable_only": true | ||
| }) | { | ||
| attributes: . | ||
| } | ||
| application_mode: single | ||
| - pattern: metrics.ts.j2 | ||
| file_name: "stable_metrics.ts" | ||
| filter: > | ||
| semconv_metrics({ | ||
| "stable_only": true | ||
| }) | { | ||
| metrics: . | ||
| } | ||
| application_mode: single | ||
|
|
||
| params: | ||
| excluded_attributes: ["messaging.client_id"] | ||
|
|
||
| ## | ||
| # Everything below here is expected to be the same as in "../ts-*/weaver.yaml". | ||
| ## | ||
|
|
||
| # https://github.com/open-telemetry/weaver/blob/main/crates/weaver_forge/README.md#comment-filter | ||
| comment_formats: | ||
| jsdoc: | ||
| format: markdown | ||
| header: '/**' | ||
| # Note: This results in trailing whitespace on empty lines. IMHO the | ||
| # 'comment' filter should handle those. | ||
| prefix: ' * ' | ||
| footer: ' */' | ||
| trim: true | ||
| indent_first_level_list_items: true | ||
| escape_backslashes: true | ||
| default_comment_format: jsdoc | ||
|
|
||
| # Whitespace control settings to simplify the definition of templates | ||
| whitespace_control: | ||
| trim_blocks: true | ||
| lstrip_blocks: true | ||
|
|
||
| text_maps: | ||
| js_types: | ||
| int: number | ||
| double: number | ||
| boolean: boolean | ||
| string: string | ||
| string[]: string[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Review note: This PR splits the templates for stable and experimental to two separate dirs, so that the logic can differ between them. Comment #5690 (comment) includes a (slightly out of date) diff of the two dirs to show how similar they are.
I tried to share the unchanged files ("metrics.ts.j2", "docstring.ts.j2"), but weaver borks when you try to use files outside of the root dir.