You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-08-10 22:31:50 +02:00
Resolve #6811 Resolve #6691 No migration documentation is added. This does not contain any breaking changes between v1.34.0 and v1.33.0 for the Go API. ## [`v1.34.0` semantic convention release notes](https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.34.0): <h3>🛑 Breaking changes 🛑</h3> <ul> <li> <p><code>all</code>: Convert deprecated text to structured format. (<a href="https://github.com/open-telemetry/semantic-conventions/issues/2047" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2047/hovercard">#2047</a>)<br> This is a breaking change from the schema perspective, but does not change anything for instrumentations or the end users. It breaks compatibility with the (old) <a href="https://github.com/open-telemetry/build-tools/issues/322" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/build-tools/issues/322/hovercard">code generation tooling</a>. Please use <a href="https://github.com/open-telemetry/weaver">weaver</a> to generate Semantic Conventions markdown or code.</p> </li> <li> <p><code>feature_flag</code>: Move the evaluated value from the event body to attributes (<a href="https://github.com/open-telemetry/semantic-conventions/issues/1990" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/1990/hovercard">#1990</a>)</p> </li> <li> <p><code>process</code>: Require sensitive data sanitization for <code>process.command_args</code> and <code>process.command_line</code> (<a href="https://github.com/open-telemetry/semantic-conventions/issues/626" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/626/hovercard">#626</a>)</p> </li> </ul> <h3>💡 Enhancements 💡</h3> <ul> <li><code>docs</code>: Document system-specific naming conventions (<a href="https://github.com/open-telemetry/semantic-conventions/issues/608" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/608/hovercard">#608</a>, <a href="https://github.com/open-telemetry/semantic-conventions/issues/1494" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/1494/hovercard">#1494</a>, <a href="https://github.com/open-telemetry/semantic-conventions/issues/1708" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/1708/hovercard">#1708</a>)</li> <li><code>gen-ai</code>: Add <code>gen_ai.conversation.id</code> attribute (<a href="https://github.com/open-telemetry/semantic-conventions/issues/2024" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2024/hovercard">#2024</a>)</li> <li><code>all</code>: Renames all <code>resource.*</code> groups to be <code>entity.*</code> (<a href="https://github.com/open-telemetry/semantic-conventions/issues/2244" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2244/hovercard">#2244</a>)<br> Part of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2885075816" data-permission-text="Title is private" data-url="https://github.com/open-telemetry/opentelemetry-specification/issues/4436" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/opentelemetry-specification/issues/4436/hovercard" href="https://github.com/open-telemetry/opentelemetry-specification/issues/4436">open-telemetry/opentelemetry-specification#4436</a></li> <li><code>aws</code>: Added new AWS attributes for various services including SQS, SNS, Bedrock, Step Functions, Secrets Manager and Kineses (<a href="https://github.com/open-telemetry/semantic-conventions/issues/1794" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/1794/hovercard">#1794</a>)</li> <li><code>cloud</code>: Broaden <code>cloud.region</code> definition to explicitly cover both resource location and targeted destination. (<a href="https://github.com/open-telemetry/semantic-conventions/issues/2142" data-hovercard-type="issue" data-hovercard-url="/open-telemetry/semantic-conventions/issues/2142/hovercard">#2142</a>)</li> <li><code>network</code>: Stabilize <code>network.transport</code> enum value <code>quic</code>. (<a href="https://github.com/open-telemetry/semantic-conventions/issues/2275" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2275/hovercard">#2275</a>)</li> </ul> <h3>🧰 Bug fixes 🧰</h3> <ul> <li><code>db</code>: Fix the <code>db.system.name</code> attribute value for MySQL which was incorrectly pointing to <code>microsoft.sql_server</code>. (<a href="https://github.com/open-telemetry/semantic-conventions/issues/2276" data-hovercard-type="pull_request" data-hovercard-url="/open-telemetry/semantic-conventions/pull/2276/hovercard">#2276</a>)</li> </ul>
183 lines
6.4 KiB
Django/Jinja
183 lines
6.4 KiB
Django/Jinja
{%- macro repl(text) -%}
|
|
{#- Copied from semconvgen: https://github.com/open-telemetry/opentelemetry-go-build-tools/blob/3e69152c51c56213b65c0fc6e5954293b522103c/semconvgen/generator.go#L419-L426 -#}
|
|
{{ text | replace("RedisDatabase", "RedisDB") | replace("IPTCP", "TCP") | replace("IPUDP", "UDP") | replace("Lineno", "LineNumber") }}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro smart_title_case(text) -%}
|
|
{%- for i in range(0, text | length) -%}
|
|
{%- if i == 0 or text[i-1] in ['.', '_'] -%}
|
|
{{ text[i] | upper }}
|
|
{%- elif not text[i] in ['.', '_'] -%}
|
|
{{ text[i] }}
|
|
{%- endif -%}
|
|
{%- endfor -%}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro to_go_name(fqn="", pkg="") -%}
|
|
{%- if pkg != "" -%}
|
|
{%- set n = pkg | length -%}
|
|
{%- if pkg == fqn[:n] -%}
|
|
{%- set fqn = fqn[n:] -%}
|
|
{%- if fqn[0] == "." or fqn[0] == "." -%}
|
|
{%- set fqn = fqn[1:] -%}
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
{{ repl(smart_title_case(fqn | replace(" ", "") | replace("_", ".") | acronym)) }}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro deprecated_doc(attr) -%}
|
|
{% if attr is deprecated %}Deprecated: {{ attr.deprecated }}{% endif %}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro notes_doc(attr) -%}
|
|
{% if attr.note %}Note: {{ attr.note }}{% endif %}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro examples_doc(attr) -%}
|
|
{%- if attr.examples is iterable %}
|
|
Examples: {{ attr.examples | trim("[]") }}
|
|
{%- endif %}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro lower_first(line) -%}
|
|
{%- if line[0] is upper and line[1] is upper -%}
|
|
{#- Assume an acronym -#}
|
|
{{ line }}
|
|
{%- else -%}
|
|
{{ line[0]|lower }}{{ line[1:] }}
|
|
{%- endif -%}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro first_word(line, delim=" ") -%}
|
|
{%- for c in line -%}
|
|
{%- if c == delim -%}
|
|
{{ line[:loop.index0] }}
|
|
{%- set line = "" -%}
|
|
{%- endif -%}
|
|
{%- endfor -%}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro prefix_brief(brief, prefix="") -%}
|
|
{%- set norms = [
|
|
"MUST", "REQUIRED", "SHALL",
|
|
"SHOULD", "RECOMMENDED",
|
|
"MAY", "OPTIONAL"
|
|
] -%}
|
|
{%- set brief = brief | trim() -%}
|
|
{%- if first_word(brief) is in norms -%}
|
|
It {{ brief }}.
|
|
{%- else -%}
|
|
{{ prefix }} {% if brief[:2] == "A " or brief[:3] == "An " or brief[:4] == "The " -%}
|
|
{{ lower_first(brief) | trim(".") }}.
|
|
{%- else -%}
|
|
the {{ lower_first(brief) | trim(".") }}.
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro it_reps(brief) -%}
|
|
{{ prefix_brief(brief, "It represents") }}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro keydoc(attr, pkg="") -%}
|
|
{{ to_go_name(attr.name, pkg) }}Key is the attribute Key conforming to the "{{ attr.name }}" semantic conventions. {{ it_reps(attr.brief) }}
|
|
|
|
{% if attr is enum -%}
|
|
Type: Enum
|
|
{%- else -%}
|
|
Type: {{ attr.type }}
|
|
{%- endif %}
|
|
RequirementLevel: {{ attr.requirement_level | title }}
|
|
Stability: {{ attr.stability | title }}
|
|
{{ examples_doc(attr) }}
|
|
{{ notes_doc(attr) }}
|
|
{{ deprecated_doc(attr) }}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro generate_consts(group, pkg="") -%}
|
|
{#- TODO: generate with group docs (i.e group by registry namespace) #}
|
|
|
|
{{ ["Namespace: " ~ group.root_namespace] | comment(format="go") }}
|
|
const (
|
|
{%- for attribute in group.attributes if not attribute.deprecated %}
|
|
{#- TODO: Handle template attributes. #}
|
|
{%- if not attribute.type is template_type %}
|
|
{{ keydoc(attribute) | comment(format="go_1tab") }}
|
|
{{to_go_name(attribute.name, pkg=pkg)}}Key = attribute.Key("{{attribute.name}}")
|
|
{% endif -%}
|
|
{%- endfor -%}
|
|
)
|
|
{%- endmacro -%}
|
|
|
|
{%- macro generate_funcs(group, pkg="") -%}
|
|
{%- for attribute in group.attributes if not attribute is enum %}
|
|
{#- TODO: Handle template attributes. #}
|
|
{%- if not attribute.type is template_type and attribute.type != "any" %}
|
|
|
|
{{ [to_go_name(attribute.name, pkg) ~ " returns an attribute KeyValue conforming to the \"" ~ attribute.name ~ "\" semantic conventions. " ~ it_reps(attribute.brief) ] | comment(format="go") }}
|
|
func {{to_go_name(attribute.name, pkg)}}(val {{attribute.type | instantiated_type | map_text("attribute_type_value")}}) attribute.KeyValue {
|
|
return {{to_go_name(attribute.name, pkg)}}Key.{{attribute.type | instantiated_type | map_text("attribute_type_method")}}(val)
|
|
}
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro generate_vars(group, pkg="") -%}
|
|
{#- Render values for enums #}
|
|
{%- for attribute in group.attributes %}
|
|
{%- if attribute is enum %}
|
|
|
|
{{ ["Enum values for " ~ attribute.name] | comment(format="go") }}
|
|
var (
|
|
{%- for value in attribute.type.members %}
|
|
{%- if value.deprecated %}
|
|
{{ ["Deprecated: " ~ value.deprecated | trim(".") ~ "." ] | comment(format="go_1tab") }}
|
|
{%- else %}
|
|
{{ [value.brief or value.id, "Stability: " ~ value.stability] | comment(format="go_1tab") }}
|
|
{%- endif %}
|
|
{{to_go_name(attribute.name ~ "." ~ value.id, pkg=pkg)}} = {{ to_go_name(attribute.name, pkg=pkg) }}Key.{{attribute.type | instantiated_type | map_text("attribute_type_method")}}({{ value.value | print_member_value }})
|
|
{%- endfor %}
|
|
)
|
|
{%- endif %}
|
|
{%- endfor %}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro metric_keydoc(metric, pkg="") -%}
|
|
{%- if not metric.brief -%}
|
|
{{ to_go_name(metric.metric_name, pkg=pkg) }} is the metric conforming to the "{{ metric.metric_name}}" semantic conventions.
|
|
{%- else -%}
|
|
{{ to_go_name(metric.metric_name, pkg=pkg) }} is the metric conforming to the "{{ metric.metric_name}}" semantic conventions. {{ it_reps(metric.brief)|trim(".") }}.
|
|
{%- endif %}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro metric_typedoc(metric, pkg="") -%}
|
|
{%- if not metric.brief -%}
|
|
{{ to_go_name(metric.metric_name, pkg=pkg) }} is an instrument used to record metric values conforming to the "{{ metric.metric_name}}" semantic conventions.
|
|
{%- else -%}
|
|
{{ to_go_name(metric.metric_name, pkg=pkg) }} is an instrument used to record metric values conforming to the "{{ metric.metric_name}}" semantic conventions. {{ it_reps(metric.brief)|trim(".") }}.
|
|
{%- endif %}
|
|
{%- endmacro -%}
|
|
|
|
{%- macro member_type(member) %}
|
|
{%- if member.value is string %}string{%- endif %}
|
|
{%- if member.value is boolean %}bool{%- endif %}
|
|
{%- if member.value is int %}int64{%- endif %}
|
|
{%- if member.value is float %}float64{%- endif %}
|
|
{%- endmacro %}
|
|
|
|
{%- macro attr_type(attribute) %}
|
|
{%- if attribute.type is mapping %}
|
|
{{- member_type(attribute.type.members[0]) }}
|
|
{%- elif attribute.type == "template[boolean]" %}boolean
|
|
{%- elif attribute.type == "template[int]" %}int
|
|
{%- elif attribute.type == "template[double]" %}double
|
|
{%- elif attribute.type == "template[string]" %}string
|
|
{%- elif attribute.type == "template[boolean[]]" %}boolean[]
|
|
{%- elif attribute.type == "template[int[]]" %}int[]
|
|
{%- elif attribute.type == "template[double[]]" %}double[]
|
|
{%- elif attribute.type == "template[string[]]" %}string[]
|
|
{%- else %}{{ attribute.type | trim }}
|
|
{%- endif %}
|
|
{%- endmacro %}
|