From f997ff509f82aa678a44cb74333e196d9b946fad Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Sun, 9 Jun 2024 13:50:37 -0700 Subject: [PATCH] sort metrics --- .../_incubating/metrics/container_metrics.py | 25 +- .../semconv/_incubating/metrics/db_metrics.py | 121 +++--- .../_incubating/metrics/dns_metrics.py | 1 + .../_incubating/metrics/faas_metrics.py | 121 +++--- .../_incubating/metrics/http_metrics.py | 155 +++---- .../_incubating/metrics/messaging_metrics.py | 77 ++-- .../_incubating/metrics/process_metrics.py | 103 ++--- .../_incubating/metrics/rpc_metrics.py | 113 ++--- .../_incubating/metrics/system_metrics.py | 389 +++++++++--------- .../semconv/metrics/http_metrics.py | 9 +- .../templates/registry/semantic_attributes.j2 | 3 +- .../templates/registry/semantic_metrics.j2 | 7 +- .../semconv/templates/registry/weaver.yaml | 2 +- 13 files changed, 569 insertions(+), 557 deletions(-) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/container_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/container_metrics.py index 6478d1bb31..6172868b9f 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/container_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/container_metrics.py @@ -1,4 +1,5 @@ # Copyright The OpenTelemetry Authors +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -31,36 +32,36 @@ def create_container_cpu_time(meter: Meter) -> Counter: ) -CONTAINER_MEMORY_USAGE = "container.memory.usage" +CONTAINER_DISK_IO = "container.disk.io" """ -Memory usage of the container. +Disk bytes for the container. Instrument: counter Unit: By """ -def create_container_memory_usage(meter: Meter) -> Counter: - """Memory usage of the container.""" +def create_container_disk_io(meter: Meter) -> Counter: + """Disk bytes for the container.""" return meter.create_counter( - name="container.memory.usage", - description="Memory usage of the container.", + name="container.disk.io", + description="Disk bytes for the container.", unit="By", ) -CONTAINER_DISK_IO = "container.disk.io" +CONTAINER_MEMORY_USAGE = "container.memory.usage" """ -Disk bytes for the container. +Memory usage of the container. Instrument: counter Unit: By """ -def create_container_disk_io(meter: Meter) -> Counter: - """Disk bytes for the container.""" +def create_container_memory_usage(meter: Meter) -> Counter: + """Memory usage of the container.""" return meter.create_counter( - name="container.disk.io", - description="Disk bytes for the container.", + name="container.memory.usage", + description="Memory usage of the container.", unit="By", ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/db_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/db_metrics.py index a1f3f753b7..0759308f1b 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/db_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/db_metrics.py @@ -1,4 +1,5 @@ # Copyright The OpenTelemetry Authors +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -14,23 +15,6 @@ from opentelemetry.metrics import Counter, Histogram, Meter, UpDownCounter -DB_CLIENT_OPERATION_DURATION = "db.client.operation.duration" -""" -Duration of database client operations. -Instrument: histogram -Unit: s -""" - - -def create_db_client_operation_duration(meter: Meter) -> Histogram: - """Duration of database client operations.""" - return meter.create_histogram( - name="db.client.operation.duration", - description="Duration of database client operations.", - unit="s", - ) - - DB_CLIENT_CONNECTION_COUNT = "db.client.connection.count" """ The number of connections that are currently in state described by the `state` attribute @@ -48,6 +32,23 @@ def create_db_client_connection_count(meter: Meter) -> UpDownCounter: ) +DB_CLIENT_CONNECTION_CREATE_TIME = "db.client.connection.create_time" +""" +The time it took to create a new connection +Instrument: histogram +Unit: s +""" + + +def create_db_client_connection_create_time(meter: Meter) -> Histogram: + """The time it took to create a new connection""" + return meter.create_histogram( + name="db.client.connection.create_time", + description="The time it took to create a new connection", + unit="s", + ) + + DB_CLIENT_CONNECTION_IDLE_MAX = "db.client.connection.idle.max" """ The maximum number of idle open connections allowed @@ -135,19 +136,19 @@ def create_db_client_connection_timeouts(meter: Meter) -> Counter: ) -DB_CLIENT_CONNECTION_CREATE_TIME = "db.client.connection.create_time" +DB_CLIENT_CONNECTION_USE_TIME = "db.client.connection.use_time" """ -The time it took to create a new connection +The time between borrowing a connection and returning it to the pool Instrument: histogram Unit: s """ -def create_db_client_connection_create_time(meter: Meter) -> Histogram: - """The time it took to create a new connection""" +def create_db_client_connection_use_time(meter: Meter) -> Histogram: + """The time between borrowing a connection and returning it to the pool""" return meter.create_histogram( - name="db.client.connection.create_time", - description="The time it took to create a new connection", + name="db.client.connection.use_time", + description="The time between borrowing a connection and returning it to the pool", unit="s", ) @@ -169,35 +170,18 @@ def create_db_client_connection_wait_time(meter: Meter) -> Histogram: ) -DB_CLIENT_CONNECTION_USE_TIME = "db.client.connection.use_time" +DB_CLIENT_CONNECTIONS_CREATE_TIME = "db.client.connections.create_time" """ -The time between borrowing a connection and returning it to the pool -Instrument: histogram -Unit: s +Deprecated: Replaced by `db.client.connection.create_time`. Note: the unit also changed from `ms` to `s`. """ -def create_db_client_connection_use_time(meter: Meter) -> Histogram: - """The time between borrowing a connection and returning it to the pool""" +def create_db_client_connections_create_time(meter: Meter) -> Histogram: + """Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from `ms` to `s`.""" return meter.create_histogram( - name="db.client.connection.use_time", - description="The time between borrowing a connection and returning it to the pool", - unit="s", - ) - - -DB_CLIENT_CONNECTIONS_USAGE = "db.client.connections.usage" -""" -Deprecated: Replaced by `db.client.connection.count`. -""" - - -def create_db_client_connections_usage(meter: Meter) -> UpDownCounter: - """Deprecated, use `db.client.connection.count` instead.""" - return meter.create_up_down_counter( - name="db.client.connections.usage", - description="Deprecated, use `db.client.connection.count` instead.", - unit="{connection}", + name="db.client.connections.create_time", + description="Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from `ms` to `s`.", + unit="ms", ) @@ -280,17 +264,32 @@ def create_db_client_connections_timeouts(meter: Meter) -> Counter: ) -DB_CLIENT_CONNECTIONS_CREATE_TIME = "db.client.connections.create_time" +DB_CLIENT_CONNECTIONS_USAGE = "db.client.connections.usage" """ -Deprecated: Replaced by `db.client.connection.create_time`. Note: the unit also changed from `ms` to `s`. +Deprecated: Replaced by `db.client.connection.count`. """ -def create_db_client_connections_create_time(meter: Meter) -> Histogram: - """Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from `ms` to `s`.""" +def create_db_client_connections_usage(meter: Meter) -> UpDownCounter: + """Deprecated, use `db.client.connection.count` instead.""" + return meter.create_up_down_counter( + name="db.client.connections.usage", + description="Deprecated, use `db.client.connection.count` instead.", + unit="{connection}", + ) + + +DB_CLIENT_CONNECTIONS_USE_TIME = "db.client.connections.use_time" +""" +Deprecated: Replaced by `db.client.connection.use_time`. Note: the unit also changed from `ms` to `s`. +""" + + +def create_db_client_connections_use_time(meter: Meter) -> Histogram: + """Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from `ms` to `s`.""" return meter.create_histogram( - name="db.client.connections.create_time", - description="Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from `ms` to `s`.", + name="db.client.connections.use_time", + description="Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from `ms` to `s`.", unit="ms", ) @@ -310,16 +309,18 @@ def create_db_client_connections_wait_time(meter: Meter) -> Histogram: ) -DB_CLIENT_CONNECTIONS_USE_TIME = "db.client.connections.use_time" +DB_CLIENT_OPERATION_DURATION = "db.client.operation.duration" """ -Deprecated: Replaced by `db.client.connection.use_time`. Note: the unit also changed from `ms` to `s`. +Duration of database client operations. +Instrument: histogram +Unit: s """ -def create_db_client_connections_use_time(meter: Meter) -> Histogram: - """Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from `ms` to `s`.""" +def create_db_client_operation_duration(meter: Meter) -> Histogram: + """Duration of database client operations.""" return meter.create_histogram( - name="db.client.connections.use_time", - description="Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from `ms` to `s`.", - unit="ms", + name="db.client.operation.duration", + description="Duration of database client operations.", + unit="s", ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/dns_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/dns_metrics.py index 436532dff1..028b7bca65 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/dns_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/dns_metrics.py @@ -1,4 +1,5 @@ # Copyright The OpenTelemetry Authors +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/faas_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/faas_metrics.py index 1f2a783e70..f93e707c00 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/faas_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/faas_metrics.py @@ -1,4 +1,5 @@ # Copyright The OpenTelemetry Authors +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -14,57 +15,40 @@ from opentelemetry.metrics import Counter, Histogram, Meter -FAAS_INVOKE_DURATION = "faas.invoke_duration" +FAAS_COLDSTARTS = "faas.coldstarts" """ -Measures the duration of the function's logic execution -Instrument: histogram -Unit: s +Number of invocation cold starts +Instrument: counter +Unit: {coldstart} """ -def create_faas_invoke_duration(meter: Meter) -> Histogram: - """Measures the duration of the function's logic execution""" - return meter.create_histogram( - name="faas.invoke_duration", - description="Measures the duration of the function's logic execution", - unit="s", +def create_faas_coldstarts(meter: Meter) -> Counter: + """Number of invocation cold starts""" + return meter.create_counter( + name="faas.coldstarts", + description="Number of invocation cold starts", + unit="{coldstart}", ) -FAAS_INIT_DURATION = "faas.init_duration" +FAAS_CPU_USAGE = "faas.cpu_usage" """ -Measures the duration of the function's initialization, such as a cold start +Distribution of CPU usage per invocation Instrument: histogram Unit: s """ -def create_faas_init_duration(meter: Meter) -> Histogram: - """Measures the duration of the function's initialization, such as a cold start""" +def create_faas_cpu_usage(meter: Meter) -> Histogram: + """Distribution of CPU usage per invocation""" return meter.create_histogram( - name="faas.init_duration", - description="Measures the duration of the function's initialization, such as a cold start", + name="faas.cpu_usage", + description="Distribution of CPU usage per invocation", unit="s", ) -FAAS_COLDSTARTS = "faas.coldstarts" -""" -Number of invocation cold starts -Instrument: counter -Unit: {coldstart} -""" - - -def create_faas_coldstarts(meter: Meter) -> Counter: - """Number of invocation cold starts""" - return meter.create_counter( - name="faas.coldstarts", - description="Number of invocation cold starts", - unit="{coldstart}", - ) - - FAAS_ERRORS = "faas.errors" """ Number of invocation errors @@ -82,6 +66,23 @@ def create_faas_errors(meter: Meter) -> Counter: ) +FAAS_INIT_DURATION = "faas.init_duration" +""" +Measures the duration of the function's initialization, such as a cold start +Instrument: histogram +Unit: s +""" + + +def create_faas_init_duration(meter: Meter) -> Histogram: + """Measures the duration of the function's initialization, such as a cold start""" + return meter.create_histogram( + name="faas.init_duration", + description="Measures the duration of the function's initialization, such as a cold start", + unit="s", + ) + + FAAS_INVOCATIONS = "faas.invocations" """ Number of successful invocations @@ -99,20 +100,20 @@ def create_faas_invocations(meter: Meter) -> Counter: ) -FAAS_TIMEOUTS = "faas.timeouts" +FAAS_INVOKE_DURATION = "faas.invoke_duration" """ -Number of invocation timeouts -Instrument: counter -Unit: {timeout} +Measures the duration of the function's logic execution +Instrument: histogram +Unit: s """ -def create_faas_timeouts(meter: Meter) -> Counter: - """Number of invocation timeouts""" - return meter.create_counter( - name="faas.timeouts", - description="Number of invocation timeouts", - unit="{timeout}", +def create_faas_invoke_duration(meter: Meter) -> Histogram: + """Measures the duration of the function's logic execution""" + return meter.create_histogram( + name="faas.invoke_duration", + description="Measures the duration of the function's logic execution", + unit="s", ) @@ -133,23 +134,6 @@ def create_faas_mem_usage(meter: Meter) -> Histogram: ) -FAAS_CPU_USAGE = "faas.cpu_usage" -""" -Distribution of CPU usage per invocation -Instrument: histogram -Unit: s -""" - - -def create_faas_cpu_usage(meter: Meter) -> Histogram: - """Distribution of CPU usage per invocation""" - return meter.create_histogram( - name="faas.cpu_usage", - description="Distribution of CPU usage per invocation", - unit="s", - ) - - FAAS_NET_IO = "faas.net_io" """ Distribution of net I/O usage per invocation @@ -165,3 +149,20 @@ def create_faas_net_io(meter: Meter) -> Histogram: description="Distribution of net I/O usage per invocation", unit="By", ) + + +FAAS_TIMEOUTS = "faas.timeouts" +""" +Number of invocation timeouts +Instrument: counter +Unit: {timeout} +""" + + +def create_faas_timeouts(meter: Meter) -> Counter: + """Number of invocation timeouts""" + return meter.create_counter( + name="faas.timeouts", + description="Number of invocation timeouts", + unit="{timeout}", + ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py index 4f87511ff4..ed46580cb6 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py @@ -1,4 +1,5 @@ # Copyright The OpenTelemetry Authors +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -14,70 +15,70 @@ from opentelemetry.metrics import Histogram, Meter, UpDownCounter -HTTP_SERVER_REQUEST_DURATION = "http.server.request.duration" +HTTP_CLIENT_ACTIVE_REQUESTS = "http.client.active_requests" """ -Duration of HTTP server requests. -Instrument: histogram -Unit: s +Number of active HTTP requests. +Instrument: updowncounter +Unit: {request} """ -def create_http_server_request_duration(meter: Meter) -> Histogram: - """Duration of HTTP server requests.""" - return meter.create_histogram( - name="http.server.request.duration", - description="Duration of HTTP server requests.", - unit="s", +def create_http_client_active_requests(meter: Meter) -> UpDownCounter: + """Number of active HTTP requests.""" + return meter.create_up_down_counter( + name="http.client.active_requests", + description="Number of active HTTP requests.", + unit="{request}", ) -HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests" +HTTP_CLIENT_CONNECTION_DURATION = "http.client.connection.duration" """ -Number of active HTTP server requests. -Instrument: updowncounter -Unit: {request} +The duration of the successfully established outbound HTTP connections. +Instrument: histogram +Unit: s """ -def create_http_server_active_requests(meter: Meter) -> UpDownCounter: - """Number of active HTTP server requests.""" - return meter.create_up_down_counter( - name="http.server.active_requests", - description="Number of active HTTP server requests.", - unit="{request}", +def create_http_client_connection_duration(meter: Meter) -> Histogram: + """The duration of the successfully established outbound HTTP connections.""" + return meter.create_histogram( + name="http.client.connection.duration", + description="The duration of the successfully established outbound HTTP connections.", + unit="s", ) -HTTP_SERVER_REQUEST_BODY_SIZE = "http.server.request.body.size" +HTTP_CLIENT_OPEN_CONNECTIONS = "http.client.open_connections" """ -Size of HTTP server request bodies. -Instrument: histogram -Unit: By +Number of outbound HTTP connections that are currently active or idle on the client. +Instrument: updowncounter +Unit: {connection} """ -def create_http_server_request_body_size(meter: Meter) -> Histogram: - """Size of HTTP server request bodies.""" - return meter.create_histogram( - name="http.server.request.body.size", - description="Size of HTTP server request bodies.", - unit="By", +def create_http_client_open_connections(meter: Meter) -> UpDownCounter: + """Number of outbound HTTP connections that are currently active or idle on the client.""" + return meter.create_up_down_counter( + name="http.client.open_connections", + description="Number of outbound HTTP connections that are currently active or idle on the client.", + unit="{connection}", ) -HTTP_SERVER_RESPONSE_BODY_SIZE = "http.server.response.body.size" +HTTP_CLIENT_REQUEST_BODY_SIZE = "http.client.request.body.size" """ -Size of HTTP server response bodies. +Size of HTTP client request bodies. Instrument: histogram Unit: By """ -def create_http_server_response_body_size(meter: Meter) -> Histogram: - """Size of HTTP server response bodies.""" +def create_http_client_request_body_size(meter: Meter) -> Histogram: + """Size of HTTP client request bodies.""" return meter.create_histogram( - name="http.server.response.body.size", - description="Size of HTTP server response bodies.", + name="http.client.request.body.size", + description="Size of HTTP client request bodies.", unit="By", ) @@ -99,23 +100,6 @@ def create_http_client_request_duration(meter: Meter) -> Histogram: ) -HTTP_CLIENT_REQUEST_BODY_SIZE = "http.client.request.body.size" -""" -Size of HTTP client request bodies. -Instrument: histogram -Unit: By -""" - - -def create_http_client_request_body_size(meter: Meter) -> Histogram: - """Size of HTTP client request bodies.""" - return meter.create_histogram( - name="http.client.request.body.size", - description="Size of HTTP client request bodies.", - unit="By", - ) - - HTTP_CLIENT_RESPONSE_BODY_SIZE = "http.client.response.body.size" """ Size of HTTP client response bodies. @@ -133,52 +117,69 @@ def create_http_client_response_body_size(meter: Meter) -> Histogram: ) -HTTP_CLIENT_OPEN_CONNECTIONS = "http.client.open_connections" +HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests" """ -Number of outbound HTTP connections that are currently active or idle on the client. +Number of active HTTP server requests. Instrument: updowncounter -Unit: {connection} +Unit: {request} """ -def create_http_client_open_connections(meter: Meter) -> UpDownCounter: - """Number of outbound HTTP connections that are currently active or idle on the client.""" +def create_http_server_active_requests(meter: Meter) -> UpDownCounter: + """Number of active HTTP server requests.""" return meter.create_up_down_counter( - name="http.client.open_connections", - description="Number of outbound HTTP connections that are currently active or idle on the client.", - unit="{connection}", + name="http.server.active_requests", + description="Number of active HTTP server requests.", + unit="{request}", ) -HTTP_CLIENT_CONNECTION_DURATION = "http.client.connection.duration" +HTTP_SERVER_REQUEST_BODY_SIZE = "http.server.request.body.size" """ -The duration of the successfully established outbound HTTP connections. +Size of HTTP server request bodies. +Instrument: histogram +Unit: By +""" + + +def create_http_server_request_body_size(meter: Meter) -> Histogram: + """Size of HTTP server request bodies.""" + return meter.create_histogram( + name="http.server.request.body.size", + description="Size of HTTP server request bodies.", + unit="By", + ) + + +HTTP_SERVER_REQUEST_DURATION = "http.server.request.duration" +""" +Duration of HTTP server requests. Instrument: histogram Unit: s """ -def create_http_client_connection_duration(meter: Meter) -> Histogram: - """The duration of the successfully established outbound HTTP connections.""" +def create_http_server_request_duration(meter: Meter) -> Histogram: + """Duration of HTTP server requests.""" return meter.create_histogram( - name="http.client.connection.duration", - description="The duration of the successfully established outbound HTTP connections.", + name="http.server.request.duration", + description="Duration of HTTP server requests.", unit="s", ) -HTTP_CLIENT_ACTIVE_REQUESTS = "http.client.active_requests" +HTTP_SERVER_RESPONSE_BODY_SIZE = "http.server.response.body.size" """ -Number of active HTTP requests. -Instrument: updowncounter -Unit: {request} +Size of HTTP server response bodies. +Instrument: histogram +Unit: By """ -def create_http_client_active_requests(meter: Meter) -> UpDownCounter: - """Number of active HTTP requests.""" - return meter.create_up_down_counter( - name="http.client.active_requests", - description="Number of active HTTP requests.", - unit="{request}", +def create_http_server_response_body_size(meter: Meter) -> Histogram: + """Size of HTTP server response bodies.""" + return meter.create_histogram( + name="http.server.response.body.size", + description="Size of HTTP server response bodies.", + unit="By", ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/messaging_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/messaging_metrics.py index dde99501a1..5b19a2f9de 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/messaging_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/messaging_metrics.py @@ -1,4 +1,5 @@ # Copyright The OpenTelemetry Authors +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -14,53 +15,53 @@ from opentelemetry.metrics import Counter, Histogram, Meter -MESSAGING_PUBLISH_DURATION = "messaging.publish.duration" +MESSAGING_PROCESS_DURATION = "messaging.process.duration" """ -Measures the duration of publish operation. +Measures the duration of process operation. Instrument: histogram Unit: s """ -def create_messaging_publish_duration(meter: Meter) -> Histogram: - """Measures the duration of publish operation.""" +def create_messaging_process_duration(meter: Meter) -> Histogram: + """Measures the duration of process operation.""" return meter.create_histogram( - name="messaging.publish.duration", - description="Measures the duration of publish operation.", + name="messaging.process.duration", + description="Measures the duration of process operation.", unit="s", ) -MESSAGING_RECEIVE_DURATION = "messaging.receive.duration" +MESSAGING_PROCESS_MESSAGES = "messaging.process.messages" """ -Measures the duration of receive operation. -Instrument: histogram -Unit: s +Measures the number of processed messages. +Instrument: counter +Unit: {message} """ -def create_messaging_receive_duration(meter: Meter) -> Histogram: - """Measures the duration of receive operation.""" - return meter.create_histogram( - name="messaging.receive.duration", - description="Measures the duration of receive operation.", - unit="s", +def create_messaging_process_messages(meter: Meter) -> Counter: + """Measures the number of processed messages.""" + return meter.create_counter( + name="messaging.process.messages", + description="Measures the number of processed messages.", + unit="{message}", ) -MESSAGING_PROCESS_DURATION = "messaging.process.duration" +MESSAGING_PUBLISH_DURATION = "messaging.publish.duration" """ -Measures the duration of process operation. +Measures the duration of publish operation. Instrument: histogram Unit: s """ -def create_messaging_process_duration(meter: Meter) -> Histogram: - """Measures the duration of process operation.""" +def create_messaging_publish_duration(meter: Meter) -> Histogram: + """Measures the duration of publish operation.""" return meter.create_histogram( - name="messaging.process.duration", - description="Measures the duration of process operation.", + name="messaging.publish.duration", + description="Measures the duration of publish operation.", unit="s", ) @@ -82,35 +83,35 @@ def create_messaging_publish_messages(meter: Meter) -> Counter: ) -MESSAGING_RECEIVE_MESSAGES = "messaging.receive.messages" +MESSAGING_RECEIVE_DURATION = "messaging.receive.duration" """ -Measures the number of received messages. -Instrument: counter -Unit: {message} +Measures the duration of receive operation. +Instrument: histogram +Unit: s """ -def create_messaging_receive_messages(meter: Meter) -> Counter: - """Measures the number of received messages.""" - return meter.create_counter( - name="messaging.receive.messages", - description="Measures the number of received messages.", - unit="{message}", +def create_messaging_receive_duration(meter: Meter) -> Histogram: + """Measures the duration of receive operation.""" + return meter.create_histogram( + name="messaging.receive.duration", + description="Measures the duration of receive operation.", + unit="s", ) -MESSAGING_PROCESS_MESSAGES = "messaging.process.messages" +MESSAGING_RECEIVE_MESSAGES = "messaging.receive.messages" """ -Measures the number of processed messages. +Measures the number of received messages. Instrument: counter Unit: {message} """ -def create_messaging_process_messages(meter: Meter) -> Counter: - """Measures the number of processed messages.""" +def create_messaging_receive_messages(meter: Meter) -> Counter: + """Measures the number of received messages.""" return meter.create_counter( - name="messaging.process.messages", - description="Measures the number of processed messages.", + name="messaging.receive.messages", + description="Measures the number of received messages.", unit="{message}", ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/process_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/process_metrics.py index 8b6fb12aa9..bb5f2247f9 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/process_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/process_metrics.py @@ -1,4 +1,5 @@ # Copyright The OpenTelemetry Authors +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -21,6 +22,23 @@ UpDownCounter, ) +PROCESS_CONTEXT_SWITCHES = "process.context_switches" +""" +Number of times the process has been context switched. +Instrument: counter +Unit: {count} +""" + + +def create_process_context_switches(meter: Meter) -> Counter: + """Number of times the process has been context switched.""" + return meter.create_counter( + name="process.context_switches", + description="Number of times the process has been context switched.", + unit="{count}", + ) + + PROCESS_CPU_TIME = "process.cpu.time" """ Total CPU seconds broken down by different states. @@ -58,6 +76,23 @@ def create_process_cpu_utilization( ) +PROCESS_DISK_IO = "process.disk.io" +""" +Disk bytes transferred. +Instrument: counter +Unit: By +""" + + +def create_process_disk_io(meter: Meter) -> Counter: + """Disk bytes transferred.""" + return meter.create_counter( + name="process.disk.io", + description="Disk bytes transferred.", + unit="By", + ) + + PROCESS_MEMORY_USAGE = "process.memory.usage" """ The amount of physical memory in use. @@ -92,23 +127,6 @@ def create_process_memory_virtual(meter: Meter) -> UpDownCounter: ) -PROCESS_DISK_IO = "process.disk.io" -""" -Disk bytes transferred. -Instrument: counter -Unit: By -""" - - -def create_process_disk_io(meter: Meter) -> Counter: - """Disk bytes transferred.""" - return meter.create_counter( - name="process.disk.io", - description="Disk bytes transferred.", - unit="By", - ) - - PROCESS_NETWORK_IO = "process.network.io" """ Network bytes transferred. @@ -126,23 +144,6 @@ def create_process_network_io(meter: Meter) -> Counter: ) -PROCESS_THREAD_COUNT = "process.thread.count" -""" -Process threads count. -Instrument: updowncounter -Unit: {thread} -""" - - -def create_process_thread_count(meter: Meter) -> UpDownCounter: - """Process threads count.""" - return meter.create_up_down_counter( - name="process.thread.count", - description="Process threads count.", - unit="{thread}", - ) - - PROCESS_OPEN_FILE_DESCRIPTOR_COUNT = "process.open_file_descriptor.count" """ Number of file descriptors in use by the process. @@ -160,23 +161,6 @@ def create_process_open_file_descriptor_count(meter: Meter) -> UpDownCounter: ) -PROCESS_CONTEXT_SWITCHES = "process.context_switches" -""" -Number of times the process has been context switched. -Instrument: counter -Unit: {count} -""" - - -def create_process_context_switches(meter: Meter) -> Counter: - """Number of times the process has been context switched.""" - return meter.create_counter( - name="process.context_switches", - description="Number of times the process has been context switched.", - unit="{count}", - ) - - PROCESS_PAGING_FAULTS = "process.paging.faults" """ Number of page faults the process has made. @@ -192,3 +176,20 @@ def create_process_paging_faults(meter: Meter) -> Counter: description="Number of page faults the process has made.", unit="{fault}", ) + + +PROCESS_THREAD_COUNT = "process.thread.count" +""" +Process threads count. +Instrument: updowncounter +Unit: {thread} +""" + + +def create_process_thread_count(meter: Meter) -> UpDownCounter: + """Process threads count.""" + return meter.create_up_down_counter( + name="process.thread.count", + description="Process threads count.", + unit="{thread}", + ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/rpc_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/rpc_metrics.py index a3ce1523c5..6bcbced88a 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/rpc_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/rpc_metrics.py @@ -1,4 +1,5 @@ # Copyright The OpenTelemetry Authors +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -14,24 +15,24 @@ from opentelemetry.metrics import Histogram, Meter -RPC_SERVER_DURATION = "rpc.server.duration" +RPC_CLIENT_DURATION = "rpc.client.duration" """ -Measures the duration of inbound RPC. +Measures the duration of outbound RPC. Instrument: histogram Unit: ms """ -def create_rpc_server_duration(meter: Meter) -> Histogram: - """Measures the duration of inbound RPC.""" +def create_rpc_client_duration(meter: Meter) -> Histogram: + """Measures the duration of outbound RPC.""" return meter.create_histogram( - name="rpc.server.duration", - description="Measures the duration of inbound RPC.", + name="rpc.client.duration", + description="Measures the duration of outbound RPC.", unit="ms", ) -RPC_SERVER_REQUEST_SIZE = "rpc.server.request.size" +RPC_CLIENT_REQUEST_SIZE = "rpc.client.request.size" """ Measures the size of RPC request messages (uncompressed). Instrument: histogram @@ -39,50 +40,50 @@ def create_rpc_server_duration(meter: Meter) -> Histogram: """ -def create_rpc_server_request_size(meter: Meter) -> Histogram: +def create_rpc_client_request_size(meter: Meter) -> Histogram: """Measures the size of RPC request messages (uncompressed).""" return meter.create_histogram( - name="rpc.server.request.size", + name="rpc.client.request.size", description="Measures the size of RPC request messages (uncompressed).", unit="By", ) -RPC_SERVER_RESPONSE_SIZE = "rpc.server.response.size" +RPC_CLIENT_REQUESTS_PER_RPC = "rpc.client.requests_per_rpc" """ -Measures the size of RPC response messages (uncompressed). +Measures the number of messages received per RPC. Instrument: histogram -Unit: By +Unit: {count} """ -def create_rpc_server_response_size(meter: Meter) -> Histogram: - """Measures the size of RPC response messages (uncompressed).""" +def create_rpc_client_requests_per_rpc(meter: Meter) -> Histogram: + """Measures the number of messages received per RPC.""" return meter.create_histogram( - name="rpc.server.response.size", - description="Measures the size of RPC response messages (uncompressed).", - unit="By", + name="rpc.client.requests_per_rpc", + description="Measures the number of messages received per RPC.", + unit="{count}", ) -RPC_SERVER_REQUESTS_PER_RPC = "rpc.server.requests_per_rpc" +RPC_CLIENT_RESPONSE_SIZE = "rpc.client.response.size" """ -Measures the number of messages received per RPC. +Measures the size of RPC response messages (uncompressed). Instrument: histogram -Unit: {count} +Unit: By """ -def create_rpc_server_requests_per_rpc(meter: Meter) -> Histogram: - """Measures the number of messages received per RPC.""" +def create_rpc_client_response_size(meter: Meter) -> Histogram: + """Measures the size of RPC response messages (uncompressed).""" return meter.create_histogram( - name="rpc.server.requests_per_rpc", - description="Measures the number of messages received per RPC.", - unit="{count}", + name="rpc.client.response.size", + description="Measures the size of RPC response messages (uncompressed).", + unit="By", ) -RPC_SERVER_RESPONSES_PER_RPC = "rpc.server.responses_per_rpc" +RPC_CLIENT_RESPONSES_PER_RPC = "rpc.client.responses_per_rpc" """ Measures the number of messages sent per RPC. Instrument: histogram @@ -90,33 +91,33 @@ def create_rpc_server_requests_per_rpc(meter: Meter) -> Histogram: """ -def create_rpc_server_responses_per_rpc(meter: Meter) -> Histogram: +def create_rpc_client_responses_per_rpc(meter: Meter) -> Histogram: """Measures the number of messages sent per RPC.""" return meter.create_histogram( - name="rpc.server.responses_per_rpc", + name="rpc.client.responses_per_rpc", description="Measures the number of messages sent per RPC.", unit="{count}", ) -RPC_CLIENT_DURATION = "rpc.client.duration" +RPC_SERVER_DURATION = "rpc.server.duration" """ -Measures the duration of outbound RPC. +Measures the duration of inbound RPC. Instrument: histogram Unit: ms """ -def create_rpc_client_duration(meter: Meter) -> Histogram: - """Measures the duration of outbound RPC.""" +def create_rpc_server_duration(meter: Meter) -> Histogram: + """Measures the duration of inbound RPC.""" return meter.create_histogram( - name="rpc.client.duration", - description="Measures the duration of outbound RPC.", + name="rpc.server.duration", + description="Measures the duration of inbound RPC.", unit="ms", ) -RPC_CLIENT_REQUEST_SIZE = "rpc.client.request.size" +RPC_SERVER_REQUEST_SIZE = "rpc.server.request.size" """ Measures the size of RPC request messages (uncompressed). Instrument: histogram @@ -124,50 +125,50 @@ def create_rpc_client_duration(meter: Meter) -> Histogram: """ -def create_rpc_client_request_size(meter: Meter) -> Histogram: +def create_rpc_server_request_size(meter: Meter) -> Histogram: """Measures the size of RPC request messages (uncompressed).""" return meter.create_histogram( - name="rpc.client.request.size", + name="rpc.server.request.size", description="Measures the size of RPC request messages (uncompressed).", unit="By", ) -RPC_CLIENT_RESPONSE_SIZE = "rpc.client.response.size" +RPC_SERVER_REQUESTS_PER_RPC = "rpc.server.requests_per_rpc" """ -Measures the size of RPC response messages (uncompressed). +Measures the number of messages received per RPC. Instrument: histogram -Unit: By +Unit: {count} """ -def create_rpc_client_response_size(meter: Meter) -> Histogram: - """Measures the size of RPC response messages (uncompressed).""" +def create_rpc_server_requests_per_rpc(meter: Meter) -> Histogram: + """Measures the number of messages received per RPC.""" return meter.create_histogram( - name="rpc.client.response.size", - description="Measures the size of RPC response messages (uncompressed).", - unit="By", + name="rpc.server.requests_per_rpc", + description="Measures the number of messages received per RPC.", + unit="{count}", ) -RPC_CLIENT_REQUESTS_PER_RPC = "rpc.client.requests_per_rpc" +RPC_SERVER_RESPONSE_SIZE = "rpc.server.response.size" """ -Measures the number of messages received per RPC. +Measures the size of RPC response messages (uncompressed). Instrument: histogram -Unit: {count} +Unit: By """ -def create_rpc_client_requests_per_rpc(meter: Meter) -> Histogram: - """Measures the number of messages received per RPC.""" +def create_rpc_server_response_size(meter: Meter) -> Histogram: + """Measures the size of RPC response messages (uncompressed).""" return meter.create_histogram( - name="rpc.client.requests_per_rpc", - description="Measures the number of messages received per RPC.", - unit="{count}", + name="rpc.server.response.size", + description="Measures the size of RPC response messages (uncompressed).", + unit="By", ) -RPC_CLIENT_RESPONSES_PER_RPC = "rpc.client.responses_per_rpc" +RPC_SERVER_RESPONSES_PER_RPC = "rpc.server.responses_per_rpc" """ Measures the number of messages sent per RPC. Instrument: histogram @@ -175,10 +176,10 @@ def create_rpc_client_requests_per_rpc(meter: Meter) -> Histogram: """ -def create_rpc_client_responses_per_rpc(meter: Meter) -> Histogram: +def create_rpc_server_responses_per_rpc(meter: Meter) -> Histogram: """Measures the number of messages sent per RPC.""" return meter.create_histogram( - name="rpc.client.responses_per_rpc", + name="rpc.server.responses_per_rpc", description="Measures the number of messages sent per RPC.", unit="{count}", ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/system_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/system_metrics.py index 2a14112fad..8f9f8233a4 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/system_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/system_metrics.py @@ -1,4 +1,5 @@ # Copyright The OpenTelemetry Authors +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -21,43 +22,6 @@ UpDownCounter, ) -SYSTEM_CPU_TIME = "system.cpu.time" -""" -Seconds each logical CPU spent on each mode -Instrument: counter -Unit: s -""" - - -def create_system_cpu_time(meter: Meter) -> Counter: - """Seconds each logical CPU spent on each mode""" - return meter.create_counter( - name="system.cpu.time", - description="Seconds each logical CPU spent on each mode", - unit="s", - ) - - -SYSTEM_CPU_UTILIZATION = "system.cpu.utilization" -""" -Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs -Instrument: gauge -Unit: 1 -""" - - -def create_system_cpu_utilization( - meter: Meter, callback: Sequence[Callable] -) -> ObservableGauge: - """Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs""" - return meter.create_observable_gauge( - name="system.cpu.utilization", - callback=callback, - description="Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs", - unit="1", - ) - - SYSTEM_CPU_FREQUENCY = "system.cpu.frequency" """ Reports the current frequency of the CPU in Hz @@ -78,23 +42,6 @@ def create_system_cpu_frequency( ) -SYSTEM_CPU_PHYSICAL_COUNT = "system.cpu.physical.count" -""" -Reports the number of actual physical processor cores on the hardware -Instrument: updowncounter -Unit: {cpu} -""" - - -def create_system_cpu_physical_count(meter: Meter) -> UpDownCounter: - """Reports the number of actual physical processor cores on the hardware""" - return meter.create_up_down_counter( - name="system.cpu.physical.count", - description="Reports the number of actual physical processor cores on the hardware", - unit="{cpu}", - ) - - SYSTEM_CPU_LOGICAL_COUNT = "system.cpu.logical.count" """ Reports the number of logical (virtual) processor cores created by the operating system to manage multitasking @@ -112,225 +59,252 @@ def create_system_cpu_logical_count(meter: Meter) -> UpDownCounter: ) -SYSTEM_MEMORY_USAGE = "system.memory.usage" +SYSTEM_CPU_PHYSICAL_COUNT = "system.cpu.physical.count" """ -Reports memory in use by state. +Reports the number of actual physical processor cores on the hardware Instrument: updowncounter -Unit: By +Unit: {cpu} """ -def create_system_memory_usage(meter: Meter) -> UpDownCounter: - """Reports memory in use by state.""" +def create_system_cpu_physical_count(meter: Meter) -> UpDownCounter: + """Reports the number of actual physical processor cores on the hardware""" return meter.create_up_down_counter( - name="system.memory.usage", - description="Reports memory in use by state.", - unit="By", + name="system.cpu.physical.count", + description="Reports the number of actual physical processor cores on the hardware", + unit="{cpu}", ) -SYSTEM_MEMORY_LIMIT = "system.memory.limit" +SYSTEM_CPU_TIME = "system.cpu.time" """ -Total memory available in the system. -Instrument: updowncounter -Unit: By +Seconds each logical CPU spent on each mode +Instrument: counter +Unit: s """ -def create_system_memory_limit(meter: Meter) -> UpDownCounter: - """Total memory available in the system.""" - return meter.create_up_down_counter( - name="system.memory.limit", - description="Total memory available in the system.", - unit="By", +def create_system_cpu_time(meter: Meter) -> Counter: + """Seconds each logical CPU spent on each mode""" + return meter.create_counter( + name="system.cpu.time", + description="Seconds each logical CPU spent on each mode", + unit="s", ) -SYSTEM_MEMORY_SHARED = "system.memory.shared" +SYSTEM_CPU_UTILIZATION = "system.cpu.utilization" """ -Shared memory used (mostly by tmpfs). -Instrument: updowncounter -Unit: By +Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs +Instrument: gauge +Unit: 1 """ -def create_system_memory_shared(meter: Meter) -> UpDownCounter: - """Shared memory used (mostly by tmpfs).""" - return meter.create_up_down_counter( - name="system.memory.shared", - description="Shared memory used (mostly by tmpfs).", - unit="By", +def create_system_cpu_utilization( + meter: Meter, callback: Sequence[Callable] +) -> ObservableGauge: + """Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs""" + return meter.create_observable_gauge( + name="system.cpu.utilization", + callback=callback, + description="Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs", + unit="1", ) -SYSTEM_MEMORY_UTILIZATION = "system.memory.utilization" +SYSTEM_DISK_IO = "system.disk.io" -def create_system_memory_utilization( - meter: Meter, callback: Sequence[Callable] -) -> ObservableGauge: +def create_system_disk_io(meter: Meter) -> Counter: """none""" - return meter.create_observable_gauge( - name="system.memory.utilization", - callback=callback, + return meter.create_counter( + name="system.disk.io", description="none", - unit="1", + unit="By", ) -SYSTEM_PAGING_USAGE = "system.paging.usage" +SYSTEM_DISK_IO_TIME = "system.disk.io_time" """ -Unix swap or windows pagefile usage -Instrument: updowncounter -Unit: By +Time disk spent activated +Instrument: counter +Unit: s """ -def create_system_paging_usage(meter: Meter) -> UpDownCounter: - """Unix swap or windows pagefile usage""" - return meter.create_up_down_counter( - name="system.paging.usage", - description="Unix swap or windows pagefile usage", - unit="By", +def create_system_disk_io_time(meter: Meter) -> Counter: + """Time disk spent activated""" + return meter.create_counter( + name="system.disk.io_time", + description="Time disk spent activated", + unit="s", ) -SYSTEM_PAGING_UTILIZATION = "system.paging.utilization" +SYSTEM_DISK_MERGED = "system.disk.merged" -def create_system_paging_utilization( - meter: Meter, callback: Sequence[Callable] -) -> ObservableGauge: +def create_system_disk_merged(meter: Meter) -> Counter: """none""" - return meter.create_observable_gauge( - name="system.paging.utilization", - callback=callback, + return meter.create_counter( + name="system.disk.merged", description="none", - unit="1", + unit="{operation}", ) -SYSTEM_PAGING_FAULTS = "system.paging.faults" +SYSTEM_DISK_OPERATION_TIME = "system.disk.operation_time" +""" +Sum of the time each operation took to complete +Instrument: counter +Unit: s +""" -def create_system_paging_faults(meter: Meter) -> Counter: - """none""" +def create_system_disk_operation_time(meter: Meter) -> Counter: + """Sum of the time each operation took to complete""" return meter.create_counter( - name="system.paging.faults", - description="none", - unit="{fault}", + name="system.disk.operation_time", + description="Sum of the time each operation took to complete", + unit="s", ) -SYSTEM_PAGING_OPERATIONS = "system.paging.operations" +SYSTEM_DISK_OPERATIONS = "system.disk.operations" -def create_system_paging_operations(meter: Meter) -> Counter: +def create_system_disk_operations(meter: Meter) -> Counter: """none""" return meter.create_counter( - name="system.paging.operations", + name="system.disk.operations", description="none", unit="{operation}", ) -SYSTEM_DISK_IO = "system.disk.io" +SYSTEM_FILESYSTEM_USAGE = "system.filesystem.usage" -def create_system_disk_io(meter: Meter) -> Counter: +def create_system_filesystem_usage(meter: Meter) -> UpDownCounter: """none""" - return meter.create_counter( - name="system.disk.io", + return meter.create_up_down_counter( + name="system.filesystem.usage", description="none", unit="By", ) -SYSTEM_DISK_OPERATIONS = "system.disk.operations" +SYSTEM_FILESYSTEM_UTILIZATION = "system.filesystem.utilization" -def create_system_disk_operations(meter: Meter) -> Counter: +def create_system_filesystem_utilization( + meter: Meter, callback: Sequence[Callable] +) -> ObservableGauge: """none""" - return meter.create_counter( - name="system.disk.operations", + return meter.create_observable_gauge( + name="system.filesystem.utilization", + callback=callback, description="none", - unit="{operation}", + unit="1", ) -SYSTEM_DISK_IO_TIME = "system.disk.io_time" +SYSTEM_LINUX_MEMORY_AVAILABLE = "system.linux.memory.available" """ -Time disk spent activated -Instrument: counter -Unit: s +An estimate of how much memory is available for starting new applications, without causing swapping +Instrument: updowncounter +Unit: By """ -def create_system_disk_io_time(meter: Meter) -> Counter: - """Time disk spent activated""" - return meter.create_counter( - name="system.disk.io_time", - description="Time disk spent activated", - unit="s", +def create_system_linux_memory_available(meter: Meter) -> UpDownCounter: + """An estimate of how much memory is available for starting new applications, without causing swapping""" + return meter.create_up_down_counter( + name="system.linux.memory.available", + description="An estimate of how much memory is available for starting new applications, without causing swapping", + unit="By", ) -SYSTEM_DISK_OPERATION_TIME = "system.disk.operation_time" +SYSTEM_MEMORY_LIMIT = "system.memory.limit" """ -Sum of the time each operation took to complete -Instrument: counter -Unit: s +Total memory available in the system. +Instrument: updowncounter +Unit: By """ -def create_system_disk_operation_time(meter: Meter) -> Counter: - """Sum of the time each operation took to complete""" - return meter.create_counter( - name="system.disk.operation_time", - description="Sum of the time each operation took to complete", - unit="s", +def create_system_memory_limit(meter: Meter) -> UpDownCounter: + """Total memory available in the system.""" + return meter.create_up_down_counter( + name="system.memory.limit", + description="Total memory available in the system.", + unit="By", ) -SYSTEM_DISK_MERGED = "system.disk.merged" +SYSTEM_MEMORY_SHARED = "system.memory.shared" +""" +Shared memory used (mostly by tmpfs). +Instrument: updowncounter +Unit: By +""" -def create_system_disk_merged(meter: Meter) -> Counter: - """none""" - return meter.create_counter( - name="system.disk.merged", - description="none", - unit="{operation}", +def create_system_memory_shared(meter: Meter) -> UpDownCounter: + """Shared memory used (mostly by tmpfs).""" + return meter.create_up_down_counter( + name="system.memory.shared", + description="Shared memory used (mostly by tmpfs).", + unit="By", ) -SYSTEM_FILESYSTEM_USAGE = "system.filesystem.usage" +SYSTEM_MEMORY_USAGE = "system.memory.usage" +""" +Reports memory in use by state. +Instrument: updowncounter +Unit: By +""" -def create_system_filesystem_usage(meter: Meter) -> UpDownCounter: - """none""" +def create_system_memory_usage(meter: Meter) -> UpDownCounter: + """Reports memory in use by state.""" return meter.create_up_down_counter( - name="system.filesystem.usage", - description="none", + name="system.memory.usage", + description="Reports memory in use by state.", unit="By", ) -SYSTEM_FILESYSTEM_UTILIZATION = "system.filesystem.utilization" +SYSTEM_MEMORY_UTILIZATION = "system.memory.utilization" -def create_system_filesystem_utilization( +def create_system_memory_utilization( meter: Meter, callback: Sequence[Callable] ) -> ObservableGauge: """none""" return meter.create_observable_gauge( - name="system.filesystem.utilization", + name="system.memory.utilization", callback=callback, description="none", unit="1", ) +SYSTEM_NETWORK_CONNECTIONS = "system.network.connections" + + +def create_system_network_connections(meter: Meter) -> UpDownCounter: + """none""" + return meter.create_up_down_counter( + name="system.network.connections", + description="none", + unit="{connection}", + ) + + SYSTEM_NETWORK_DROPPED = "system.network.dropped" """ Count of packets that are dropped or discarded even though there was no error @@ -348,18 +322,6 @@ def create_system_network_dropped(meter: Meter) -> Counter: ) -SYSTEM_NETWORK_PACKETS = "system.network.packets" - - -def create_system_network_packets(meter: Meter) -> Counter: - """none""" - return meter.create_counter( - name="system.network.packets", - description="none", - unit="{packet}", - ) - - SYSTEM_NETWORK_ERRORS = "system.network.errors" """ Count of network errors detected @@ -389,15 +351,71 @@ def create_system_network_io(meter: Meter) -> Counter: ) -SYSTEM_NETWORK_CONNECTIONS = "system.network.connections" +SYSTEM_NETWORK_PACKETS = "system.network.packets" -def create_system_network_connections(meter: Meter) -> UpDownCounter: +def create_system_network_packets(meter: Meter) -> Counter: """none""" + return meter.create_counter( + name="system.network.packets", + description="none", + unit="{packet}", + ) + + +SYSTEM_PAGING_FAULTS = "system.paging.faults" + + +def create_system_paging_faults(meter: Meter) -> Counter: + """none""" + return meter.create_counter( + name="system.paging.faults", + description="none", + unit="{fault}", + ) + + +SYSTEM_PAGING_OPERATIONS = "system.paging.operations" + + +def create_system_paging_operations(meter: Meter) -> Counter: + """none""" + return meter.create_counter( + name="system.paging.operations", + description="none", + unit="{operation}", + ) + + +SYSTEM_PAGING_USAGE = "system.paging.usage" +""" +Unix swap or windows pagefile usage +Instrument: updowncounter +Unit: By +""" + + +def create_system_paging_usage(meter: Meter) -> UpDownCounter: + """Unix swap or windows pagefile usage""" return meter.create_up_down_counter( - name="system.network.connections", + name="system.paging.usage", + description="Unix swap or windows pagefile usage", + unit="By", + ) + + +SYSTEM_PAGING_UTILIZATION = "system.paging.utilization" + + +def create_system_paging_utilization( + meter: Meter, callback: Sequence[Callable] +) -> ObservableGauge: + """none""" + return meter.create_observable_gauge( + name="system.paging.utilization", + callback=callback, description="none", - unit="{connection}", + unit="1", ) @@ -433,20 +451,3 @@ def create_system_process_created(meter: Meter) -> Counter: description="Total number of processes created over uptime of the host", unit="{process}", ) - - -SYSTEM_LINUX_MEMORY_AVAILABLE = "system.linux.memory.available" -""" -An estimate of how much memory is available for starting new applications, without causing swapping -Instrument: updowncounter -Unit: By -""" - - -def create_system_linux_memory_available(meter: Meter) -> UpDownCounter: - """An estimate of how much memory is available for starting new applications, without causing swapping""" - return meter.create_up_down_counter( - name="system.linux.memory.available", - description="An estimate of how much memory is available for starting new applications, without causing swapping", - unit="By", - ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/http_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/http_metrics.py index 5de296fc53..f7cff501c0 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/http_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/http_metrics.py @@ -1,4 +1,5 @@ # Copyright The OpenTelemetry Authors +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -12,17 +13,17 @@ # limitations under the License. -HTTP_SERVER_REQUEST_DURATION = "http.server.request.duration" +HTTP_CLIENT_REQUEST_DURATION = "http.client.request.duration" """ -Duration of HTTP server requests. +Duration of HTTP client requests. Instrument: histogram Unit: s """ -HTTP_CLIENT_REQUEST_DURATION = "http.client.request.duration" +HTTP_SERVER_REQUEST_DURATION = "http.server.request.duration" """ -Duration of HTTP client requests. +Duration of HTTP server requests. Instrument: histogram Unit: s """ diff --git a/scripts/semconv/templates/registry/semantic_attributes.j2 b/scripts/semconv/templates/registry/semantic_attributes.j2 index 605d58e488..be938f4b14 100644 --- a/scripts/semconv/templates/registry/semantic_attributes.j2 +++ b/scripts/semconv/templates/registry/semantic_attributes.j2 @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -{%- set file_name = ctx.output + (ctx.id | kebab_case | replace('-', '_')) ~ "_attributes.py" -%} + +{% set file_name = ctx.output + (ctx.id | kebab_case | replace('-', '_')) ~ "_attributes.py" -%} {{- template.set_file_name(file_name) -}} {%- import 'common.j2' as c %} diff --git a/scripts/semconv/templates/registry/semantic_metrics.j2 b/scripts/semconv/templates/registry/semantic_metrics.j2 index e7d5a78e6a..e3b2d4d9cf 100644 --- a/scripts/semconv/templates/registry/semantic_metrics.j2 +++ b/scripts/semconv/templates/registry/semantic_metrics.j2 @@ -1,7 +1,5 @@ -{%- set file_name = ctx.output + ctx.id | kebab_case | replace('-', '_') ~ "_metrics.py" -%} -{{- template.set_file_name(file_name) -}} - # Copyright The OpenTelemetry Authors +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -14,6 +12,9 @@ # 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" -%} +{{- template.set_file_name(file_name) -}} + {% import 'common.j2' as c -%} {%- macro write_docstring(metric, prefix) -%} diff --git a/scripts/semconv/templates/registry/weaver.yaml b/scripts/semconv/templates/registry/weaver.yaml index cd9f93af06..5af004a15e 100644 --- a/scripts/semconv/templates/registry/weaver.yaml +++ b/scripts/semconv/templates/registry/weaver.yaml @@ -36,7 +36,7 @@ templates: | group_by(.group_id) | map({ id: .[0].group_id, - metrics: ., + metrics: . | sort_by(.metric_name), output: $output + "metrics/", stable_package_name: $stable_package_name + ".metrics", filter: $filter