Skip to content

Commit 15378be

Browse files
committed
Add exclusion list for metrics and rebuild
1 parent 871354e commit 15378be

9 files changed

Lines changed: 14 additions & 41 deletions

File tree

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/container_metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
| Generator[Iterable[Observation], CallbackOptions, None]
2121
)
2222

23+
2324
CONTAINER_CPU_TIME: Final = "container.cpu.time"
2425
"""
2526
Total CPU time consumed

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cpu_metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
| Generator[Iterable[Observation], CallbackOptions, None]
2020
)
2121

22+
2223
CPU_FREQUENCY: Final = "cpu.frequency"
2324
"""
2425
Deprecated: Replaced by `system.cpu.frequency`.

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/hw_metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
| Generator[Iterable[Observation], CallbackOptions, None]
2121
)
2222

23+
2324
HW_BATTERY_CHARGE: Final = "hw.battery.charge"
2425
"""
2526
Remaining fraction of battery charge

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/k8s_metrics.py

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
| Generator[Iterable[Observation], CallbackOptions, None]
2121
)
2222

23+
2324
K8S_CONTAINER_CPU_LIMIT: Final = "k8s.container.cpu.limit"
2425
"""
2526
Deprecated: Replaced by `k8s.container.cpu.limit.desired`.
@@ -105,26 +106,6 @@ def create_k8s_container_cpu_limit_utilization(
105106
)
106107

107108

108-
K8S_CONTAINER_CPU_LIMIT_UTILIZATION: Final = (
109-
"k8s.container.cpu.limit_utilization"
110-
)
111-
"""
112-
Deprecated: Replaced by `k8s.container.cpu.limit.utilization`.
113-
"""
114-
115-
116-
def create_k8s_container_cpu_limit_utilization(
117-
meter: Meter, callbacks: Sequence[CallbackT] | None
118-
) -> ObservableGauge:
119-
"""Deprecated, use `k8s.container.cpu.limit.utilization` instead"""
120-
return meter.create_observable_gauge(
121-
name=K8S_CONTAINER_CPU_LIMIT_UTILIZATION,
122-
callbacks=callbacks,
123-
description="Deprecated, use `k8s.container.cpu.limit.utilization` instead.",
124-
unit="1",
125-
)
126-
127-
128109
K8S_CONTAINER_CPU_REQUEST: Final = "k8s.container.cpu.request"
129110
"""
130111
Deprecated: Replaced by `k8s.container.cpu.request.desired`.
@@ -210,26 +191,6 @@ def create_k8s_container_cpu_request_utilization(
210191
)
211192

212193

213-
K8S_CONTAINER_CPU_REQUEST_UTILIZATION: Final = (
214-
"k8s.container.cpu.request_utilization"
215-
)
216-
"""
217-
Deprecated: Replaced by `k8s.container.cpu.request.utilization`.
218-
"""
219-
220-
221-
def create_k8s_container_cpu_request_utilization(
222-
meter: Meter, callbacks: Sequence[CallbackT] | None
223-
) -> ObservableGauge:
224-
"""Deprecated, use `k8s.container.cpu.request.utilization` instead"""
225-
return meter.create_observable_gauge(
226-
name=K8S_CONTAINER_CPU_REQUEST_UTILIZATION,
227-
callbacks=callbacks,
228-
description="Deprecated, use `k8s.container.cpu.request.utilization` instead.",
229-
unit="1",
230-
)
231-
232-
233194
K8S_CONTAINER_EPHEMERAL_STORAGE_LIMIT: Final = (
234195
"k8s.container.ephemeral_storage.limit"
235196
)

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/process_metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
| Generator[Iterable[Observation], CallbackOptions, None]
2121
)
2222

23+
2324
PROCESS_CONTEXT_SWITCHES: Final = "process.context_switches"
2425
"""
2526
Number of times the process has been context switched

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/system_metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
| Generator[Iterable[Observation], CallbackOptions, None]
2121
)
2222

23+
2324
SYSTEM_CPU_FREQUENCY: Final = "system.cpu.frequency"
2425
"""
2526
Operating frequency of the logical CPU in Hertz

opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/vcs_metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
| Generator[Iterable[Observation], CallbackOptions, None]
2020
)
2121

22+
2223
VCS_CHANGE_COUNT: Final = "vcs.change.count"
2324
"""
2425
The number of changes (pull requests/merge requests/changelists) in a repository, categorized by their state (e.g. open or merged)

scripts/semconv/templates/registry/semantic_metrics.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ from typing import Final
5656
{{ import_instrument_classes(filtered_metrics) }}
5757

5858
{%- for metric in ctx.metrics %}
59+
{% if metric.metric_name not in ctx.excluded_metrics %}
5960
{% set const_name = metric.metric_name | screaming_snake_case %}
6061
{{const_name}}: Final = "{{metric.metric_name}}"
6162
{%- set doc_string=write_docstring(metric, const_name, "")-%}{%- if doc_string %}
@@ -82,4 +83,5 @@ def create_{{ metric_name }}(meter: Meter) -> {{metric.instrument | map_text("py
8283
)
8384
{%- endif -%}
8485

86+
{% endif %}
8587
{% endfor %}

scripts/semconv/templates/registry/weaver.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ params:
66
# this behavior is fully controlled by jinja templates
77
excluded_attributes: ["messaging.client_id"]
88

9+
# excluded metrics will be excluded from the generated code in jinja templates
10+
excluded_metrics: ["k8s.container.cpu.limit_utilization", "k8s.container.cpu.request_utilization"]
11+
912
stable_package_name: opentelemetry.semconv
1013

1114
templates:
@@ -35,7 +38,8 @@ templates:
3538
metrics: .metrics,
3639
output: $output + "metrics/",
3740
stable_package_name: $stable_package_name + ".metrics",
38-
filter: $filter
41+
filter: $filter,
42+
excluded_metrics: $excluded_metrics
3943
})
4044
application_mode: each
4145
text_maps:

0 commit comments

Comments
 (0)