Skip to content

Commit 4a83235

Browse files
committed
Do not generate deprecated attributes
1 parent 986de7e commit 4a83235

File tree

3 files changed

+49
-2533
lines changed

3 files changed

+49
-2533
lines changed

semconv/attribute_group.go.j2

+6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ package semconv // import "go.opentelemetry.io/otel/semconv/{{params.tag}}"
88

99
import "go.opentelemetry.io/otel/attribute"
1010
{%- for group in ctx %}
11+
{%- set ns = namespace(attrs=0) %}
12+
{%- for attribute in group.attributes if not attribute.deprecated %}
13+
{%- set ns.attrs = ns.attrs + 1 %}
14+
{%- endfor %}
15+
{%- if ns.attrs > 0 %}
1116
{{- h.generate_consts(group) }}
1217
{{- h.generate_funcs(group) }}
1318
{{- h.generate_vars(group) }}
19+
{%- endif %}
1420
{%- endfor %}

semconv/helpers.j2

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Stability: {{ attr.stability | title }}
4848

4949
{{ ["Namespace: " ~ group.root_namespace] | comment(format="go") }}
5050
const (
51-
{%- for attribute in group.attributes %}
51+
{%- for attribute in group.attributes if not attribute.deprecated %}
5252
{#- TODO: Handle template attributes. #}
5353
{%- if not attribute.type is template_type %}
5454
{{ keydoc(attribute) | comment(format="go_1tab") }}
@@ -59,7 +59,7 @@ const (
5959
{%- endmacro -%}
6060

6161
{%- macro generate_funcs(group) -%}
62-
{%- for attribute in group.attributes %}
62+
{%- for attribute in group.attributes if not attribute.deprecated %}
6363
{#- TODO: Handle template attributes. #}
6464
{%- if not attribute.type is template_type %}
6565

@@ -73,7 +73,7 @@ func {{to_go_name(attribute.name)}}(val {{attribute.type | instantiated_type | m
7373

7474
{%- macro generate_vars(group) -%}
7575
{#- Render values for enums #}
76-
{%- for attribute in group.attributes %}
76+
{%- for attribute in group.attributes if not attribute.deprecated %}
7777
{%- if attribute is enum %}
7878

7979
{{ ["Enum values for " ~ attribute.name] | comment(format="go") }}

0 commit comments

Comments
 (0)