From 8006a496791bef5a342e0510930050e59a6543f0 Mon Sep 17 00:00:00 2001 From: Srikanth Chekuri Date: Sat, 12 Feb 2022 00:09:47 +0530 Subject: [PATCH] Bump semantic conventions from 1.6.1 to 1.8.0 (#2461) --- CHANGELOG.md | 2 + .../semconv/resource/__init__.py | 33 ++++- .../opentelemetry/semconv/trace/__init__.py | 140 +++++++++++++++--- scripts/semconv/generate.sh | 4 +- 4 files changed, 157 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10d29491542..eb28471034d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#2442](https://github.com/open-telemetry/opentelemetry-python/pull/2442)) - bugfix(auto-instrumentation): attach OTLPHandler to root logger ([#2450](https://github.com/open-telemetry/opentelemetry-python/pull/2450)) +- Bump semantic conventions from 1.6.1 to 1.8.0 + ([#2461](https://github.com/open-telemetry/opentelemetry-python/pull/2461)) ## [1.9.1-0.28b1](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.9.1-0.28b1) - 2022-01-29 diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index af10a64c9a1..710c30a77b4 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -28,7 +28,8 @@ class ResourceAttributes: CLOUD_REGION = "cloud.region" """ - The geographical region the resource is running. Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), or [Google Cloud regions](https://cloud.google.com/about/locations). + The geographical region the resource is running. + Note: Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://intl.cloud.tencent.com/document/product/213/6091). """ CLOUD_AVAILABILITY_ZONE = "cloud.availability_zone" @@ -103,7 +104,7 @@ class ResourceAttributes: CONTAINER_NAME = "container.name" """ - Container name. + Container name used by container runtime. """ CONTAINER_ID = "container.id" @@ -267,7 +268,12 @@ class ResourceAttributes: K8S_CONTAINER_NAME = "k8s.container.name" """ - The name of the Container in a Pod template. + The name of the Container from Pod specification, must be unique within a Pod. Container runtime usually uses different globally unique name (`container.name`). + """ + + K8S_CONTAINER_RESTART_COUNT = "k8s.container.restart_count" + """ + 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_REPLICASET_UID = "k8s.replicaset.uid" @@ -472,6 +478,9 @@ class CloudProviderValues(Enum): GCP = "gcp" """Google Cloud Platform.""" + TENCENT_CLOUD = "tencent_cloud" + """Tencent Cloud.""" + class CloudPlatformValues(Enum): ALIBABA_CLOUD_ECS = "alibaba_cloud_ecs" @@ -495,6 +504,9 @@ class CloudPlatformValues(Enum): AWS_ELASTIC_BEANSTALK = "aws_elastic_beanstalk" """AWS Elastic Beanstalk.""" + AWS_APP_RUNNER = "aws_app_runner" + """AWS App Runner.""" + AZURE_VM = "azure_vm" """Azure Virtual Machines.""" @@ -525,6 +537,15 @@ class CloudPlatformValues(Enum): GCP_APP_ENGINE = "gcp_app_engine" """Google Cloud App Engine (GAE).""" + TENCENT_CLOUD_CVM = "tencent_cloud_cvm" + """Tencent Cloud Cloud Virtual Machine (CVM).""" + + TENCENT_CLOUD_EKS = "tencent_cloud_eks" + """Tencent Cloud Elastic Kubernetes Service (EKS).""" + + TENCENT_CLOUD_SCF = "tencent_cloud_scf" + """Tencent Cloud Serverless Cloud Function (SCF).""" + class AwsEcsLaunchtypeValues(Enum): EC2 = "ec2" @@ -553,6 +574,9 @@ class HostArchValues(Enum): PPC64 = "ppc64" """64-bit PowerPC.""" + S390X = "s390x" + """IBM z/Architecture.""" + X86 = "x86" """32-bit x86.""" @@ -622,3 +646,6 @@ class TelemetrySdkLanguageValues(Enum): WEBJS = "webjs" """webjs.""" + + SWIFT = "swift" + """swift.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index 5d32bbef995..a762d88c2c2 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -46,8 +46,8 @@ class SpanAttributes: DB_NAME = "db.name" """ - If no [tech-specific attribute](#call-level-attributes-for-specific-technologies) is defined, 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". + 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). """ DB_STATEMENT = "db.statement" @@ -88,11 +88,6 @@ class SpanAttributes: Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer required (but still recommended if non-standard). """ - DB_CASSANDRA_KEYSPACE = "db.cassandra.keyspace" - """ - The name of the keyspace being accessed. To be used instead of the generic `db.name` attribute. - """ - DB_CASSANDRA_PAGE_SIZE = "db.cassandra.page_size" """ The fetch size used for paging, i.e. how many rows will be returned at once. @@ -105,7 +100,7 @@ class SpanAttributes: DB_CASSANDRA_TABLE = "db.cassandra.table" """ - The name of the primary table that the operation is acting upon, including the schema name (if applicable). + The name of the primary 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. """ @@ -131,11 +126,6 @@ class SpanAttributes: The data center of the coordinating node for a query. """ - DB_HBASE_NAMESPACE = "db.hbase.namespace" - """ - The [HBase namespace](https://hbase.apache.org/book.html#_namespace) being accessed. To be used instead of the generic `db.name` attribute. - """ - DB_REDIS_DATABASE_INDEX = "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. @@ -148,7 +138,7 @@ class SpanAttributes: DB_SQL_TABLE = "db.sql.table" """ - The name of the primary table that the operation is acting upon, including the schema name (if applicable). + 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. """ @@ -190,7 +180,16 @@ class SpanAttributes: FAAS_TRIGGER = "faas.trigger" """ - Type of the trigger on which the function is executed. + Type of the trigger which caused this function execution. + Note: For the server/consumer span on the incoming side, +`faas.trigger` MUST be set. + +Clients invoking FaaS instances usually cannot set `faas.trigger`, +since they would typically need to look in the payload to determine +the event type. If clients set it, it should be the same as the +trigger that corresponding incoming would have (i.e., this has +nothing to do with the underlying transport used to make the API +call to invoke the lambda, which is often HTTP). """ FAAS_EXECUTION = "faas.execution" @@ -236,7 +235,8 @@ class SpanAttributes: HTTP_HOST = "http.host" """ - The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same. + The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header should also be reported, see note. + Note: When the header is present but empty the attribute SHOULD be set to the empty string. Note that this is a valid situation that is expected in certain cases, according the aforementioned [section of RFC 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not set the attribute MUST NOT be set. """ HTTP_SCHEME = "http.scheme" @@ -298,7 +298,17 @@ class SpanAttributes: HTTP_CLIENT_IP = "http.client_ip" """ The IP address of the original client behind all proxies, if known (e.g. from [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). - Note: This is not necessarily the same as `net.peer.ip`, which would identify the network-level peer, which may be a proxy. + Note: This is not necessarily the same as `net.peer.ip`, which would +identify the network-level peer, which may be a proxy. + +This attribute should be set when a source of information different +from the one used for `net.peer.ip`, is available even if that other +source just confirms the same value as `net.peer.ip`. +Rationale: For `net.peer.ip`, one typically does not know if it +comes from a proxy, reverse proxy, or the actual client. Setting +`http.client_ip` when it's the same as `net.peer.ip` means that +one is at least somewhat confident that the address is not that of +the closest proxy. """ NET_HOST_IP = "net.host.ip" @@ -632,6 +642,11 @@ class SpanAttributes: A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case. """ + MESSAGING_CONSUMER_ID = "messaging.consumer_id" + """ + The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer_group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. + """ + MESSAGING_RABBITMQ_ROUTING_KEY = "messaging.rabbitmq.routing_key" """ RabbitMQ message routing key. @@ -663,6 +678,43 @@ class SpanAttributes: A boolean that is true if the message is a tombstone. """ + MESSAGING_ROCKETMQ_NAMESPACE = "messaging.rocketmq.namespace" + """ + Namespace of RocketMQ resources, resources in different namespaces are individual. + """ + + MESSAGING_ROCKETMQ_CLIENT_GROUP = "messaging.rocketmq.client_group" + """ + Name of the RocketMQ producer/consumer group that is handling the message. The client type is identified by the SpanKind. + """ + + MESSAGING_ROCKETMQ_CLIENT_ID = "messaging.rocketmq.client_id" + """ + The unique identifier for each client. + """ + + MESSAGING_ROCKETMQ_MESSAGE_TYPE = "messaging.rocketmq.message_type" + """ + Type of message. + """ + + MESSAGING_ROCKETMQ_MESSAGE_TAG = "messaging.rocketmq.message_tag" + """ + The secondary classifier of message besides topic. + """ + + MESSAGING_ROCKETMQ_MESSAGE_KEYS = "messaging.rocketmq.message_keys" + """ + Key(s) of message, another way to mark message besides message id. + """ + + MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = ( + "messaging.rocketmq.consumption_model" + ) + """ + Model of message consumption. This only applies to consumer spans. + """ + RPC_GRPC_STATUS_CODE = "rpc.grpc.status_code" """ The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. @@ -688,6 +740,27 @@ class SpanAttributes: `error.message` property of response if it is an error response. """ + MESSAGE_TYPE = "message.type" + """ + Whether this is a received or sent message. + """ + + MESSAGE_ID = "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. + """ + + MESSAGE_COMPRESSED_SIZE = "message.compressed_size" + """ + Compressed size of the message in bytes. + """ + + MESSAGE_UNCOMPRESSED_SIZE = "message.uncompressed_size" + """ + Uncompressed size of the message in bytes. + """ + class DbSystemValues(Enum): OTHER_SQL = "other_sql" @@ -1038,6 +1111,9 @@ class FaasInvokedProviderValues(Enum): GCP = "gcp" """Google Cloud Platform.""" + TENCENT_CLOUD = "tencent_cloud" + """Tencent Cloud.""" + class MessagingOperationValues(Enum): RECEIVE = "receive" @@ -1047,6 +1123,28 @@ class MessagingOperationValues(Enum): """process.""" +class MessagingRocketmqMessageTypeValues(Enum): + NORMAL = "normal" + """Normal message.""" + + FIFO = "fifo" + """FIFO message.""" + + DELAY = "delay" + """Delay message.""" + + TRANSACTION = "transaction" + """Transaction message.""" + + +class MessagingRocketmqConsumptionModelValues(Enum): + CLUSTERING = "clustering" + """Clustering consumption model.""" + + BROADCASTING = "broadcasting" + """Broadcasting consumption model.""" + + class RpcGrpcStatusCodeValues(Enum): OK = 0 """OK.""" @@ -1098,3 +1196,11 @@ class RpcGrpcStatusCodeValues(Enum): UNAUTHENTICATED = 16 """UNAUTHENTICATED.""" + + +class MessageTypeValues(Enum): + SENT = "SENT" + """sent.""" + + RECEIVED = "RECEIVED" + """received.""" diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index d793bf5809b..48c46a78c6b 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -4,8 +4,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec version to make SemanticAttributes generation reproducible -SPEC_VERSION=v1.6.1 -OTEL_SEMCONV_GEN_IMG_VERSION=0.5.0 +SPEC_VERSION=v1.8.0 +OTEL_SEMCONV_GEN_IMG_VERSION=0.9.0 cd ${SCRIPT_DIR}