Skip to content

Commit 796fec8

Browse files
committed
Add text map for enum attributes and use it for cpython.gc.generation
1 parent adccbc8 commit 796fec8

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cpython_attributes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"""
2222

2323

24-
class CpythonGcGenerationValues(Enum):
24+
class CPythonGCGenerationValues(Enum):
2525
GENERATION_0 = 0
2626
"""Generation 0."""
2727
GENERATION_1 = 1

scripts/semconv/templates/registry/semantic_attributes.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ from typing import Final
5858
{{prefix}}{{doc_string}}
5959
{% endfor %}
6060

61-
{% for attribute in enum_attributes %}{%- set class_name = attribute.name | pascal_case ~ "Values" -%}
61+
{% for attribute in enum_attributes %}{%- set class_name = attribute.name | map_text("py_enum_attribute_to_class_name", attribute.name | pascal_case ~ "Values") -%}
6262
{%- if attribute is deprecated %}
6363
@deprecated(reason="The attribute {{attribute.name}} is deprecated - {{ c.comment_with_prefix(attribute.deprecated.note, "") }}") # type: ignore
6464
{%- elif attribute.stability == "stable" and ctx.filter == "any" %}

scripts/semconv/templates/registry/weaver.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,6 @@ text_maps:
4949
histogram: Histogram
5050
updowncounter: UpDownCounter
5151
gauge: ObservableGauge
52-
52+
# remember the Values suffix!
53+
py_enum_attribute_to_class_name:
54+
cpython.gc.generation: CPythonGCGenerationValues

0 commit comments

Comments
 (0)