Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opentelemetry-semantic-conventions: bump to v1.26.0 #3964

Merged
merged 4 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- add `Final` decorator to constants to prevent collisions
- enable mypy and fix detected issues
- allow to drop specific attributes in preparation for Semantic Conventions v1.26.0
([#3973](https://github.com/open-telemetry/opentelemetry-python/pull/3966))
- Update semantic conventions to version 1.26.0.
([#3964](https://github.com/open-telemetry/opentelemetry-python/pull/3964))

## Version 1.25.0/0.46b0 (2024-05-30)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
Runtime specific image identifier. Usually a hash algorithm followed by a UUID.
Note: Docker defines a sha256 of the image id; `container.image.id` corresponds to the `Image` field from the Docker container inspect [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) endpoint.
K8s defines a link to the container registry repository with digest `"imageID": "registry.azurecr.io /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`.
The ID is assinged by the container runtime and can vary in different environments. Consider using `oci.manifest.digest` if it is important to identify the same image in different environments/runtimes.
The ID is assigned by the container runtime and can vary in different environments. Consider using `oci.manifest.digest` if it is important to identify the same image in different environments/runtimes.
"""

CONTAINER_IMAGE_NAME: Final = "container.image.name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,24 @@

DB_CASSANDRA_TABLE: Final = "db.cassandra.table"
"""
The name of the primary Cassandra table that the operation is acting upon, including the keyspace name (if applicable).
Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.
Deprecated: Replaced by `db.collection.name`.
"""

DB_CLIENT_CONNECTIONS_POOL_NAME: Final = "db.client.connections.pool.name"
"""
The name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn't provide a name, instrumentation should use a combination of `server.address` and `server.port` attributes formatted as `server.address:server.port`.
"""

DB_CLIENT_CONNECTIONS_STATE: Final = "db.client.connections.state"
"""
The state of a connection in the pool.
"""

DB_COLLECTION_NAME: Final = "db.collection.name"
"""
The name of a collection (table, container) within the database.
Note: If the collection name is parsed from the query, it SHOULD match the value provided in the query and may be qualified with the schema and database name.
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
"""

DB_CONNECTION_STRING: Final = "db.connection_string"
Expand All @@ -70,7 +86,7 @@

DB_COSMOSDB_CONTAINER: Final = "db.cosmosdb.container"
"""
Cosmos DB container name.
Deprecated: Replaced by `db.collection.name`.
"""

DB_COSMOSDB_OPERATION_TYPE: Final = "db.cosmosdb.operation_type"
Expand Down Expand Up @@ -107,7 +123,7 @@

DB_ELASTICSEARCH_NODE_NAME: Final = "db.elasticsearch.node.name"
"""
Deprecated: Replaced by `db.instance.id`.
Represents the human-readable identifier of the node/instance to which a request was routed.
"""

DB_ELASTICSEARCH_PATH_PARTS_TEMPLATE: Final = "db.elasticsearch.path_parts"
Expand All @@ -118,7 +134,7 @@

DB_INSTANCE_ID: Final = "db.instance.id"
"""
An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`.
Deprecated: Deprecated, no general replacement at this time. For Elasticsearch, use `db.elasticsearch.node.name` instead.
"""

DB_JDBC_DRIVER_CLASSNAME: Final = "db.jdbc.driver_classname"
Expand All @@ -128,51 +144,74 @@

DB_MONGODB_COLLECTION: Final = "db.mongodb.collection"
"""
The MongoDB collection being accessed within the database stated in `db.name`.
Deprecated: Replaced by `db.collection.name`.
"""

DB_MSSQL_INSTANCE_NAME: Final = "db.mssql.instance_name"
"""
The Microsoft SQL Server [instance name](https://docs.microsoft.com/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance.
Note: If setting a `db.mssql.instance_name`, `server.port` is no longer required (but still recommended if non-standard).
Deprecated: Deprecated, no replacement at this time.
"""

DB_NAME: Final = "db.name"
"""
This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails).
Note: In some SQL databases, the database name to be used is called "schema name". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name).
Deprecated: Replaced by `db.namespace`.
"""

DB_NAMESPACE: Final = "db.namespace"
"""
The name of the database, fully qualified within the server address and port.
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.
"""

DB_OPERATION: Final = "db.operation"
"""
The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword.
Note: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.
Deprecated: Replaced by `db.operation.name`.
"""

DB_OPERATION_NAME: Final = "db.operation.name"
"""
The name of the operation or command being executed.
Note: It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
"""

DB_QUERY_PARAMETER_TEMPLATE: Final = "db.query.parameter"
"""
The query parameters used in `db.query.text`, with `<key>` being the parameter name, and the attribute value being 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 `<key>` SHOULD be the 0-based index.
"""

DB_QUERY_TEXT: Final = "db.query.text"
"""
The database query being executed.
"""

DB_REDIS_DATABASE_INDEX: Final = "db.redis.database_index"
"""
The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute.
Deprecated: Replaced by `db.namespace`.
"""

DB_SQL_TABLE: Final = "db.sql.table"
"""
The name of the primary table that the operation is acting upon, including the database name (if applicable).
Note: It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set.
Deprecated: Replaced by `db.collection.name`.
"""

DB_STATEMENT: Final = "db.statement"
"""
The database statement being executed.
Deprecated: Replaced by `db.query.text`.
"""

DB_SYSTEM: Final = "db.system"
"""
An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.
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.
"""

DB_USER: Final = "db.user"
"""
Username for accessing the database.
Deprecated: No replacement at this time.
"""


Expand Down Expand Up @@ -201,6 +240,13 @@ class DbCassandraConsistencyLevelValues(Enum):
"""local_serial."""


class DbClientConnectionsStateValues(Enum):
IDLE: Final = "idle"
"""idle."""
USED: Final = "used"
"""used."""


class DbCosmosdbConnectionModeValues(Enum):
GATEWAY: Final = "gateway"
"""Gateway (HTTP) connections mode."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
EVENT_NAME: Final = "event.name"
"""
Identifies the class / type of event.
Note: Event names are subject to the same rules as [attribute names](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.31.0/specification/common/attribute-naming.md). Notably, event names are namespaced to avoid collisions and provide a clean separation of semantics for events in separate domains like browser, mobile, and kubernetes.
Note: Event names are subject to the same rules as [attribute names](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.33.0/specification/common/attribute-naming.md). Notably, event names are namespaced to avoid collisions and provide a clean separation of semantics for events in separate domains like browser, mobile, and kubernetes.
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# 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

GEN_AI_COMPLETION: Final = "gen_ai.completion"
"""
The full response received from the LLM.
Note: It's RECOMMENDED to format completions as JSON string matching [OpenAI messages format](https://platform.openai.com/docs/guides/text-generation).
"""

GEN_AI_PROMPT: Final = "gen_ai.prompt"
"""
The full prompt sent to an LLM.
Note: It's RECOMMENDED to format prompts as JSON string matching [OpenAI messages format](https://platform.openai.com/docs/guides/text-generation).
"""

GEN_AI_REQUEST_MAX_TOKENS: Final = "gen_ai.request.max_tokens"
"""
The maximum number of tokens the LLM generates for a request.
"""

GEN_AI_REQUEST_MODEL: Final = "gen_ai.request.model"
"""
The name of the LLM a request is being made to.
"""

GEN_AI_REQUEST_TEMPERATURE: Final = "gen_ai.request.temperature"
"""
The temperature setting for the LLM request.
"""

GEN_AI_REQUEST_TOP_P: Final = "gen_ai.request.top_p"
"""
The top_p sampling setting for the LLM request.
"""

GEN_AI_RESPONSE_FINISH_REASONS: Final = "gen_ai.response.finish_reasons"
"""
Array of reasons the model stopped generating tokens, corresponding to each generation received.
"""

GEN_AI_RESPONSE_ID: Final = "gen_ai.response.id"
"""
The unique identifier for the completion.
"""

GEN_AI_RESPONSE_MODEL: Final = "gen_ai.response.model"
"""
The name of the LLM a response was generated from.
"""

GEN_AI_SYSTEM: Final = "gen_ai.system"
"""
The Generative AI product as identified by the client instrumentation.
Note: The actual GenAI product may differ from the one identified by the client. For example, when using OpenAI client libraries to communicate with Mistral, the `gen_ai.system` is set to `openai` based on the instrumentation's best knowledge.
"""

GEN_AI_USAGE_COMPLETION_TOKENS: Final = "gen_ai.usage.completion_tokens"
"""
The number of tokens used in the LLM response (completion).
"""

GEN_AI_USAGE_PROMPT_TOKENS: Final = "gen_ai.usage.prompt_tokens"
"""
The number of tokens used in the LLM prompt.
"""


class GenAiSystemValues(Enum):
OPENAI: Final = "openai"
"""OpenAI."""
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

from deprecated import deprecated

HTTP_CLIENT_IP: Final = "http.client_ip"
"""
Deprecated: Replaced by `client.address`.
"""

HTTP_CONNECTION_STATE: Final = "http.connection.state"
"""
State of the HTTP connection in the HTTP connection pool.
Expand All @@ -27,6 +32,11 @@
Deprecated: Replaced by `network.protocol.name`.
"""

HTTP_HOST: Final = "http.host"
"""
Deprecated: Replaced by one of `server.address`, `client.address` or `http.request.header.host`, depending on the usage.
"""

HTTP_METHOD: Final = "http.method"
"""
Deprecated: Replaced by `http.request.method`.
Expand Down Expand Up @@ -67,6 +77,13 @@
Deprecated: Replaced by `http.request.header.content-length`.
"""

HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED: Final = (
"http.request_content_length_uncompressed"
)
"""
Deprecated: Replaced by `http.request.body.size`.
"""

HTTP_RESPONSE_BODY_SIZE: Final = "http.response.body.size"
"""
The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
Expand All @@ -92,6 +109,13 @@
Deprecated: Replaced by `http.response.header.content-length`.
"""

HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED: Final = (
"http.response_content_length_uncompressed"
)
"""
Deprecated: Replace by `http.response.body.size`.
"""

HTTP_ROUTE: Final = "http.route"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_ROUTE`.
Expand All @@ -102,6 +126,11 @@
Deprecated: Replaced by `url.scheme` instead.
"""

HTTP_SERVER_NAME: Final = "http.server_name"
"""
Deprecated: Replaced by `server.address`.
"""

HTTP_STATUS_CODE: Final = "http.status_code"
"""
Deprecated: Replaced by `http.response.status_code`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
Number of times the container was restarted. This attribute can be used to identify a particular container (running or stopped) within a container spec.
"""

K8S_CONTAINER_STATUS_LAST_TERMINATED_REASON: Final = (
"k8s.container.status.last_terminated_reason"
)
"""
Last terminated reason of the Container.
"""

K8S_CRONJOB_NAME: Final = "k8s.cronjob.name"
"""
The name of the CronJob.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,30 @@
from enum import Enum
from typing import Final

from deprecated import deprecated

MESSAGE_COMPRESSED_SIZE: Final = "message.compressed_size"
"""
Compressed size of the message in bytes.
Deprecated: Replaced by `rpc.message.compressed_size`.
"""

MESSAGE_ID: Final = "message.id"
"""
MUST be calculated as two different counters starting from `1` one for sent messages and one for received message.
Note: This way we guarantee that the values will be consistent between different implementations.
Deprecated: Replaced by `rpc.message.id`.
"""

MESSAGE_TYPE: Final = "message.type"
"""
Whether this is a received or sent message.
Deprecated: Replaced by `rpc.message.type`.
"""

MESSAGE_UNCOMPRESSED_SIZE: Final = "message.uncompressed_size"
"""
Uncompressed size of the message in bytes.
Deprecated: Replaced by `rpc.message.uncompressed_size`.
"""


@deprecated(reason="The attribute message.type is deprecated - Replaced by `rpc.message.type`") # type: ignore
class MessageTypeValues(Enum):
SENT: Final = "SENT"
"""sent."""
Expand Down
Loading