Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova committed Jul 27, 2024
1 parent fe50d95 commit 7c81e64
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
4 changes: 2 additions & 2 deletions scripts/semconv/templates/registry/semantic_attributes.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from typing import Final

{% set file_name = ctx.output + (ctx.id | kebab_case | replace('-', '_')) ~ "_attributes.py" -%}
{% set file_name = ctx.output + (ctx.root_namespace | kebab_case | replace('-', '_')) ~ "_attributes.py" -%}
{{- template.set_file_name(file_name) -}}
{%- import 'common.j2' as c %}

Expand All @@ -28,7 +28,7 @@ from typing import Final
{%- endmacro -%}

{%- macro stable_class_ref(const_name, separator) -%}
{{ctx.stable_package_name}}.{{ctx.id}}_attributes{{separator}}{{const_name}}
{{ctx.stable_package_name}}.{{ctx.root_namespace}}_attributes{{separator}}{{const_name}}
{%- endmacro %}

{%- macro write_docstring(name, brief, note, deprecated, stability, prefix) -%}
Expand Down
4 changes: 2 additions & 2 deletions scripts/semconv/templates/registry/semantic_metrics.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{% set file_name = ctx.output + ctx.id | kebab_case | replace('-', '_') ~ "_metrics.py" -%}
{% set file_name = ctx.output + ctx.root_namespace | kebab_case | replace('-', '_') ~ "_metrics.py" -%}
{{- template.set_file_name(file_name) -}}

{% import 'common.j2' as c -%}

{%- macro stable_class_ref(const_name, separator) -%}
{{ctx.stable_package_name}}.{{ctx.id}}_metrics{{separator}}{{const_name}}
{{ctx.stable_package_name}}.{{ctx.root_namespace}}_metrics{{separator}}{{const_name}}
{%- endmacro %}

{%- macro write_docstring(metric, const_name, prefix) -%}
Expand Down
36 changes: 16 additions & 20 deletions scripts/semconv/templates/registry/weaver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,30 @@ params:
templates:
- pattern: semantic_attributes.j2
filter: >
semconv_grouped_attributes({
"exclude_root_namespace": $excluded_namespaces,
"exclude_stability": if $filter == "stable" then ["experimental"] else [] end,
})
| map({
attributes: .attributes,
id: .root_namespace,
output: $output + "attributes/",
stable_package_name: $stable_package_name + ".attributes",
filter: $filter,
excluded_attributes: $excluded_attributes[]
})
semconv_grouped_attributes({
"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[]
}
application_mode: each
- pattern: semantic_metrics.j2
filter: >
.groups
| map(select(.type == "metric"))
| map(select(if $filter == "any" then true else .stability == $filter end))
| map({ id: .id, group_id: .id | split(".") | .[1], brief, unit, stability, deprecated, instrument, metric_name, note})
| group_by(.group_id)
semconv_grouped_metrics({
"exclude_root_namespace": $excluded_namespaces,
"exclude_stability": if $filter == "any" then [] else ["experimental"] end,
})
| map({
id: .[0].group_id,
metrics: . | sort_by(.metric_name),
root_namespace: .root_namespace,
metrics: .metrics | sort_by(.metric_name),
output: $output + "metrics/",
stable_package_name: $stable_package_name + ".metrics",
filter: $filter
})
| map(select( .id as $id | any( $excluded_namespaces[]; . == $id) | not ))
application_mode: each
text_maps:
py_instrument_to_factory:
Expand Down

0 comments on commit 7c81e64

Please sign in to comment.