Skip to content

Commit

Permalink
[semconv] update template to remove deprecated semconv attributes
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
codeboten committed Aug 7, 2024
1 parent d924855 commit 7f6e392
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions semconv/template.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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 %}
Expand Down

0 comments on commit 7f6e392

Please sign in to comment.