From 2bcbbcc94bf1deb3883e702d62b0ba4df95f8baf Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Thu, 10 Oct 2024 09:51:51 -0700 Subject: [PATCH] Generate Semantic Conventions 1.28.0 (#4218) --- CHANGELOG.md | 2 + .../_incubating/attributes/az_attributes.py | 5 + .../attributes/cloud_attributes.py | 2 +- .../attributes/cloudfoundry_attributes.py | 118 +++++++++++++ .../attributes/container_attributes.py | 18 +- .../_incubating/attributes/db_attributes.py | 79 +++++---- .../_incubating/attributes/file_attributes.py | 72 ++++++++ .../attributes/gen_ai_attributes.py | 48 +++++- .../_incubating/attributes/http_attributes.py | 4 +- .../_incubating/attributes/hw_attributes.py | 82 +++++++++ .../_incubating/attributes/k8s_attributes.py | 26 +++ .../_incubating/attributes/log_attributes.py | 2 +- .../attributes/messaging_attributes.py | 10 +- .../_incubating/attributes/otel_attributes.py | 4 +- .../attributes/process_attributes.py | 34 ++++ .../attributes/profile_attributes.py | 42 +++++ .../_incubating/attributes/tls_attributes.py | 2 +- .../_incubating/metrics/container_metrics.py | 47 +++++- .../semconv/_incubating/metrics/db_metrics.py | 6 +- .../semconv/_incubating/metrics/hw_metrics.py | 111 +++++++++++++ .../_incubating/metrics/k8s_metrics.py | 157 ++++++++++++++++++ .../_incubating/metrics/messaging_metrics.py | 27 ++- .../_incubating/metrics/process_metrics.py | 18 ++ .../_incubating/metrics/system_metrics.py | 40 ++++- .../src/opentelemetry/semconv/schemas.py | 5 + scripts/semconv/generate.sh | 4 +- 26 files changed, 900 insertions(+), 65 deletions(-) create mode 100644 opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloudfoundry_attributes.py create mode 100644 opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/hw_attributes.py create mode 100644 opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/profile_attributes.py create mode 100644 opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/hw_metrics.py create mode 100644 opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/k8s_metrics.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 9848078bbde..6699a625537 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#4094](https://github.com/open-telemetry/opentelemetry-python/pull/4094)) - Implement events sdk ([#4176](https://github.com/open-telemetry/opentelemetry-python/pull/4176)) +- Update semantic conventions to version 1.28.0 + ([#4218](https://github.com/open-telemetry/opentelemetry-python/pull/4218)) ## Version 1.27.0/0.48b0 (2024-08-28) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/az_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/az_attributes.py index f9b64662b9b..f55696535ac 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/az_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/az_attributes.py @@ -14,6 +14,11 @@ from typing import Final +AZ_NAMESPACE: Final = "az.namespace" +""" +[Azure Resource Provider Namespace](https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers) as recognized by the client. +""" + AZ_SERVICE_REQUEST_ID: Final = "az.service_request_id" """ The unique identifier of the service request. It's generated by the Azure service and returned with the response. diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloud_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloud_attributes.py index 03856218d9e..6836db55365 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloud_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloud_attributes.py @@ -60,7 +60,7 @@ * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names) * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/rest/api/resources/resources/get-by-id) of the invoked function, *not* the function app, having the form - `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share a TracerProvider. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloudfoundry_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloudfoundry_attributes.py new file mode 100644 index 00000000000..19fc6843e58 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloudfoundry_attributes.py @@ -0,0 +1,118 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import Final + +CLOUDFOUNDRY_APP_ID: Final = "cloudfoundry.app.id" +""" +The guid of the application. +Note: Application instrumentation should use the value from environment +variable `VCAP_APPLICATION.application_id`. This is the same value as +reported by `cf app --guid`. +""" + +CLOUDFOUNDRY_APP_INSTANCE_ID: Final = "cloudfoundry.app.instance.id" +""" +The index of the application instance. 0 when just one instance is active. +Note: CloudFoundry defines the `instance_id` in the [Loggegator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope). +It is used for logs and metrics emitted by CloudFoundry. It is +supposed to contain the application instance index for applications +deployed on the runtime. + +Application instrumentation should use the value from environment +variable `CF_INSTANCE_INDEX`. +""" + +CLOUDFOUNDRY_APP_NAME: Final = "cloudfoundry.app.name" +""" +The name of the application. +Note: Application instrumentation should use the value from environment +variable `VCAP_APPLICATION.application_name`. This is the same value +as reported by `cf apps`. +""" + +CLOUDFOUNDRY_ORG_ID: Final = "cloudfoundry.org.id" +""" +The guid of the CloudFoundry org the application is running in. +Note: Application instrumentation should use the value from environment +variable `VCAP_APPLICATION.org_id`. This is the same value as +reported by `cf org --guid`. +""" + +CLOUDFOUNDRY_ORG_NAME: Final = "cloudfoundry.org.name" +""" +The name of the CloudFoundry organization the app is running in. +Note: Application instrumentation should use the value from environment +variable `VCAP_APPLICATION.org_name`. This is the same value as +reported by `cf orgs`. +""" + +CLOUDFOUNDRY_PROCESS_ID: Final = "cloudfoundry.process.id" +""" +The UID identifying the process. +Note: Application instrumentation should use the value from environment +variable `VCAP_APPLICATION.process_id`. It is supposed to be equal to +`VCAP_APPLICATION.app_id` for applications deployed to the runtime. +For system components, this could be the actual PID. +""" + +CLOUDFOUNDRY_PROCESS_TYPE: Final = "cloudfoundry.process.type" +""" +The type of process. +Note: CloudFoundry applications can consist of multiple jobs. Usually the +main process will be of type `web`. There can be additional background +tasks or side-cars with different process types. +""" + +CLOUDFOUNDRY_SPACE_ID: Final = "cloudfoundry.space.id" +""" +The guid of the CloudFoundry space the application is running in. +Note: Application instrumentation should use the value from environment +variable `VCAP_APPLICATION.space_id`. This is the same value as +reported by `cf space --guid`. +""" + +CLOUDFOUNDRY_SPACE_NAME: Final = "cloudfoundry.space.name" +""" +The name of the CloudFoundry space the application is running in. +Note: Application instrumentation should use the value from environment +variable `VCAP_APPLICATION.space_name`. This is the same value as +reported by `cf spaces`. +""" + +CLOUDFOUNDRY_SYSTEM_ID: Final = "cloudfoundry.system.id" +""" +A guid or another name describing the event source. +Note: CloudFoundry defines the `source_id` in the [Loggregator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope). +It is used for logs and metrics emitted by CloudFoundry. It is +supposed to contain the component name, e.g. "gorouter", for +CloudFoundry components. + +When system components are instrumented, values from the +[Bosh spec](https://bosh.io/docs/jobs/#properties-spec) +should be used. The `system.id` should be set to +`spec.deployment/spec.name`. +""" + +CLOUDFOUNDRY_SYSTEM_INSTANCE_ID: Final = "cloudfoundry.system.instance.id" +""" +A guid describing the concrete instance of the event source. +Note: CloudFoundry defines the `instance_id` in the [Loggregator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope). +It is used for logs and metrics emitted by CloudFoundry. It is +supposed to contain the vm id for CloudFoundry components. + +When system components are instrumented, values from the +[Bosh spec](https://bosh.io/docs/jobs/#properties-spec) +should be used. The `system.instance.id` should be set to `spec.id`. +""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/container_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/container_attributes.py index 874e5c0058b..128769194e7 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/container_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/container_attributes.py @@ -25,12 +25,12 @@ CONTAINER_COMMAND_ARGS: Final = "container.command_args" """ -All the command arguments (including the command/executable itself) run by the container. [2]. +All the command arguments (including the command/executable itself) run by the container. """ CONTAINER_COMMAND_LINE: Final = "container.command_line" """ -The full command run by the container as a single string representing the full command. [2]. +The full command run by the container as a single string representing the full command. """ CONTAINER_CPU_STATE: Final = "container.cpu.state" @@ -38,9 +38,21 @@ Deprecated: Replaced by `cpu.mode`. """ +CONTAINER_CSI_PLUGIN_NAME: Final = "container.csi.plugin.name" +""" +The name of the CSI ([Container Storage Interface](https://github.com/container-storage-interface/spec)) plugin used by the volume. +Note: This can sometimes be referred to as a "driver" in CSI implementations. This should represent the `name` field of the GetPluginInfo RPC. +""" + +CONTAINER_CSI_VOLUME_ID: Final = "container.csi.volume.id" +""" +The unique volume ID returned by the CSI ([Container Storage Interface](https://github.com/container-storage-interface/spec)) plugin. +Note: This can sometimes be referred to as a "volume handle" in CSI implementations. This should represent the `Volume.volume_id` field in CSI spec. +""" + CONTAINER_ID: Final = "container.id" """ -Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated. +Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/containers/run/#container-identification). The UUID might be abbreviated. """ CONTAINER_IMAGE_ID: Final = "container.image.id" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py index 0c54f474b9f..14974bbd4ff 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py @@ -80,11 +80,12 @@ Note: It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization. If the collection name is parsed from the query text, it SHOULD be the first collection name found in the query and it SHOULD match the value provided in the query text including any schema and database name prefix. For batch operations, if the individual operations are known to have the same collection name then that collection name SHOULD be used, otherwise `db.collection.name` SHOULD NOT be captured. +This attribute has stability level RELEASE CANDIDATE. """ DB_CONNECTION_STRING: Final = "db.connection_string" """ -Deprecated: "Replaced by `server.address` and `server.port`.". +Deprecated: Replaced by `server.address` and `server.port`. """ DB_COSMOSDB_CLIENT_ID: Final = "db.cosmosdb.client_id" @@ -104,7 +105,7 @@ DB_COSMOSDB_OPERATION_TYPE: Final = "db.cosmosdb.operation_type" """ -CosmosDB Operation Type. +Cosmos DB Operation Type. """ DB_COSMOSDB_REQUEST_CHARGE: Final = "db.cosmosdb.request_charge" @@ -121,7 +122,7 @@ DB_COSMOSDB_STATUS_CODE: Final = "db.cosmosdb.status_code" """ -Cosmos DB status code. +Deprecated: Replaced by `db.response.status_code`. """ DB_COSMOSDB_SUB_STATUS_CODE: Final = "db.cosmosdb.sub_status_code" @@ -176,6 +177,7 @@ Note: If a database system has multiple namespace components, they SHOULD be concatenated (potentially using database system specific conventions) from most general to most specific namespace component, and more specific namespaces SHOULD NOT be captured without the more general namespaces, to ensure that "startswith" queries for the more general namespaces will be valid. Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system. It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization. +This attribute has stability level RELEASE CANDIDATE. """ DB_OPERATION: Final = "db.operation" @@ -185,8 +187,9 @@ DB_OPERATION_BATCH_SIZE: Final = "db.operation.batch.size" """ -The number of queries included in a [batch operation](/docs/database/database-spans.md#batch-operations). +The number of queries included in a batch operation. Note: Operations are only considered batches when they contain two or more operations, and so `db.operation.batch.size` SHOULD never be `1`. +This attribute has stability level RELEASE CANDIDATE. """ DB_OPERATION_NAME: Final = "db.operation.name" @@ -195,6 +198,7 @@ Note: It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization. If the operation name is parsed from the query text, it SHOULD be the first operation name found in the query. For batch operations, if the individual operations are known to have the same operation name then that operation name SHOULD be used prepended by `BATCH `, otherwise `db.operation.name` SHOULD be `BATCH` or some other database system specific term if more applicable. +This attribute has stability level RELEASE CANDIDATE. """ DB_QUERY_PARAMETER_TEMPLATE: Final = "db.query.parameter" @@ -202,6 +206,7 @@ A query parameter used in `db.query.text`, with `` being the parameter name, and the attribute value being a string representation of the parameter value. Note: Query parameters should only be captured when `db.query.text` is parameterized with placeholders. If a parameter has no name and instead is referenced only by index, then `` SHOULD be the 0-based index. +This attribute has stability level RELEASE CANDIDATE. """ DB_QUERY_TEXT: Final = "db.query.text" @@ -210,6 +215,7 @@ Note: For sanitization see [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext). For batch operations, if the individual operations are known to have the same query text then that query text SHOULD be used, otherwise all of the individual query texts SHOULD be concatenated with separator `; ` or some other database system specific separator if more applicable. Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk. +This attribute has stability level RELEASE CANDIDATE. """ DB_REDIS_DATABASE_INDEX: Final = "db.redis.database_index" @@ -217,6 +223,14 @@ Deprecated: Replaced by `db.namespace`. """ +DB_RESPONSE_STATUS_CODE: Final = "db.response.status_code" +""" +Database response status code. +Note: The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes. +Semantic conventions for individual database systems SHOULD document what `db.response.status_code` means in the context of that system. +This attribute has stability level RELEASE CANDIDATE. +""" + DB_SQL_TABLE: Final = "db.sql.table" """ Deprecated: Replaced by `db.collection.name`. @@ -231,6 +245,7 @@ """ The database management system (DBMS) product as identified by the client instrumentation. Note: The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system` is set to `postgresql` based on the instrumentation's best knowledge. +This attribute has stability level RELEASE CANDIDATE. """ DB_USER: Final = "db.user" @@ -287,36 +302,36 @@ class DbCosmosdbConnectionModeValues(Enum): class DbCosmosdbOperationTypeValues(Enum): - INVALID = "Invalid" - """invalid.""" - CREATE = "Create" + BATCH = "batch" + """batch.""" + CREATE = "create" """create.""" - PATCH = "Patch" - """patch.""" - READ = "Read" - """read.""" - READ_FEED = "ReadFeed" - """read_feed.""" - DELETE = "Delete" + DELETE = "delete" """delete.""" - REPLACE = "Replace" - """replace.""" - EXECUTE = "Execute" + EXECUTE = "execute" """execute.""" - QUERY = "Query" - """query.""" - HEAD = "Head" + EXECUTE_JAVASCRIPT = "execute_javascript" + """execute_javascript.""" + INVALID = "invalid" + """invalid.""" + HEAD = "head" """head.""" - HEAD_FEED = "HeadFeed" + HEAD_FEED = "head_feed" """head_feed.""" - UPSERT = "Upsert" - """upsert.""" - BATCH = "Batch" - """batch.""" - QUERY_PLAN = "QueryPlan" + PATCH = "patch" + """patch.""" + QUERY = "query" + """query.""" + QUERY_PLAN = "query_plan" """query_plan.""" - EXECUTE_JAVASCRIPT = "ExecuteJavaScript" - """execute_javascript.""" + READ = "read" + """read.""" + READ_FEED = "read_feed" + """read_feed.""" + REPLACE = "replace" + """replace.""" + UPSERT = "upsert" + """upsert.""" class DbSystemValues(Enum): @@ -383,7 +398,7 @@ class DbSystemValues(Enum): INTERBASE = "interbase" """InterBase.""" MARIADB = "mariadb" - """MariaDB.""" + """MariaDB (This value has stability level RELEASE CANDIDATE).""" MAXDB = "maxdb" """SAP MaxDB.""" MEMCACHED = "memcached" @@ -391,11 +406,11 @@ class DbSystemValues(Enum): MONGODB = "mongodb" """MongoDB.""" MSSQL = "mssql" - """Microsoft SQL Server.""" + """Microsoft SQL Server (This value has stability level RELEASE CANDIDATE).""" MSSQLCOMPACT = "mssqlcompact" """Deprecated: Removed, use `other_sql` instead.""" MYSQL = "mysql" - """MySQL.""" + """MySQL (This value has stability level RELEASE CANDIDATE).""" NEO4J = "neo4j" """Neo4j.""" NETEZZA = "netezza" @@ -409,7 +424,7 @@ class DbSystemValues(Enum): POINTBASE = "pointbase" """PointBase.""" POSTGRESQL = "postgresql" - """PostgreSQL.""" + """PostgreSQL (This value has stability level RELEASE CANDIDATE).""" PROGRESS = "progress" """Progress Database.""" REDIS = "redis" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/file_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/file_attributes.py index 3546465c22c..97ac01e1185 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/file_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/file_attributes.py @@ -14,6 +14,30 @@ from typing import Final +FILE_ACCESSED: Final = "file.accessed" +""" +Time when the file was last accessed, in ISO 8601 format. +Note: This attribute might not be supported by some file systems — NFS, FAT32, in embedded OS, etc. +""" + +FILE_ATTRIBUTES: Final = "file.attributes" +""" +Array of file attributes. +Note: Attributes names depend on the OS or file system. Here’s a non-exhaustive list of values expected for this attribute: `archive`, `compressed`, `directory`, `encrypted`, `execute`, `hidden`, `immutable`, `journaled`, `read`, `readonly`, `symbolic link`, `system`, `temporary`, `write`. +""" + +FILE_CHANGED: Final = "file.changed" +""" +Time when the file attributes or metadata was last changed, in ISO 8601 format. +Note: `file.changed` captures the time when any of the file's properties or attributes (including the content) are changed, while `file.modified` captures the timestamp when the file content is modified. +""" + +FILE_CREATED: Final = "file.created" +""" +Time when the file was created, in ISO 8601 format. +Note: This attribute might not be supported by some file systems — NFS, FAT32, in embedded OS, etc. +""" + FILE_DIRECTORY: Final = "file.directory" """ Directory where the file is located. It should include the drive letter, when appropriate. @@ -25,11 +49,53 @@ Note: When the file name has multiple extensions (example.tar.gz), only the last one should be captured ("gz", not "tar.gz"). """ +FILE_FORK_NAME: Final = "file.fork_name" +""" +Name of the fork. A fork is additional data associated with a filesystem object. +Note: On Linux, a resource fork is used to store additional data with a filesystem object. A file always has at least one fork for the data portion, and additional forks may exist. +On NTFS, this is analogous to an Alternate Data Stream (ADS), and the default data stream for a file is just called $DATA. Zone.Identifier is commonly used by Windows to track contents downloaded from the Internet. An ADS is typically of the form: C:\\path\\to\\filename.extension:some_fork_name, and some_fork_name is the value that should populate `fork_name`. `filename.extension` should populate `file.name`, and `extension` should populate `file.extension`. The full path, `file.path`, will include the fork name. +""" + +FILE_GROUP_ID: Final = "file.group.id" +""" +Primary Group ID (GID) of the file. +""" + +FILE_GROUP_NAME: Final = "file.group.name" +""" +Primary group name of the file. +""" + +FILE_INODE: Final = "file.inode" +""" +Inode representing the file in the filesystem. +""" + +FILE_MODE: Final = "file.mode" +""" +Mode of the file in octal representation. +""" + +FILE_MODIFIED: Final = "file.modified" +""" +Time when the file content was last modified, in ISO 8601 format. +""" + FILE_NAME: Final = "file.name" """ Name of the file including the extension, without the directory. """ +FILE_OWNER_ID: Final = "file.owner.id" +""" +The user ID (UID) or security identifier (SID) of the file owner. +""" + +FILE_OWNER_NAME: Final = "file.owner.name" +""" +Username of the file owner. +""" + FILE_PATH: Final = "file.path" """ Full path to the file, including the file name. It should include the drive letter, when appropriate. @@ -39,3 +105,9 @@ """ File size in bytes. """ + +FILE_SYMBOLIC_LINK_TARGET_PATH: Final = "file.symbolic_link.target_path" +""" +Path to the target of a symbolic link. +Note: This attribute is only applicable to symbolic links. +""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gen_ai_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gen_ai_attributes.py index 9f8e13b16e0..dbaf4525215 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gen_ai_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gen_ai_attributes.py @@ -17,8 +17,33 @@ GEN_AI_COMPLETION: Final = "gen_ai.completion" """ -The full response received from the GenAI model. -Note: It's RECOMMENDED to format completions as JSON string matching [OpenAI messages format](https://platform.openai.com/docs/guides/text-generation). +Deprecated: Removed, no replacement at this time. +""" + +GEN_AI_OPENAI_REQUEST_RESPONSE_FORMAT: Final = ( + "gen_ai.openai.request.response_format" +) +""" +The response format that is requested. +""" + +GEN_AI_OPENAI_REQUEST_SEED: Final = "gen_ai.openai.request.seed" +""" +Requests with same seed value more likely to return same result. +""" + +GEN_AI_OPENAI_REQUEST_SERVICE_TIER: Final = ( + "gen_ai.openai.request.service_tier" +) +""" +The service tier requested. May be a specific tier, detault, or auto. +""" + +GEN_AI_OPENAI_RESPONSE_SERVICE_TIER: Final = ( + "gen_ai.openai.response.service_tier" +) +""" +The service tier used for the response. """ GEN_AI_OPERATION_NAME: Final = "gen_ai.operation.name" @@ -29,8 +54,7 @@ GEN_AI_PROMPT: Final = "gen_ai.prompt" """ -The full prompt sent to the GenAI model. -Note: It's RECOMMENDED to format prompts as JSON string matching [OpenAI messages format](https://platform.openai.com/docs/guides/text-generation). +Deprecated: Removed, no replacement at this time. """ GEN_AI_REQUEST_FREQUENCY_PENALTY: Final = "gen_ai.request.frequency_penalty" @@ -128,6 +152,22 @@ """ +class GenAiOpenaiRequestResponseFormatValues(Enum): + TEXT = "text" + """Text response format.""" + JSON_OBJECT = "json_object" + """JSON object response format.""" + JSON_SCHEMA = "json_schema" + """JSON schema response format.""" + + +class GenAiOpenaiRequestServiceTierValues(Enum): + AUTO = "auto" + """The system will utilize scale tier credits until they are exhausted.""" + DEFAULT = "default" + """The system will utilize the default scale tier.""" + + class GenAiOperationNameValues(Enum): CHAT = "chat" """Chat completion operation such as [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat).""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py index 7d86af7f2ce..3631c890c65 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py @@ -74,7 +74,7 @@ HTTP_REQUEST_CONTENT_LENGTH: Final = "http.request_content_length" """ -Deprecated: Replaced by `http.request.header.content-length`. +Deprecated: Replaced by `http.request.header.`. """ HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED: Final = ( @@ -106,7 +106,7 @@ HTTP_RESPONSE_CONTENT_LENGTH: Final = "http.response_content_length" """ -Deprecated: Replaced by `http.response.header.content-length`. +Deprecated: Replaced by `http.response.header.`. """ HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED: Final = ( diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/hw_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/hw_attributes.py new file mode 100644 index 00000000000..510eb976491 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/hw_attributes.py @@ -0,0 +1,82 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from enum import Enum +from typing import Final + +HW_ID: Final = "hw.id" +""" +An identifier for the hardware component, unique within the monitored host. +""" + +HW_NAME: Final = "hw.name" +""" +An easily-recognizable name for the hardware component. +""" + +HW_PARENT: Final = "hw.parent" +""" +Unique identifier of the parent component (typically the `hw.id` attribute of the enclosure, or disk controller). +""" + +HW_STATE: Final = "hw.state" +""" +The current state of the component. +""" + +HW_TYPE: Final = "hw.type" +""" +Type of the component. +Note: Describes the category of the hardware component for which `hw.state` is being reported. For example, `hw.type=temperature` along with `hw.state=degraded` would indicate that the temperature of the hardware component has been reported as `degraded`. +""" + + +class HwStateValues(Enum): + OK = "ok" + """Ok.""" + DEGRADED = "degraded" + """Degraded.""" + FAILED = "failed" + """Failed.""" + + +class HwTypeValues(Enum): + BATTERY = "battery" + """Battery.""" + CPU = "cpu" + """CPU.""" + DISK_CONTROLLER = "disk_controller" + """Disk controller.""" + ENCLOSURE = "enclosure" + """Enclosure.""" + FAN = "fan" + """Fan.""" + GPU = "gpu" + """GPU.""" + LOGICAL_DISK = "logical_disk" + """Logical disk.""" + MEMORY = "memory" + """Memory.""" + NETWORK = "network" + """Network.""" + PHYSICAL_DISK = "physical_disk" + """Physical disk.""" + POWER_SUPPLY = "power_supply" + """Power supply.""" + TAPE_DRIVE = "tape_drive" + """Tape drive.""" + TEMPERATURE = "temperature" + """Temperature.""" + VOLTAGE = "voltage" + """Voltage.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/k8s_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/k8s_attributes.py index 6cfbb491f54..e72d0ca616b 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/k8s_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/k8s_attributes.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from enum import Enum from typing import Final K8S_CLUSTER_NAME: Final = "k8s.cluster.name" @@ -162,3 +163,28 @@ """ The UID of the StatefulSet. """ + +K8S_VOLUME_NAME: Final = "k8s.volume.name" +""" +The name of the K8s volume. +""" + +K8S_VOLUME_TYPE: Final = "k8s.volume.type" +""" +The type of the K8s volume. +""" + + +class K8sVolumeTypeValues(Enum): + PERSISTENT_VOLUME_CLAIM = "persistentVolumeClaim" + """A [persistentVolumeClaim](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim) volume.""" + CONFIG_MAP = "configMap" + """A [configMap](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap) volume.""" + DOWNWARD_API = "downwardAPI" + """A [downwardAPI](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi) volume.""" + EMPTY_DIR = "emptyDir" + """An [emptyDir](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir) volume.""" + SECRET = "secret" + """A [secret](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#secret) volume.""" + LOCAL = "local" + """A [local](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#local) volume.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/log_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/log_attributes.py index 7655bf6b7c9..cd1fbbc36c8 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/log_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/log_attributes.py @@ -42,7 +42,7 @@ LOG_RECORD_ORIGINAL: Final = "log.record.original" """ -The complete orignal Log Record. +The complete original Log Record. Note: This value MAY be added when processing a Log Record which was originally transmitted as a string or equivalent data type AND the Body field of the Log Record does not contain the same value. (e.g. a syslog or a log record read from a file.). """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/messaging_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/messaging_attributes.py index a5f422eb894..8a58729cde7 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/messaging_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/messaging_attributes.py @@ -271,7 +271,7 @@ "messaging.servicebus.destination.subscription_name" ) """ -Deprecated: Replaced by `messaging.servicebus.destination.subscription_name`. +Deprecated: Replaced by `messaging.destination.subscription.name`. """ MESSAGING_SERVICEBUS_DISPOSITION_STATUS: Final = ( @@ -303,10 +303,10 @@ class MessagingOperationTypeValues(Enum): - PUBLISH = "publish" - """One or more messages are provided for publishing to an intermediary. If a single message is published, the context of the "Publish" span can be used as the creation context and no "Create" span needs to be created.""" CREATE = "create" - """A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch publishing scenarios.""" + """A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch sending scenarios.""" + SEND = "send" + """One or more messages are provided for sending to an intermediary. If a single message is sent, the context of the "Send" span can be used as the creation context and no "Create" span needs to be created.""" RECEIVE = "receive" """One or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages.""" PROCESS = "process" @@ -315,6 +315,8 @@ class MessagingOperationTypeValues(Enum): """One or more messages are settled.""" DELIVER = "deliver" """Deprecated: Replaced by `process`.""" + PUBLISH = "publish" + """Deprecated: Replaced by `send`.""" class MessagingRocketmqConsumptionModelValues(Enum): diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py index b74c7094876..968e0609443 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py @@ -19,12 +19,12 @@ OTEL_LIBRARY_NAME: Final = "otel.library.name" """ -Deprecated: use the `otel.scope.name` attribute. +Deprecated: Use the `otel.scope.name` attribute. """ OTEL_LIBRARY_VERSION: Final = "otel.library.version" """ -Deprecated: use the `otel.scope.version` attribute. +Deprecated: Use the `otel.scope.version` attribute. """ OTEL_SCOPE_NAME: Final = "otel.scope.name" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/process_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/process_attributes.py index 1c6fd42bc25..e5d7dc69d34 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/process_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/process_attributes.py @@ -17,6 +17,12 @@ from deprecated import deprecated +PROCESS_ARGS_COUNT: Final = "process.args_count" +""" +Length of the process.command_args array. +Note: This field can be useful for querying or performing bucket analysis on how many arguments were provided to start a process. More arguments may be an indication of suspicious activity. +""" + PROCESS_COMMAND: Final = "process.command" """ The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`. @@ -47,6 +53,23 @@ The date and time the process was created, in ISO 8601 format. """ +PROCESS_EXECUTABLE_BUILD_ID_GNU: Final = "process.executable.build_id.gnu" +""" +The GNU build ID as found in the `.note.gnu.build-id` ELF section (hex string). +""" + +PROCESS_EXECUTABLE_BUILD_ID_GO: Final = "process.executable.build_id.go" +""" +The Go build ID as retrieved by `go tool buildid `. +""" + +PROCESS_EXECUTABLE_BUILD_ID_PROFILING: Final = ( + "process.executable.build_id.profiling" +) +""" +Profiling specific build ID for executables. See the OTel specification for Profiles for more information. +""" + PROCESS_EXECUTABLE_NAME: Final = "process.executable.name" """ The name of the process executable. On Linux based systems, can be set to the `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`. @@ -137,6 +160,12 @@ The PID of the process's session leader. This is also the session ID (SID) of the process. """ +PROCESS_TITLE: Final = "process.title" +""" +Process title (proctitle). +Note: In many Unix-like systems, process title (proctitle), is the string that represents the name or command line of a running process, displayed by system monitoring tools like ps, top, and htop. +""" + PROCESS_USER_ID: Final = "process.user.id" """ The effective user ID (EUID) of the process. @@ -153,6 +182,11 @@ Note: The process ID within a PID namespace. This is not necessarily unique across all processes on the host but it is unique within the process namespace that the process exists within. """ +PROCESS_WORKING_DIRECTORY: Final = "process.working_directory" +""" +The working directory of the process. +""" + class ProcessContextSwitchTypeValues(Enum): VOLUNTARY = "voluntary" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/profile_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/profile_attributes.py new file mode 100644 index 00000000000..ea39cd654c2 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/profile_attributes.py @@ -0,0 +1,42 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from enum import Enum +from typing import Final + +PROFILE_FRAME_TYPE: Final = "profile.frame.type" +""" +Describes the interpreter or compiler of a single frame. +""" + + +class ProfileFrameTypeValues(Enum): + DOTNET = "dotnet" + """[.NET](https://wikipedia.org/wiki/.NET).""" + JVM = "jvm" + """[JVM](https://wikipedia.org/wiki/Java_virtual_machine).""" + KERNEL = "kernel" + """[Kernel](https://wikipedia.org/wiki/Kernel_(operating_system)).""" + NATIVE = "native" + """[C](https://wikipedia.org/wiki/C_(programming_language)), [C++](https://wikipedia.org/wiki/C%2B%2B), [Go](https://wikipedia.org/wiki/Go_(programming_language)), [Rust](https://wikipedia.org/wiki/Rust_(programming_language)).""" + PERL = "perl" + """[Perl](https://wikipedia.org/wiki/Perl).""" + PHP = "php" + """[PHP](https://wikipedia.org/wiki/PHP).""" + CPYTHON = "cpython" + """[Python](https://wikipedia.org/wiki/Python_(programming_language)).""" + RUBY = "ruby" + """[Ruby](https://wikipedia.org/wiki/Ruby_(programming_language)).""" + V8JS = "v8js" + """[V8JS](https://wikipedia.org/wiki/V8_(JavaScript_engine)).""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/tls_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/tls_attributes.py index 076c3e6a4f1..43c525bdc3b 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/tls_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/tls_attributes.py @@ -68,7 +68,7 @@ TLS_CLIENT_SERVER_NAME: Final = "tls.client.server_name" """ -Deprecated: Replaced by `server.address. +Deprecated: Replaced by `server.address`. """ TLS_CLIENT_SUBJECT: Final = "tls.client.subject" 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 5030b61c85d..76b09419dec 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 @@ -13,9 +13,29 @@ # limitations under the License. -from typing import Final - -from opentelemetry.metrics import Counter, Meter +from typing import ( + Callable, + Final, + Generator, + Iterable, + Optional, + Sequence, + Union, +) + +from opentelemetry.metrics import ( + CallbackOptions, + Counter, + Meter, + ObservableGauge, + Observation, +) + +# pylint: disable=invalid-name +CallbackT = Union[ + Callable[[CallbackOptions], Iterable[Observation]], + Generator[Iterable[Observation], CallbackOptions, None], +] CONTAINER_CPU_TIME: Final = "container.cpu.time" """ @@ -35,6 +55,27 @@ def create_container_cpu_time(meter: Meter) -> Counter: ) +CONTAINER_CPU_USAGE: Final = "container.cpu.usage" +""" +Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs +Instrument: gauge +Unit: {cpu} +Note: CPU usage of the specific container on all available CPU cores, averaged over the sample window. +""" + + +def create_container_cpu_usage( + meter: Meter, callbacks: Optional[Sequence[CallbackT]] +) -> ObservableGauge: + """Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs""" + return meter.create_observable_gauge( + name=CONTAINER_CPU_USAGE, + callbacks=callbacks, + description="Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs", + unit="{cpu}", + ) + + CONTAINER_DISK_IO: Final = "container.disk.io" """ Disk bytes for the container 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 350fb06289d..077207616a7 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 @@ -106,7 +106,7 @@ def create_db_client_connection_max(meter: Meter) -> UpDownCounter: "db.client.connection.pending_requests" ) """ -The number of pending requests for an open connection, cumulative for the entire pool +The number of current pending requests for an open connection Instrument: updowncounter Unit: {request} """ @@ -115,10 +115,10 @@ def create_db_client_connection_max(meter: Meter) -> UpDownCounter: def create_db_client_connection_pending_requests( meter: Meter, ) -> UpDownCounter: - """The number of pending requests for an open connection, cumulative for the entire pool""" + """The number of current pending requests for an open connection""" return meter.create_up_down_counter( name=DB_CLIENT_CONNECTION_PENDING_REQUESTS, - description="The number of pending requests for an open connection, cumulative for the entire pool", + description="The number of current pending requests for an open connection", unit="{request}", ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/hw_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/hw_metrics.py new file mode 100644 index 00000000000..ca615236e7a --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/hw_metrics.py @@ -0,0 +1,111 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from typing import ( + Callable, + Final, + Generator, + Iterable, + Optional, + Sequence, + Union, +) + +from opentelemetry.metrics import ( + CallbackOptions, + Counter, + Meter, + ObservableGauge, + Observation, + UpDownCounter, +) + +# pylint: disable=invalid-name +CallbackT = Union[ + Callable[[CallbackOptions], Iterable[Observation]], + Generator[Iterable[Observation], CallbackOptions, None], +] + +HW_ENERGY: Final = "hw.energy" +""" +Energy consumed by the component +Instrument: counter +Unit: J +""" + + +def create_hw_energy(meter: Meter) -> Counter: + """Energy consumed by the component""" + return meter.create_counter( + name=HW_ENERGY, + description="Energy consumed by the component", + unit="J", + ) + + +HW_ERRORS: Final = "hw.errors" +""" +Number of errors encountered by the component +Instrument: counter +Unit: {error} +""" + + +def create_hw_errors(meter: Meter) -> Counter: + """Number of errors encountered by the component""" + return meter.create_counter( + name=HW_ERRORS, + description="Number of errors encountered by the component", + unit="{error}", + ) + + +HW_POWER: Final = "hw.power" +""" +Instantaneous power consumed by the component +Instrument: gauge +Unit: W +Note: It is recommended to report `hw.energy` instead of `hw.power` when possible. +""" + + +def create_hw_power( + meter: Meter, callbacks: Optional[Sequence[CallbackT]] +) -> ObservableGauge: + """Instantaneous power consumed by the component""" + return meter.create_observable_gauge( + name=HW_POWER, + callbacks=callbacks, + description="Instantaneous power consumed by the component", + unit="W", + ) + + +HW_STATUS: Final = "hw.status" +""" +Operational status: `1` (true) or `0` (false) for each of the possible states +Instrument: updowncounter +Unit: 1 +Note: `hw.status` is currently specified as an *UpDownCounter* but would ideally be represented using a [*StateSet* as defined in OpenMetrics](https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#stateset). This semantic convention will be updated once *StateSet* is specified in OpenTelemetry. This planned change is not expected to have any consequence on the way users query their timeseries backend to retrieve the values of `hw.status` over time. +""" + + +def create_hw_status(meter: Meter) -> UpDownCounter: + """Operational status: `1` (true) or `0` (false) for each of the possible states""" + return meter.create_up_down_counter( + name=HW_STATUS, + description="Operational status: `1` (true) or `0` (false) for each of the possible states", + unit="1", + ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/k8s_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/k8s_metrics.py new file mode 100644 index 00000000000..feb85ab17c4 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/k8s_metrics.py @@ -0,0 +1,157 @@ +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from typing import ( + Callable, + Final, + Generator, + Iterable, + Optional, + Sequence, + Union, +) + +from opentelemetry.metrics import ( + CallbackOptions, + Counter, + Meter, + ObservableGauge, + Observation, +) + +# pylint: disable=invalid-name +CallbackT = Union[ + Callable[[CallbackOptions], Iterable[Observation]], + Generator[Iterable[Observation], CallbackOptions, None], +] + +K8S_NODE_CPU_TIME: Final = "k8s.node.cpu.time" +""" +Total CPU time consumed +Instrument: counter +Unit: s +Note: Total CPU time consumed by the specific Node on all available CPU cores. +""" + + +def create_k8s_node_cpu_time(meter: Meter) -> Counter: + """Total CPU time consumed""" + return meter.create_counter( + name=K8S_NODE_CPU_TIME, + description="Total CPU time consumed", + unit="s", + ) + + +K8S_NODE_CPU_USAGE: Final = "k8s.node.cpu.usage" +""" +Node's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs +Instrument: gauge +Unit: {cpu} +Note: CPU usage of the specific Node on all available CPU cores, averaged over the sample window. +""" + + +def create_k8s_node_cpu_usage( + meter: Meter, callbacks: Optional[Sequence[CallbackT]] +) -> ObservableGauge: + """Node's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs""" + return meter.create_observable_gauge( + name=K8S_NODE_CPU_USAGE, + callbacks=callbacks, + description="Node's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs", + unit="{cpu}", + ) + + +K8S_NODE_MEMORY_USAGE: Final = "k8s.node.memory.usage" +""" +Memory usage of the Node +Instrument: gauge +Unit: By +Note: Total memory usage of the Node. +""" + + +def create_k8s_node_memory_usage( + meter: Meter, callbacks: Optional[Sequence[CallbackT]] +) -> ObservableGauge: + """Memory usage of the Node""" + return meter.create_observable_gauge( + name=K8S_NODE_MEMORY_USAGE, + callbacks=callbacks, + description="Memory usage of the Node", + unit="By", + ) + + +K8S_POD_CPU_TIME: Final = "k8s.pod.cpu.time" +""" +Total CPU time consumed +Instrument: counter +Unit: s +Note: Total CPU time consumed by the specific Pod on all available CPU cores. +""" + + +def create_k8s_pod_cpu_time(meter: Meter) -> Counter: + """Total CPU time consumed""" + return meter.create_counter( + name=K8S_POD_CPU_TIME, + description="Total CPU time consumed", + unit="s", + ) + + +K8S_POD_CPU_USAGE: Final = "k8s.pod.cpu.usage" +""" +Pod's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs +Instrument: gauge +Unit: {cpu} +Note: CPU usage of the specific Pod on all available CPU cores, averaged over the sample window. +""" + + +def create_k8s_pod_cpu_usage( + meter: Meter, callbacks: Optional[Sequence[CallbackT]] +) -> ObservableGauge: + """Pod's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs""" + return meter.create_observable_gauge( + name=K8S_POD_CPU_USAGE, + callbacks=callbacks, + description="Pod's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs", + unit="{cpu}", + ) + + +K8S_POD_MEMORY_USAGE: Final = "k8s.pod.memory.usage" +""" +Memory usage of the Pod +Instrument: gauge +Unit: By +Note: Total memory usage of the Pod. +""" + + +def create_k8s_pod_memory_usage( + meter: Meter, callbacks: Optional[Sequence[CallbackT]] +) -> ObservableGauge: + """Memory usage of the Pod""" + return meter.create_observable_gauge( + name=K8S_POD_MEMORY_USAGE, + callbacks=callbacks, + description="Memory usage of the Pod", + 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 2db60b053a3..0418743f4aa 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 @@ -62,18 +62,33 @@ def create_messaging_client_operation_duration(meter: Meter) -> Histogram: "messaging.client.published.messages" ) """ -Number of messages producer attempted to publish to the broker -Instrument: counter -Unit: {message} -Note: This metric MUST NOT count messages that were created haven't yet been attempted to be published. +Deprecated: Replaced by `messaging.client.sent.messages`. """ def create_messaging_client_published_messages(meter: Meter) -> Counter: - """Number of messages producer attempted to publish to the broker""" + """Deprecated. Use `messaging.client.sent.messages` instead""" return meter.create_counter( name=MESSAGING_CLIENT_PUBLISHED_MESSAGES, - description="Number of messages producer attempted to publish to the broker.", + description="Deprecated. Use `messaging.client.sent.messages` instead.", + unit="{message}", + ) + + +MESSAGING_CLIENT_SENT_MESSAGES: Final = "messaging.client.sent.messages" +""" +Number of messages producer attempted to send to the broker +Instrument: counter +Unit: {message} +Note: This metric MUST NOT count messages that were created but haven't yet been sent. +""" + + +def create_messaging_client_sent_messages(meter: Meter) -> Counter: + """Number of messages producer attempted to send to the broker""" + return meter.create_counter( + name=MESSAGING_CLIENT_SENT_MESSAGES, + description="Number of messages producer attempted to send to the broker.", 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 4d499c74966..881776c217b 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 @@ -211,3 +211,21 @@ def create_process_thread_count(meter: Meter) -> UpDownCounter: description="Process threads count.", unit="{thread}", ) + + +PROCESS_UPTIME: Final = "process.uptime" +""" +The time the process has been running +Instrument: counter +Unit: s +Note: Instrumentations SHOULD use counter with type `double` and measure uptime with at least millisecond precision. +""" + + +def create_process_uptime(meter: Meter) -> Counter: + """The time the process has been running""" + return meter.create_counter( + name=PROCESS_UPTIME, + description="The time the process has been running.", + unit="s", + ) 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 f641a7fe80e..8851929dd3f 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 @@ -167,6 +167,23 @@ def create_system_disk_io_time(meter: Meter) -> Counter: ) +SYSTEM_DISK_LIMIT: Final = "system.disk.limit" +""" +The total storage capacity of the disk +Instrument: updowncounter +Unit: By +""" + + +def create_system_disk_limit(meter: Meter) -> UpDownCounter: + """The total storage capacity of the disk""" + return meter.create_up_down_counter( + name=SYSTEM_DISK_LIMIT, + description="The total storage capacity of the disk", + unit="By", + ) + + SYSTEM_DISK_MERGED: Final = "system.disk.merged" """ Instrument: counter @@ -218,17 +235,38 @@ def create_system_disk_operations(meter: Meter) -> Counter: ) +SYSTEM_FILESYSTEM_LIMIT: Final = "system.filesystem.limit" +""" +The total storage capacity of the filesystem +Instrument: updowncounter +Unit: By +""" + + +def create_system_filesystem_limit(meter: Meter) -> UpDownCounter: + """The total storage capacity of the filesystem""" + return meter.create_up_down_counter( + name=SYSTEM_FILESYSTEM_LIMIT, + description="The total storage capacity of the filesystem", + unit="By", + ) + + SYSTEM_FILESYSTEM_USAGE: Final = "system.filesystem.usage" """ +Reports a filesystem's space usage across different states Instrument: updowncounter Unit: By +Note: The sum of all `system.filesystem.usage` values over the different `system.filesystem.state` attributes +SHOULD equal the total storage capacity of the filesystem, that is `system.filesystem.limit`. """ def create_system_filesystem_usage(meter: Meter) -> UpDownCounter: + """Reports a filesystem's space usage across different states""" return meter.create_up_down_counter( name=SYSTEM_FILESYSTEM_USAGE, - description="", + description="Reports a filesystem's space usage across different states.", unit="By", ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py index 31a34479451..a565194705f 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py @@ -36,5 +36,10 @@ class Schemas(Enum): The URL of the OpenTelemetry schema version 1.27.0. """ + V1_28_0 = "https://opentelemetry.io/schemas/1.28.0" + """ + The URL of the OpenTelemetry schema version 1.28.0. + """ + # when generating new semantic conventions, # make sure to add new versions version here. diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index a04cc105aee..38df0bfd346 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -5,9 +5,9 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../.." # freeze the spec version to make SemanticAttributes generation reproducible -SEMCONV_VERSION=1.27.0 +SEMCONV_VERSION=1.28.0 SEMCONV_VERSION_TAG=v$SEMCONV_VERSION -OTEL_WEAVER_IMG_VERSION=0.8.0 +OTEL_WEAVER_IMG_VERSION=v0.10.0 INCUBATING_DIR=_incubating cd ${SCRIPT_DIR}