diff --git a/scripts/semconv/templates/registry/common.j2 b/scripts/semconv/templates/registry/common.j2 index f09f5e80c3d..329c02a8c71 100644 --- a/scripts/semconv/templates/registry/common.j2 +++ b/scripts/semconv/templates/registry/common.j2 @@ -43,4 +43,4 @@ from deprecated import deprecated {%- macro print_value(type, value) -%} {%- if type == "string" -%}"{{value}}"{%-else-%}{{value}}{%-endif-%} -{%- endmacro -%} \ No newline at end of file +{%- endmacro -%} diff --git a/scripts/semconv/templates/registry/semantic_metrics.j2 b/scripts/semconv/templates/registry/semantic_metrics.j2 index dc971c80d86..bd2d7d1d1e1 100644 --- a/scripts/semconv/templates/registry/semantic_metrics.j2 +++ b/scripts/semconv/templates/registry/semantic_metrics.j2 @@ -66,7 +66,7 @@ CallbackT = Union[ from typing import Final {{ import_instrument_classes(filtered_metrics) }} -{%- for metric in ctx.metrics %} +{%- for metric in ctx.metrics | sort(attribute="metric_name") %} {% set const_name = c.to_const_name(metric.metric_name) %} {{const_name}}: Final = "{{metric.metric_name}}" {%- set doc_string=write_docstring(metric, const_name, "")-%}{%- if doc_string %} diff --git a/scripts/semconv/templates/registry/weaver.yaml b/scripts/semconv/templates/registry/weaver.yaml index fdbec5346e5..470abb57f63 100644 --- a/scripts/semconv/templates/registry/weaver.yaml +++ b/scripts/semconv/templates/registry/weaver.yaml @@ -10,12 +10,14 @@ templates: "exclude_root_namespace": $excluded_namespaces, "exclude_stability": if $filter == "any" then [] else ["experimental"] end, }) - | . + { - output: $output + "attributes/", - stable_package_name: $stable_package_name + ".attributes", - filter: $filter, - excluded_attributes: $excluded_attributes[] - } + | map({ + root_namespace: .root_namespace, + attributes: .attributes, + output: $output + "attributes/", + stable_package_name: $stable_package_name + ".attributes", + filter: $filter, + excluded_attributes: $excluded_attributes[] + }) application_mode: each - pattern: semantic_metrics.j2 filter: > @@ -25,7 +27,7 @@ templates: }) | map({ root_namespace: .root_namespace, - metrics: .metrics | sort_by(.metric_name), + metrics: .metrics, output: $output + "metrics/", stable_package_name: $stable_package_name + ".metrics", filter: $filter