From 7f6e3927ec649694ff5d4239b1fae3a6b7bd94f3 Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:41:38 -0700 Subject: [PATCH] [semconv] update template to remove deprecated semconv attributes This PR is updating the jinja template to ignore deprecated attributes as was done in https://github.com/open-telemetry/opentelemetry-go/pull/5476. Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- semconv/template.j2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/semconv/template.j2 b/semconv/template.j2 index a91e8a554c4..28841853ac8 100644 --- a/semconv/template.j2 +++ b/semconv/template.j2 @@ -47,15 +47,15 @@ Note: {{ attr.note | render_markdown(paragraph="{0}", code="{0}", link="{1}", em package semconv {% for semconv in semconvs -%} -{%- if semconvs[semconv].attributes | rejectattr("ref") | selectattr("is_local") | sort(attribute=fqn) | length > 0 -%} +{%- if semconvs[semconv].attributes | rejectattr("ref") | rejectattr("deprecated") | selectattr("is_local") | sort(attribute=fqn) | length > 0 -%} // {{ sentence_case(semconvs[semconv].brief | replace("This document defines ", "")) | wordwrap(76, break_long_words=false, break_on_hyphens=false, wrapstring="\n// ") }} const ( -{% for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref -%} +{% for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref and not attr.deprecated -%} // {{ godoc(attr) | wordwrap | indent(3) | replace(" ", "\t// ") | replace("// //", "//") }} Attribute{{to_go_name(attr.fqn)}} = "{{attr.fqn}}" {% endfor %} ) -{%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref -%} +{%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref and not attr.deprecated -%} {%- if attr.attr_type is not string %} const ( @@ -73,7 +73,7 @@ const ( func Get{{ conventionType | title }}SemanticConventionAttributeNames() []string { return []string{ {% for semconv in semconvs -%} - {%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref -%} + {%- for attr in semconvs[semconv].attributes if attr.is_local and not attr.ref and not attr.deprecated -%} Attribute{{to_go_name(attr.fqn)}}, {% endfor %} {%- endfor %}