Skip to content

Commit 7f6e392

Browse files
committed
[semconv] update template to remove deprecated semconv attributes
This PR is updating the jinja template to ignore deprecated attributes as was done in open-telemetry/opentelemetry-go#5476. Signed-off-by: Alex Boten <[email protected]>
1 parent d924855 commit 7f6e392

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

semconv/template.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ Note: {{ attr.note | render_markdown(paragraph="{0}", code="{0}", link="{1}", em
4747
package semconv
4848

4949
{% for semconv in semconvs -%}
50-
{%- if semconvs[semconv].attributes | rejectattr("ref") | selectattr("is_local") | sort(attribute=fqn) | length > 0 -%}
50+
{%- if semconvs[semconv].attributes | rejectattr("ref") | rejectattr("deprecated") | selectattr("is_local") | sort(attribute=fqn) | length > 0 -%}
5151
// {{ sentence_case(semconvs[semconv].brief | replace("This document defines ", "")) | wordwrap(76, break_long_words=false, break_on_hyphens=false, wrapstring="\n// ") }}
5252
const (
53-
{% for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref -%}
53+
{% for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref and not attr.deprecated -%}
5454
// {{ godoc(attr) | wordwrap | indent(3) | replace(" ", "\t// ") | replace("// //", "//") }}
5555
Attribute{{to_go_name(attr.fqn)}} = "{{attr.fqn}}"
5656
{% endfor %}
5757
)
58-
{%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref -%}
58+
{%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref and not attr.deprecated -%}
5959
{%- if attr.attr_type is not string %}
6060

6161
const (
@@ -73,7 +73,7 @@ const (
7373
func Get{{ conventionType | title }}SemanticConventionAttributeNames() []string {
7474
return []string{
7575
{% for semconv in semconvs -%}
76-
{%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref -%}
76+
{%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref and not attr.deprecated -%}
7777
Attribute{{to_go_name(attr.fqn)}},
7878
{% endfor %}
7979
{%- endfor %}

0 commit comments

Comments
 (0)