From 72dedb3710c5ee42295b2f7e8df589022f5fc499 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Thu, 13 Jun 2024 10:03:26 -0700 Subject: [PATCH] replace jinja error with Final annotation --- CHANGELOG.md | 1 + .../_incubating/attributes/aws_attributes.py | 141 ++++------ .../attributes/browser_attributes.py | 12 +- .../attributes/client_attributes.py | 6 +- .../attributes/cloud_attributes.py | 89 +++--- .../attributes/cloudevents_attributes.py | 15 +- .../_incubating/attributes/code_attributes.py | 18 +- .../attributes/container_attributes.py | 46 ++-- .../_incubating/attributes/db_attributes.py | 253 ++++++++---------- .../attributes/deployment_attributes.py | 3 +- .../attributes/destination_attributes.py | 6 +- .../attributes/device_attributes.py | 12 +- .../_incubating/attributes/disk_attributes.py | 8 +- .../_incubating/attributes/dns_attributes.py | 3 +- .../attributes/enduser_attributes.py | 9 +- .../attributes/error_attributes.py | 6 +- .../attributes/event_attributes.py | 3 +- .../attributes/exception_attributes.py | 12 +- .../_incubating/attributes/faas_attributes.py | 75 +++--- .../attributes/feature_flag_attributes.py | 9 +- .../_incubating/attributes/file_attributes.py | 15 +- .../_incubating/attributes/gcp_attributes.py | 12 +- .../attributes/graphql_attributes.py | 16 +- .../attributes/heroku_attributes.py | 9 +- .../_incubating/attributes/host_attributes.py | 62 ++--- .../_incubating/attributes/http_attributes.py | 100 +++---- .../_incubating/attributes/k8s_attributes.py | 72 ++--- .../_incubating/attributes/log_attributes.py | 23 +- .../attributes/message_attributes.py | 17 +- .../attributes/messaging_attributes.py | 175 +++++------- .../_incubating/attributes/net_attributes.py | 56 ++-- .../attributes/network_attributes.py | 114 ++++---- .../_incubating/attributes/oci_attributes.py | 3 +- .../attributes/opentracing_attributes.py | 8 +- .../_incubating/attributes/os_attributes.py | 38 ++- .../_incubating/attributes/otel_attributes.py | 23 +- .../attributes/other_attributes.py | 8 +- .../_incubating/attributes/peer_attributes.py | 3 +- .../_incubating/attributes/pool_attributes.py | 3 +- .../attributes/process_attributes.py | 57 ++-- .../_incubating/attributes/rpc_attributes.py | 118 ++++---- .../attributes/server_attributes.py | 6 +- .../attributes/service_attributes.py | 12 +- .../attributes/session_attributes.py | 6 +- .../attributes/source_attributes.py | 6 +- .../attributes/system_attributes.py | 137 +++++----- .../attributes/telemetry_attributes.py | 40 ++- .../attributes/thread_attributes.py | 6 +- .../_incubating/attributes/tls_attributes.py | 92 +++---- .../_incubating/attributes/url_attributes.py | 36 +-- .../attributes/user_agent_attributes.py | 9 +- .../attributes/webengine_attributes.py | 9 +- .../_incubating/metrics/container_metrics.py | 10 +- .../semconv/_incubating/metrics/db_metrics.py | 20 +- .../_incubating/metrics/dns_metrics.py | 4 +- .../_incubating/metrics/faas_metrics.py | 20 +- .../_incubating/metrics/http_metrics.py | 22 +- .../_incubating/metrics/messaging_metrics.py | 14 +- .../_incubating/metrics/process_metrics.py | 24 +- .../_incubating/metrics/rpc_metrics.py | 22 +- .../_incubating/metrics/system_metrics.py | 56 ++-- .../semconv/attributes/client_attributes.py | 6 +- .../semconv/attributes/error_attributes.py | 6 +- .../attributes/exception_attributes.py | 12 +- .../semconv/attributes/http_attributes.py | 42 ++- .../semconv/attributes/network_attributes.py | 37 ++- .../semconv/attributes/otel_attributes.py | 17 +- .../semconv/attributes/server_attributes.py | 6 +- .../semconv/attributes/service_attributes.py | 6 +- .../attributes/telemetry_attributes.py | 34 ++- .../semconv/attributes/url_attributes.py | 15 +- .../attributes/user_agent_attributes.py | 3 +- .../semconv/metrics/http_metrics.py | 6 +- scripts/semconv/templates/common.j2 | 9 - .../semconv/templates/semantic_attributes.j2 | 8 +- scripts/semconv/templates/semantic_metrics.j2 | 6 +- 76 files changed, 1047 insertions(+), 1376 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d418587a63a..9037395e887 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#3616](https://github.com/open-telemetry/opentelemetry-python/pull/3616)) - Update Semantic Conventions code generation scripts: - fix namespace exclusion that resulted in dropping `os` and `net` namespaces. + - add `Final` decorator to constants - allow to drop specific attributes in preparation for Semantic Conventions v1.26.0 ([#3964](https://github.com/open-telemetry/opentelemetry-python/pull/3964)) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/aws_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/aws_attributes.py index f5edbbcb806..c449b717510 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/aws_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/aws_attributes.py @@ -12,207 +12,180 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS = "aws.dynamodb.attribute_definitions" +AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS: Final = ( + "aws.dynamodb.attribute_definitions" +) """ The JSON-serialized value of each item in the `AttributeDefinitions` request field. """ - -AWS_DYNAMODB_ATTRIBUTES_TO_GET = "aws.dynamodb.attributes_to_get" +AWS_DYNAMODB_ATTRIBUTES_TO_GET: Final = "aws.dynamodb.attributes_to_get" """ The value of the `AttributesToGet` request parameter. """ - -AWS_DYNAMODB_CONSISTENT_READ = "aws.dynamodb.consistent_read" +AWS_DYNAMODB_CONSISTENT_READ: Final = "aws.dynamodb.consistent_read" """ The value of the `ConsistentRead` request parameter. """ - -AWS_DYNAMODB_CONSUMED_CAPACITY = "aws.dynamodb.consumed_capacity" +AWS_DYNAMODB_CONSUMED_CAPACITY: Final = "aws.dynamodb.consumed_capacity" """ The JSON-serialized value of each item in the `ConsumedCapacity` response field. """ - -AWS_DYNAMODB_COUNT = "aws.dynamodb.count" +AWS_DYNAMODB_COUNT: Final = "aws.dynamodb.count" """ The value of the `Count` response parameter. """ - -AWS_DYNAMODB_EXCLUSIVE_START_TABLE = "aws.dynamodb.exclusive_start_table" +AWS_DYNAMODB_EXCLUSIVE_START_TABLE: Final = ( + "aws.dynamodb.exclusive_start_table" +) """ The value of the `ExclusiveStartTableName` request parameter. """ - -AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = ( +AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES: Final = ( "aws.dynamodb.global_secondary_index_updates" ) """ The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` request field. """ - -AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = "aws.dynamodb.global_secondary_indexes" +AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES: Final = ( + "aws.dynamodb.global_secondary_indexes" +) """ The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. """ - -AWS_DYNAMODB_INDEX_NAME = "aws.dynamodb.index_name" +AWS_DYNAMODB_INDEX_NAME: Final = "aws.dynamodb.index_name" """ The value of the `IndexName` request parameter. """ - -AWS_DYNAMODB_ITEM_COLLECTION_METRICS = "aws.dynamodb.item_collection_metrics" +AWS_DYNAMODB_ITEM_COLLECTION_METRICS: Final = ( + "aws.dynamodb.item_collection_metrics" +) """ The JSON-serialized value of the `ItemCollectionMetrics` response field. """ - -AWS_DYNAMODB_LIMIT = "aws.dynamodb.limit" +AWS_DYNAMODB_LIMIT: Final = "aws.dynamodb.limit" """ The value of the `Limit` request parameter. """ - -AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = "aws.dynamodb.local_secondary_indexes" +AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES: Final = ( + "aws.dynamodb.local_secondary_indexes" +) """ The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. """ - -AWS_DYNAMODB_PROJECTION = "aws.dynamodb.projection" +AWS_DYNAMODB_PROJECTION: Final = "aws.dynamodb.projection" """ The value of the `ProjectionExpression` request parameter. """ - -AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = ( +AWS_DYNAMODB_PROVISIONED_READ_CAPACITY: Final = ( "aws.dynamodb.provisioned_read_capacity" ) """ The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. """ - -AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = ( +AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY: Final = ( "aws.dynamodb.provisioned_write_capacity" ) """ The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. """ - -AWS_DYNAMODB_SCAN_FORWARD = "aws.dynamodb.scan_forward" +AWS_DYNAMODB_SCAN_FORWARD: Final = "aws.dynamodb.scan_forward" """ The value of the `ScanIndexForward` request parameter. """ - -AWS_DYNAMODB_SCANNED_COUNT = "aws.dynamodb.scanned_count" +AWS_DYNAMODB_SCANNED_COUNT: Final = "aws.dynamodb.scanned_count" """ The value of the `ScannedCount` response parameter. """ - -AWS_DYNAMODB_SEGMENT = "aws.dynamodb.segment" +AWS_DYNAMODB_SEGMENT: Final = "aws.dynamodb.segment" """ The value of the `Segment` request parameter. """ - -AWS_DYNAMODB_SELECT = "aws.dynamodb.select" +AWS_DYNAMODB_SELECT: Final = "aws.dynamodb.select" """ The value of the `Select` request parameter. """ - -AWS_DYNAMODB_TABLE_COUNT = "aws.dynamodb.table_count" +AWS_DYNAMODB_TABLE_COUNT: Final = "aws.dynamodb.table_count" """ The number of items in the `TableNames` response parameter. """ - -AWS_DYNAMODB_TABLE_NAMES = "aws.dynamodb.table_names" +AWS_DYNAMODB_TABLE_NAMES: Final = "aws.dynamodb.table_names" """ The keys in the `RequestItems` object field. """ - -AWS_DYNAMODB_TOTAL_SEGMENTS = "aws.dynamodb.total_segments" +AWS_DYNAMODB_TOTAL_SEGMENTS: Final = "aws.dynamodb.total_segments" """ The value of the `TotalSegments` request parameter. """ - -AWS_ECS_CLUSTER_ARN = "aws.ecs.cluster.arn" +AWS_ECS_CLUSTER_ARN: Final = "aws.ecs.cluster.arn" """ The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). """ - -AWS_ECS_CONTAINER_ARN = "aws.ecs.container.arn" +AWS_ECS_CONTAINER_ARN: Final = "aws.ecs.container.arn" """ The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). """ - -AWS_ECS_LAUNCHTYPE = "aws.ecs.launchtype" +AWS_ECS_LAUNCHTYPE: Final = "aws.ecs.launchtype" """ The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. """ - -AWS_ECS_TASK_ARN = "aws.ecs.task.arn" +AWS_ECS_TASK_ARN: Final = "aws.ecs.task.arn" """ The ARN of a running [ECS task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids). """ - -AWS_ECS_TASK_FAMILY = "aws.ecs.task.family" +AWS_ECS_TASK_FAMILY: Final = "aws.ecs.task.family" """ The family name of the [ECS task definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html) used to create the ECS task. """ - -AWS_ECS_TASK_ID = "aws.ecs.task.id" +AWS_ECS_TASK_ID: Final = "aws.ecs.task.id" """ The ID of a running ECS task. The ID MUST be extracted from `task.arn`. """ - -AWS_ECS_TASK_REVISION = "aws.ecs.task.revision" +AWS_ECS_TASK_REVISION: Final = "aws.ecs.task.revision" """ The revision for the task definition used to create the ECS task. """ - -AWS_EKS_CLUSTER_ARN = "aws.eks.cluster.arn" +AWS_EKS_CLUSTER_ARN: Final = "aws.eks.cluster.arn" """ The ARN of an EKS cluster. """ - -AWS_LAMBDA_INVOKED_ARN = "aws.lambda.invoked_arn" +AWS_LAMBDA_INVOKED_ARN: Final = "aws.lambda.invoked_arn" """ The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable). Note: This may be different from `cloud.resource_id` if an alias is involved. """ - -AWS_LOG_GROUP_ARNS = "aws.log.group.arns" +AWS_LOG_GROUP_ARNS: Final = "aws.log.group.arns" """ The Amazon Resource Name(s) (ARN) of the AWS log group(s). Note: See the [log group ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). """ - -AWS_LOG_GROUP_NAMES = "aws.log.group.names" +AWS_LOG_GROUP_NAMES: Final = "aws.log.group.names" """ The name(s) of the AWS log group(s) an application is writing to. Note: Multiple log groups must be supported for cases like multi-container applications, where a single application has sidecar containers, and each write to their own log group. """ - -AWS_LOG_STREAM_ARNS = "aws.log.stream.arns" +AWS_LOG_STREAM_ARNS: Final = "aws.log.stream.arns" """ The ARN(s) of the AWS log stream(s). Note: See the [log stream ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain several log streams, so these ARNs necessarily identify both a log group and a log stream. """ - -AWS_LOG_STREAM_NAMES = "aws.log.stream.names" +AWS_LOG_STREAM_NAMES: Final = "aws.log.stream.names" """ The name(s) of the AWS log stream(s) an application is writing to. """ - -AWS_REQUEST_ID = "aws.request_id" +AWS_REQUEST_ID: Final = "aws.request_id" """ The AWS request ID as returned in the response headers `x-amz-request-id` or `x-amz-requestid`. """ - -AWS_S3_BUCKET = "aws.s3.bucket" +AWS_S3_BUCKET: Final = "aws.s3.bucket" """ The S3 bucket name the request refers to. Corresponds to the `--bucket` parameter of the [S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) operations. Note: The `bucket` attribute is applicable to all S3 operations that reference a bucket, i.e. that require the bucket name as a mandatory parameter. This applies to almost all S3 operations except `list-buckets`. """ - -AWS_S3_COPY_SOURCE = "aws.s3.copy_source" +AWS_S3_COPY_SOURCE: Final = "aws.s3.copy_source" """ The source object (in the form `bucket`/`key`) for the copy operation. Note: The `copy_source` attribute applies to S3 copy operations and corresponds to the `--copy-source` parameter @@ -222,16 +195,14 @@ - [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) - [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html). """ - -AWS_S3_DELETE = "aws.s3.delete" +AWS_S3_DELETE: Final = "aws.s3.delete" """ The delete request container that specifies the objects to be deleted. Note: The `delete` attribute is only applicable to the [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) operation. The `delete` attribute corresponds to the `--delete` parameter of the [delete-objects operation within the S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). """ - -AWS_S3_KEY = "aws.s3.key" +AWS_S3_KEY: Final = "aws.s3.key" """ The S3 object key the request refers to. Corresponds to the `--key` parameter of the [S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) operations. Note: The `key` attribute is applicable to all object-related S3 operations, i.e. that require the object key as a mandatory parameter. @@ -251,8 +222,7 @@ - [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) - [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html). """ - -AWS_S3_PART_NUMBER = "aws.s3.part_number" +AWS_S3_PART_NUMBER: Final = "aws.s3.part_number" """ The part number of the part being uploaded in a multipart-upload operation. This is a positive integer between 1 and 10,000. Note: The `part_number` attribute is only applicable to the [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) @@ -260,8 +230,7 @@ The `part_number` attribute corresponds to the `--part-number` parameter of the [upload-part operation within the S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). """ - -AWS_S3_UPLOAD_ID = "aws.s3.upload_id" +AWS_S3_UPLOAD_ID: Final = "aws.s3.upload_id" """ Upload ID that identifies the multipart upload. Note: The `upload_id` attribute applies to S3 multipart-upload operations and corresponds to the `--upload-id` parameter @@ -277,7 +246,7 @@ class AwsEcsLaunchtypeValues(Enum): - EC2 = "ec2" + EC2: Final = "ec2" """ec2.""" - FARGATE = "fargate" + FARGATE: Final = "fargate" """fargate.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/browser_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/browser_attributes.py index e792af80735..dbf7d634ba8 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/browser_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/browser_attributes.py @@ -12,26 +12,24 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -BROWSER_BRANDS = "browser.brands" +BROWSER_BRANDS: Final = "browser.brands" """ Array of brand name and version separated by a space. Note: This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.brands`). """ - -BROWSER_LANGUAGE = "browser.language" +BROWSER_LANGUAGE: Final = "browser.language" """ Preferred language of the user using the browser. Note: This value is intended to be taken from the Navigator API `navigator.language`. """ - -BROWSER_MOBILE = "browser.mobile" +BROWSER_MOBILE: Final = "browser.mobile" """ A boolean that is true if the browser is running on a mobile device. Note: This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be left unset. """ - -BROWSER_PLATFORM = "browser.platform" +BROWSER_PLATFORM: Final = "browser.platform" """ The platform on which the browser is running. Note: This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.platform`). If unavailable, the legacy `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD be left unset in order for the values to be consistent. diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/client_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/client_attributes.py index a8514b5639c..feb1a231b36 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/client_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/client_attributes.py @@ -12,13 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -CLIENT_ADDRESS = "client.address" +CLIENT_ADDRESS: Final = "client.address" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.client_attributes.CLIENT_ADDRESS`. """ - -CLIENT_PORT = "client.port" +CLIENT_PORT: Final = "client.port" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.client_attributes.CLIENT_PORT`. """ 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 43e181e3085..dddd7ceabb6 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 @@ -12,38 +12,33 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -CLOUD_ACCOUNT_ID = "cloud.account.id" +CLOUD_ACCOUNT_ID: Final = "cloud.account.id" """ The cloud account ID the resource is assigned to. """ - -CLOUD_AVAILABILITY_ZONE = "cloud.availability_zone" +CLOUD_AVAILABILITY_ZONE: Final = "cloud.availability_zone" """ Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running. Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. """ - -CLOUD_PLATFORM = "cloud.platform" +CLOUD_PLATFORM: Final = "cloud.platform" """ The cloud platform in use. Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. """ - -CLOUD_PROVIDER = "cloud.provider" +CLOUD_PROVIDER: Final = "cloud.provider" """ Name of the cloud provider. """ - -CLOUD_REGION = "cloud.region" +CLOUD_REGION: Final = "cloud.region" """ 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/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091). """ - -CLOUD_RESOURCE_ID = "cloud.resource_id" +CLOUD_RESOURCE_ID: Final = "cloud.resource_id" """ Cloud provider-specific native identifier of the monitored cloud resource (e.g. an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) on AWS, a [fully qualified resource ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on Azure, a [full resource name](https://cloud.google.com/apis/design/resource_names#full_resource_name) on GCP). Note: On some cloud providers, it may not be possible to determine the full ID at startup, @@ -67,76 +62,76 @@ class CloudPlatformValues(Enum): - ALIBABA_CLOUD_ECS = "alibaba_cloud_ecs" + ALIBABA_CLOUD_ECS: Final = "alibaba_cloud_ecs" """Alibaba Cloud Elastic Compute Service.""" - ALIBABA_CLOUD_FC = "alibaba_cloud_fc" + ALIBABA_CLOUD_FC: Final = "alibaba_cloud_fc" """Alibaba Cloud Function Compute.""" - ALIBABA_CLOUD_OPENSHIFT = "alibaba_cloud_openshift" + ALIBABA_CLOUD_OPENSHIFT: Final = "alibaba_cloud_openshift" """Red Hat OpenShift on Alibaba Cloud.""" - AWS_EC2 = "aws_ec2" + AWS_EC2: Final = "aws_ec2" """AWS Elastic Compute Cloud.""" - AWS_ECS = "aws_ecs" + AWS_ECS: Final = "aws_ecs" """AWS Elastic Container Service.""" - AWS_EKS = "aws_eks" + AWS_EKS: Final = "aws_eks" """AWS Elastic Kubernetes Service.""" - AWS_LAMBDA = "aws_lambda" + AWS_LAMBDA: Final = "aws_lambda" """AWS Lambda.""" - AWS_ELASTIC_BEANSTALK = "aws_elastic_beanstalk" + AWS_ELASTIC_BEANSTALK: Final = "aws_elastic_beanstalk" """AWS Elastic Beanstalk.""" - AWS_APP_RUNNER = "aws_app_runner" + AWS_APP_RUNNER: Final = "aws_app_runner" """AWS App Runner.""" - AWS_OPENSHIFT = "aws_openshift" + AWS_OPENSHIFT: Final = "aws_openshift" """Red Hat OpenShift on AWS (ROSA).""" - AZURE_VM = "azure_vm" + AZURE_VM: Final = "azure_vm" """Azure Virtual Machines.""" - AZURE_CONTAINER_APPS = "azure_container_apps" + AZURE_CONTAINER_APPS: Final = "azure_container_apps" """Azure Container Apps.""" - AZURE_CONTAINER_INSTANCES = "azure_container_instances" + AZURE_CONTAINER_INSTANCES: Final = "azure_container_instances" """Azure Container Instances.""" - AZURE_AKS = "azure_aks" + AZURE_AKS: Final = "azure_aks" """Azure Kubernetes Service.""" - AZURE_FUNCTIONS = "azure_functions" + AZURE_FUNCTIONS: Final = "azure_functions" """Azure Functions.""" - AZURE_APP_SERVICE = "azure_app_service" + AZURE_APP_SERVICE: Final = "azure_app_service" """Azure App Service.""" - AZURE_OPENSHIFT = "azure_openshift" + AZURE_OPENSHIFT: Final = "azure_openshift" """Azure Red Hat OpenShift.""" - GCP_BARE_METAL_SOLUTION = "gcp_bare_metal_solution" + GCP_BARE_METAL_SOLUTION: Final = "gcp_bare_metal_solution" """Google Bare Metal Solution (BMS).""" - GCP_COMPUTE_ENGINE = "gcp_compute_engine" + GCP_COMPUTE_ENGINE: Final = "gcp_compute_engine" """Google Cloud Compute Engine (GCE).""" - GCP_CLOUD_RUN = "gcp_cloud_run" + GCP_CLOUD_RUN: Final = "gcp_cloud_run" """Google Cloud Run.""" - GCP_KUBERNETES_ENGINE = "gcp_kubernetes_engine" + GCP_KUBERNETES_ENGINE: Final = "gcp_kubernetes_engine" """Google Cloud Kubernetes Engine (GKE).""" - GCP_CLOUD_FUNCTIONS = "gcp_cloud_functions" + GCP_CLOUD_FUNCTIONS: Final = "gcp_cloud_functions" """Google Cloud Functions (GCF).""" - GCP_APP_ENGINE = "gcp_app_engine" + GCP_APP_ENGINE: Final = "gcp_app_engine" """Google Cloud App Engine (GAE).""" - GCP_OPENSHIFT = "gcp_openshift" + GCP_OPENSHIFT: Final = "gcp_openshift" """Red Hat OpenShift on Google Cloud.""" - IBM_CLOUD_OPENSHIFT = "ibm_cloud_openshift" + IBM_CLOUD_OPENSHIFT: Final = "ibm_cloud_openshift" """Red Hat OpenShift on IBM Cloud.""" - TENCENT_CLOUD_CVM = "tencent_cloud_cvm" + TENCENT_CLOUD_CVM: Final = "tencent_cloud_cvm" """Tencent Cloud Cloud Virtual Machine (CVM).""" - TENCENT_CLOUD_EKS = "tencent_cloud_eks" + TENCENT_CLOUD_EKS: Final = "tencent_cloud_eks" """Tencent Cloud Elastic Kubernetes Service (EKS).""" - TENCENT_CLOUD_SCF = "tencent_cloud_scf" + TENCENT_CLOUD_SCF: Final = "tencent_cloud_scf" """Tencent Cloud Serverless Cloud Function (SCF).""" class CloudProviderValues(Enum): - ALIBABA_CLOUD = "alibaba_cloud" + ALIBABA_CLOUD: Final = "alibaba_cloud" """Alibaba Cloud.""" - AWS = "aws" + AWS: Final = "aws" """Amazon Web Services.""" - AZURE = "azure" + AZURE: Final = "azure" """Microsoft Azure.""" - GCP = "gcp" + GCP: Final = "gcp" """Google Cloud Platform.""" - HEROKU = "heroku" + HEROKU: Final = "heroku" """Heroku Platform as a Service.""" - IBM_CLOUD = "ibm_cloud" + IBM_CLOUD: Final = "ibm_cloud" """IBM Cloud.""" - TENCENT_CLOUD = "tencent_cloud" + TENCENT_CLOUD: Final = "tencent_cloud" """Tencent Cloud.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloudevents_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloudevents_attributes.py index 30fe19c74ef..b54a080d95f 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloudevents_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloudevents_attributes.py @@ -12,28 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -CLOUDEVENTS_EVENT_ID = "cloudevents.event_id" +CLOUDEVENTS_EVENT_ID: Final = "cloudevents.event_id" """ The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) uniquely identifies the event. """ - -CLOUDEVENTS_EVENT_SOURCE = "cloudevents.event_source" +CLOUDEVENTS_EVENT_SOURCE: Final = "cloudevents.event_source" """ The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) identifies the context in which an event happened. """ - -CLOUDEVENTS_EVENT_SPEC_VERSION = "cloudevents.event_spec_version" +CLOUDEVENTS_EVENT_SPEC_VERSION: Final = "cloudevents.event_spec_version" """ The [version of the CloudEvents specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. """ - -CLOUDEVENTS_EVENT_SUBJECT = "cloudevents.event_subject" +CLOUDEVENTS_EVENT_SUBJECT: Final = "cloudevents.event_subject" """ The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) of the event in the context of the event producer (identified by source). """ - -CLOUDEVENTS_EVENT_TYPE = "cloudevents.event_type" +CLOUDEVENTS_EVENT_TYPE: Final = "cloudevents.event_type" """ The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) contains a value describing the type of event related to the originating occurrence. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/code_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/code_attributes.py index 6a9d55ec0ab..47e898ddc79 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/code_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/code_attributes.py @@ -12,33 +12,29 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -CODE_COLUMN = "code.column" +CODE_COLUMN: Final = "code.column" """ The column number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. """ - -CODE_FILEPATH = "code.filepath" +CODE_FILEPATH: Final = "code.filepath" """ The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). """ - -CODE_FUNCTION = "code.function" +CODE_FUNCTION: Final = "code.function" """ The method or function name, or equivalent (usually rightmost part of the code unit's name). """ - -CODE_LINENO = "code.lineno" +CODE_LINENO: Final = "code.lineno" """ The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. """ - -CODE_NAMESPACE = "code.namespace" +CODE_NAMESPACE: Final = "code.namespace" """ The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit. """ - -CODE_STACKTRACE = "code.stacktrace" +CODE_STACKTRACE: Final = "code.stacktrace" """ A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. """ 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 03391d1114d..eb6745e5e63 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 @@ -12,84 +12,72 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -CONTAINER_COMMAND = "container.command" +CONTAINER_COMMAND: Final = "container.command" """ The command used to run the container (i.e. the command name). Note: If using embedded credentials or sensitive data, it is recommended to remove them to prevent potential leakage. """ - -CONTAINER_COMMAND_ARGS = "container.command_args" +CONTAINER_COMMAND_ARGS: Final = "container.command_args" """ All the command arguments (including the command/executable itself) run by the container. [2]. """ - -CONTAINER_COMMAND_LINE = "container.command_line" +CONTAINER_COMMAND_LINE: Final = "container.command_line" """ The full command run by the container as a single string representing the full command. [2]. """ - -CONTAINER_CPU_STATE = "container.cpu.state" +CONTAINER_CPU_STATE: Final = "container.cpu.state" """ The CPU state for this data point. """ - -CONTAINER_ID = "container.id" +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_IMAGE_ID = "container.image.id" +CONTAINER_IMAGE_ID: Final = "container.image.id" """ 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. """ - -CONTAINER_IMAGE_NAME = "container.image.name" +CONTAINER_IMAGE_NAME: Final = "container.image.name" """ Name of the image the container was built on. """ - -CONTAINER_IMAGE_REPO_DIGESTS = "container.image.repo_digests" +CONTAINER_IMAGE_REPO_DIGESTS: Final = "container.image.repo_digests" """ Repo digests of the container image as provided by the container runtime. Note: [Docker](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect) and [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) report those under the `RepoDigests` field. """ - -CONTAINER_IMAGE_TAGS = "container.image.tags" +CONTAINER_IMAGE_TAGS: Final = "container.image.tags" """ Container image tags. An example can be found in [Docker Image Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). Should be only the `` section of the full name for example from `registry.example.com/my-org/my-image:`. """ - -CONTAINER_LABEL_TEMPLATE = "container.label" +CONTAINER_LABEL_TEMPLATE: Final = "container.label" """ Container labels, `` being the label name, the value being the label value. """ - -CONTAINER_LABELS_TEMPLATE = "container.labels" +CONTAINER_LABELS_TEMPLATE: Final = "container.labels" """ Deprecated: Replaced by `container.label`. """ - -CONTAINER_NAME = "container.name" +CONTAINER_NAME: Final = "container.name" """ Container name used by container runtime. """ - -CONTAINER_RUNTIME = "container.runtime" +CONTAINER_RUNTIME: Final = "container.runtime" """ The container runtime managing this container. """ class ContainerCpuStateValues(Enum): - USER = "user" + USER: Final = "user" """When tasks of the cgroup are in user mode (Linux). When all container processes are in user mode (Windows).""" - SYSTEM = "system" + SYSTEM: Final = "system" """When CPU is used by the system (host OS).""" - KERNEL = "kernel" + KERNEL: Final = "kernel" """When tasks of the cgroup are in kernel mode (Linux). When all container processes are in kernel mode (Windows).""" 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 e1cf5e017d2..65cc3480ec6 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 @@ -12,335 +12,308 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -DB_CASSANDRA_CONSISTENCY_LEVEL = "db.cassandra.consistency_level" +DB_CASSANDRA_CONSISTENCY_LEVEL: Final = "db.cassandra.consistency_level" """ The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). """ - -DB_CASSANDRA_COORDINATOR_DC = "db.cassandra.coordinator.dc" +DB_CASSANDRA_COORDINATOR_DC: Final = "db.cassandra.coordinator.dc" """ The data center of the coordinating node for a query. """ - -DB_CASSANDRA_COORDINATOR_ID = "db.cassandra.coordinator.id" +DB_CASSANDRA_COORDINATOR_ID: Final = "db.cassandra.coordinator.id" """ The ID of the coordinating node for a query. """ - -DB_CASSANDRA_IDEMPOTENCE = "db.cassandra.idempotence" +DB_CASSANDRA_IDEMPOTENCE: Final = "db.cassandra.idempotence" """ Whether or not the query is idempotent. """ - -DB_CASSANDRA_PAGE_SIZE = "db.cassandra.page_size" +DB_CASSANDRA_PAGE_SIZE: Final = "db.cassandra.page_size" """ The fetch size used for paging, i.e. how many rows will be returned at once. """ - -DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( +DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT: Final = ( "db.cassandra.speculative_execution_count" ) """ The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. """ - -DB_CASSANDRA_TABLE = "db.cassandra.table" +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. """ - -DB_CONNECTION_STRING = "db.connection_string" +DB_CONNECTION_STRING: Final = "db.connection_string" """ Deprecated: "Replaced by `server.address` and `server.port`.". """ - -DB_COSMOSDB_CLIENT_ID = "db.cosmosdb.client_id" +DB_COSMOSDB_CLIENT_ID: Final = "db.cosmosdb.client_id" """ Unique Cosmos client instance id. """ - -DB_COSMOSDB_CONNECTION_MODE = "db.cosmosdb.connection_mode" +DB_COSMOSDB_CONNECTION_MODE: Final = "db.cosmosdb.connection_mode" """ Cosmos client connection mode. """ - -DB_COSMOSDB_CONTAINER = "db.cosmosdb.container" +DB_COSMOSDB_CONTAINER: Final = "db.cosmosdb.container" """ Cosmos DB container name. """ - -DB_COSMOSDB_OPERATION_TYPE = "db.cosmosdb.operation_type" +DB_COSMOSDB_OPERATION_TYPE: Final = "db.cosmosdb.operation_type" """ CosmosDB Operation Type. """ - -DB_COSMOSDB_REQUEST_CHARGE = "db.cosmosdb.request_charge" +DB_COSMOSDB_REQUEST_CHARGE: Final = "db.cosmosdb.request_charge" """ RU consumed for that operation. """ - -DB_COSMOSDB_REQUEST_CONTENT_LENGTH = "db.cosmosdb.request_content_length" +DB_COSMOSDB_REQUEST_CONTENT_LENGTH: Final = ( + "db.cosmosdb.request_content_length" +) """ Request payload size in bytes. """ - -DB_COSMOSDB_STATUS_CODE = "db.cosmosdb.status_code" +DB_COSMOSDB_STATUS_CODE: Final = "db.cosmosdb.status_code" """ Cosmos DB status code. """ - -DB_COSMOSDB_SUB_STATUS_CODE = "db.cosmosdb.sub_status_code" +DB_COSMOSDB_SUB_STATUS_CODE: Final = "db.cosmosdb.sub_status_code" """ Cosmos DB sub status code. """ - -DB_ELASTICSEARCH_CLUSTER_NAME = "db.elasticsearch.cluster.name" +DB_ELASTICSEARCH_CLUSTER_NAME: Final = "db.elasticsearch.cluster.name" """ Represents the identifier of an Elasticsearch cluster. """ - -DB_ELASTICSEARCH_NODE_NAME = "db.elasticsearch.node.name" +DB_ELASTICSEARCH_NODE_NAME: Final = "db.elasticsearch.node.name" """ Deprecated: Replaced by `db.instance.id`. """ - -DB_ELASTICSEARCH_PATH_PARTS_TEMPLATE = "db.elasticsearch.path_parts" +DB_ELASTICSEARCH_PATH_PARTS_TEMPLATE: Final = "db.elasticsearch.path_parts" """ A dynamic value in the url path. Note: Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format `db.elasticsearch.path_parts.`, where `` is the url path part name. The implementation SHOULD reference the [elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json) in order to map the path part values to their names. """ - -DB_INSTANCE_ID = "db.instance.id" +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`. """ - -DB_JDBC_DRIVER_CLASSNAME = "db.jdbc.driver_classname" +DB_JDBC_DRIVER_CLASSNAME: Final = "db.jdbc.driver_classname" """ Deprecated: Removed as not used. """ - -DB_MONGODB_COLLECTION = "db.mongodb.collection" +DB_MONGODB_COLLECTION: Final = "db.mongodb.collection" """ The MongoDB collection being accessed within the database stated in `db.name`. """ - -DB_MSSQL_INSTANCE_NAME = "db.mssql.instance_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). """ - -DB_NAME = "db.name" +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). """ - -DB_OPERATION = "db.operation" +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. """ - -DB_REDIS_DATABASE_INDEX = "db.redis.database_index" +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. """ - -DB_SQL_TABLE = "db.sql.table" +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. """ - -DB_STATEMENT = "db.statement" +DB_STATEMENT: Final = "db.statement" """ The database statement being executed. """ - -DB_SYSTEM = "db.system" +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. """ - -DB_USER = "db.user" +DB_USER: Final = "db.user" """ Username for accessing the database. """ class DbCassandraConsistencyLevelValues(Enum): - ALL = "all" + ALL: Final = "all" """all.""" - EACH_QUORUM = "each_quorum" + EACH_QUORUM: Final = "each_quorum" """each_quorum.""" - QUORUM = "quorum" + QUORUM: Final = "quorum" """quorum.""" - LOCAL_QUORUM = "local_quorum" + LOCAL_QUORUM: Final = "local_quorum" """local_quorum.""" - ONE = "one" + ONE: Final = "one" """one.""" - TWO = "two" + TWO: Final = "two" """two.""" - THREE = "three" + THREE: Final = "three" """three.""" - LOCAL_ONE = "local_one" + LOCAL_ONE: Final = "local_one" """local_one.""" - ANY = "any" + ANY: Final = "any" """any.""" - SERIAL = "serial" + SERIAL: Final = "serial" """serial.""" - LOCAL_SERIAL = "local_serial" + LOCAL_SERIAL: Final = "local_serial" """local_serial.""" class DbCosmosdbConnectionModeValues(Enum): - GATEWAY = "gateway" + GATEWAY: Final = "gateway" """Gateway (HTTP) connections mode.""" - DIRECT = "direct" + DIRECT: Final = "direct" """Direct connection.""" class DbCosmosdbOperationTypeValues(Enum): - INVALID = "Invalid" + INVALID: Final = "Invalid" """invalid.""" - CREATE = "Create" + CREATE: Final = "Create" """create.""" - PATCH = "Patch" + PATCH: Final = "Patch" """patch.""" - READ = "Read" + READ: Final = "Read" """read.""" - READ_FEED = "ReadFeed" + READ_FEED: Final = "ReadFeed" """read_feed.""" - DELETE = "Delete" + DELETE: Final = "Delete" """delete.""" - REPLACE = "Replace" + REPLACE: Final = "Replace" """replace.""" - EXECUTE = "Execute" + EXECUTE: Final = "Execute" """execute.""" - QUERY = "Query" + QUERY: Final = "Query" """query.""" - HEAD = "Head" + HEAD: Final = "Head" """head.""" - HEAD_FEED = "HeadFeed" + HEAD_FEED: Final = "HeadFeed" """head_feed.""" - UPSERT = "Upsert" + UPSERT: Final = "Upsert" """upsert.""" - BATCH = "Batch" + BATCH: Final = "Batch" """batch.""" - QUERY_PLAN = "QueryPlan" + QUERY_PLAN: Final = "QueryPlan" """query_plan.""" - EXECUTE_JAVASCRIPT = "ExecuteJavaScript" + EXECUTE_JAVASCRIPT: Final = "ExecuteJavaScript" """execute_javascript.""" class DbSystemValues(Enum): - OTHER_SQL = "other_sql" + OTHER_SQL: Final = "other_sql" """Some other SQL database. Fallback only. See notes.""" - MSSQL = "mssql" + MSSQL: Final = "mssql" """Microsoft SQL Server.""" - MSSQLCOMPACT = "mssqlcompact" + MSSQLCOMPACT: Final = "mssqlcompact" """Microsoft SQL Server Compact.""" - MYSQL = "mysql" + MYSQL: Final = "mysql" """MySQL.""" - ORACLE = "oracle" + ORACLE: Final = "oracle" """Oracle Database.""" - DB2 = "db2" + DB2: Final = "db2" """IBM Db2.""" - POSTGRESQL = "postgresql" + POSTGRESQL: Final = "postgresql" """PostgreSQL.""" - REDSHIFT = "redshift" + REDSHIFT: Final = "redshift" """Amazon Redshift.""" - HIVE = "hive" + HIVE: Final = "hive" """Apache Hive.""" - CLOUDSCAPE = "cloudscape" + CLOUDSCAPE: Final = "cloudscape" """Cloudscape.""" - HSQLDB = "hsqldb" + HSQLDB: Final = "hsqldb" """HyperSQL DataBase.""" - PROGRESS = "progress" + PROGRESS: Final = "progress" """Progress Database.""" - MAXDB = "maxdb" + MAXDB: Final = "maxdb" """SAP MaxDB.""" - HANADB = "hanadb" + HANADB: Final = "hanadb" """SAP HANA.""" - INGRES = "ingres" + INGRES: Final = "ingres" """Ingres.""" - FIRSTSQL = "firstsql" + FIRSTSQL: Final = "firstsql" """FirstSQL.""" - EDB = "edb" + EDB: Final = "edb" """EnterpriseDB.""" - CACHE = "cache" + CACHE: Final = "cache" """InterSystems Caché.""" - ADABAS = "adabas" + ADABAS: Final = "adabas" """Adabas (Adaptable Database System).""" - FIREBIRD = "firebird" + FIREBIRD: Final = "firebird" """Firebird.""" - DERBY = "derby" + DERBY: Final = "derby" """Apache Derby.""" - FILEMAKER = "filemaker" + FILEMAKER: Final = "filemaker" """FileMaker.""" - INFORMIX = "informix" + INFORMIX: Final = "informix" """Informix.""" - INSTANTDB = "instantdb" + INSTANTDB: Final = "instantdb" """InstantDB.""" - INTERBASE = "interbase" + INTERBASE: Final = "interbase" """InterBase.""" - MARIADB = "mariadb" + MARIADB: Final = "mariadb" """MariaDB.""" - NETEZZA = "netezza" + NETEZZA: Final = "netezza" """Netezza.""" - PERVASIVE = "pervasive" + PERVASIVE: Final = "pervasive" """Pervasive PSQL.""" - POINTBASE = "pointbase" + POINTBASE: Final = "pointbase" """PointBase.""" - SQLITE = "sqlite" + SQLITE: Final = "sqlite" """SQLite.""" - SYBASE = "sybase" + SYBASE: Final = "sybase" """Sybase.""" - TERADATA = "teradata" + TERADATA: Final = "teradata" """Teradata.""" - VERTICA = "vertica" + VERTICA: Final = "vertica" """Vertica.""" - H2 = "h2" + H2: Final = "h2" """H2.""" - COLDFUSION = "coldfusion" + COLDFUSION: Final = "coldfusion" """ColdFusion IMQ.""" - CASSANDRA = "cassandra" + CASSANDRA: Final = "cassandra" """Apache Cassandra.""" - HBASE = "hbase" + HBASE: Final = "hbase" """Apache HBase.""" - MONGODB = "mongodb" + MONGODB: Final = "mongodb" """MongoDB.""" - REDIS = "redis" + REDIS: Final = "redis" """Redis.""" - COUCHBASE = "couchbase" + COUCHBASE: Final = "couchbase" """Couchbase.""" - COUCHDB = "couchdb" + COUCHDB: Final = "couchdb" """CouchDB.""" - COSMOSDB = "cosmosdb" + COSMOSDB: Final = "cosmosdb" """Microsoft Azure Cosmos DB.""" - DYNAMODB = "dynamodb" + DYNAMODB: Final = "dynamodb" """Amazon DynamoDB.""" - NEO4J = "neo4j" + NEO4J: Final = "neo4j" """Neo4j.""" - GEODE = "geode" + GEODE: Final = "geode" """Apache Geode.""" - ELASTICSEARCH = "elasticsearch" + ELASTICSEARCH: Final = "elasticsearch" """Elasticsearch.""" - MEMCACHED = "memcached" + MEMCACHED: Final = "memcached" """Memcached.""" - COCKROACHDB = "cockroachdb" + COCKROACHDB: Final = "cockroachdb" """CockroachDB.""" - OPENSEARCH = "opensearch" + OPENSEARCH: Final = "opensearch" """OpenSearch.""" - CLICKHOUSE = "clickhouse" + CLICKHOUSE: Final = "clickhouse" """ClickHouse.""" - SPANNER = "spanner" + SPANNER: Final = "spanner" """Cloud Spanner.""" - TRINO = "trino" + TRINO: Final = "trino" """Trino.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/deployment_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/deployment_attributes.py index c735bf2a103..da93768810e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/deployment_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/deployment_attributes.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -DEPLOYMENT_ENVIRONMENT = "deployment.environment" +DEPLOYMENT_ENVIRONMENT: Final = "deployment.environment" """ Name of the [deployment environment](https://wikipedia.org/wiki/Deployment_environment) (aka deployment tier). Note: `deployment.environment` does not affect the uniqueness constraints defined through diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/destination_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/destination_attributes.py index c96ae68f43f..d3e7ae3be5c 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/destination_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/destination_attributes.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -DESTINATION_ADDRESS = "destination.address" +DESTINATION_ADDRESS: Final = "destination.address" """ Destination address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. Note: When observed from the source side, and when communicating through an intermediary, `destination.address` SHOULD represent the destination address behind any intermediaries, for example proxies, if it's available. """ - -DESTINATION_PORT = "destination.port" +DESTINATION_PORT: Final = "destination.port" """ Destination port number. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/device_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/device_attributes.py index f9fc6503eb1..e95b6b0379d 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/device_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/device_attributes.py @@ -12,26 +12,24 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -DEVICE_ID = "device.id" +DEVICE_ID: Final = "device.id" """ A unique identifier representing the device. Note: The device identifier MUST only be defined using the values outlined below. This value is not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation ID or a globally unique UUID which is persisted across sessions in your application. More information can be found [here](https://developer.android.com/training/articles/user-data-ids) on best practices and exact implementation details. Caution should be taken when storing personal data or anything which can identify a user. GDPR and data protection laws may apply, ensure you do your own due diligence. """ - -DEVICE_MANUFACTURER = "device.manufacturer" +DEVICE_MANUFACTURER: Final = "device.manufacturer" """ The name of the device manufacturer. Note: The Android OS provides this field via [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). iOS apps SHOULD hardcode the value `Apple`. """ - -DEVICE_MODEL_IDENTIFIER = "device.model.identifier" +DEVICE_MODEL_IDENTIFIER: Final = "device.model.identifier" """ The model identifier for the device. Note: It's recommended this value represents a machine-readable version of the model identifier rather than the market or consumer-friendly name of the device. """ - -DEVICE_MODEL_NAME = "device.model.name" +DEVICE_MODEL_NAME: Final = "device.model.name" """ The marketing name for the device model. Note: It's recommended this value represents a human-readable version of the device model rather than a machine-readable alternative. diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/disk_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/disk_attributes.py index 0553eb26257..81779056017 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/disk_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/disk_attributes.py @@ -12,17 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -DISK_IO_DIRECTION = "disk.io.direction" +DISK_IO_DIRECTION: Final = "disk.io.direction" """ The disk IO operation direction. """ class DiskIoDirectionValues(Enum): - READ = "read" + READ: Final = "read" """read.""" - WRITE = "write" + WRITE: Final = "write" """write.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/dns_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/dns_attributes.py index 899e2587d0e..cfb00bcf307 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/dns_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/dns_attributes.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -DNS_QUESTION_NAME = "dns.question.name" +DNS_QUESTION_NAME: Final = "dns.question.name" """ The name being queried. Note: If the name field contains non-printable characters (below 32 or above 126), those characters should be represented as escaped base 10 integers (\\DDD). Back slashes and quotes should be escaped. Tabs, carriage returns, and line feeds should be converted to \\t, \\r, and \\n respectively. diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/enduser_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/enduser_attributes.py index 05d83db3731..12ca1e89a0a 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/enduser_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/enduser_attributes.py @@ -12,18 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -ENDUSER_ID = "enduser.id" +ENDUSER_ID: Final = "enduser.id" """ Username or client_id extracted from the access token or [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the inbound request from outside the system. """ - -ENDUSER_ROLE = "enduser.role" +ENDUSER_ROLE: Final = "enduser.role" """ Actual/assumed role the client is making the request under extracted from token or application security context. """ - -ENDUSER_SCOPE = "enduser.scope" +ENDUSER_SCOPE: Final = "enduser.scope" """ Scopes or granted authorities the client currently possesses extracted from token or application security context. The value would come from the scope associated with an [OAuth 2.0 Access Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value in a [SAML 2.0 Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/error_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/error_attributes.py index 603d6ed72ea..ef4b1bda2f2 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/error_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/error_attributes.py @@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final from deprecated import deprecated -ERROR_TYPE = "error.type" +ERROR_TYPE: Final = "error.type" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.error_attributes.ERROR_TYPE`. """ @@ -27,5 +27,5 @@ reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.error_attributes.ErrorTypeValues`." ) class ErrorTypeValues(Enum): - OTHER = "_OTHER" + OTHER: Final = "_OTHER" """A fallback error value to be used when the instrumentation doesn't define a custom value.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/event_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/event_attributes.py index c417cc70d39..b2d0c22c082 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/event_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/event_attributes.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -EVENT_NAME = "event.name" +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. diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/exception_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/exception_attributes.py index dd78656b4a9..e7c6e58882b 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/exception_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/exception_attributes.py @@ -12,23 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -EXCEPTION_ESCAPED = "exception.escaped" +EXCEPTION_ESCAPED: Final = "exception.escaped" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.exception_attributes.EXCEPTION_ESCAPED`. """ - -EXCEPTION_MESSAGE = "exception.message" +EXCEPTION_MESSAGE: Final = "exception.message" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.exception_attributes.EXCEPTION_MESSAGE`. """ - -EXCEPTION_STACKTRACE = "exception.stacktrace" +EXCEPTION_STACKTRACE: Final = "exception.stacktrace" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.exception_attributes.EXCEPTION_STACKTRACE`. """ - -EXCEPTION_TYPE = "exception.type" +EXCEPTION_TYPE: Final = "exception.type" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.exception_attributes.EXCEPTION_TYPE`. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/faas_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/faas_attributes.py index f93a016414c..89b193684ed 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/faas_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/faas_attributes.py @@ -12,75 +12,63 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -FAAS_COLDSTART = "faas.coldstart" +FAAS_COLDSTART: Final = "faas.coldstart" """ A boolean that is true if the serverless function is executed for the first time (aka cold-start). """ - -FAAS_CRON = "faas.cron" +FAAS_CRON: Final = "faas.cron" """ A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). """ - -FAAS_DOCUMENT_COLLECTION = "faas.document.collection" +FAAS_DOCUMENT_COLLECTION: Final = "faas.document.collection" """ The name of the source on which the triggering operation was performed. For example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name. """ - -FAAS_DOCUMENT_NAME = "faas.document.name" +FAAS_DOCUMENT_NAME: Final = "faas.document.name" """ The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the name of the file, and in Cosmos DB the table name. """ - -FAAS_DOCUMENT_OPERATION = "faas.document.operation" +FAAS_DOCUMENT_OPERATION: Final = "faas.document.operation" """ Describes the type of the operation that was performed on the data. """ - -FAAS_DOCUMENT_TIME = "faas.document.time" +FAAS_DOCUMENT_TIME: Final = "faas.document.time" """ A string containing the time when the data was accessed in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). """ - -FAAS_INSTANCE = "faas.instance" +FAAS_INSTANCE: Final = "faas.instance" """ The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version. Note: * **AWS Lambda:** Use the (full) log stream name. """ - -FAAS_INVOCATION_ID = "faas.invocation_id" +FAAS_INVOCATION_ID: Final = "faas.invocation_id" """ The invocation ID of the current function invocation. """ - -FAAS_INVOKED_NAME = "faas.invoked_name" +FAAS_INVOKED_NAME: Final = "faas.invoked_name" """ The name of the invoked function. Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function. """ - -FAAS_INVOKED_PROVIDER = "faas.invoked_provider" +FAAS_INVOKED_PROVIDER: Final = "faas.invoked_provider" """ The cloud provider of the invoked function. Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. """ - -FAAS_INVOKED_REGION = "faas.invoked_region" +FAAS_INVOKED_REGION: Final = "faas.invoked_region" """ The cloud region of the invoked function. Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function. """ - -FAAS_MAX_MEMORY = "faas.max_memory" +FAAS_MAX_MEMORY: Final = "faas.max_memory" """ The amount of memory available to the serverless function converted to Bytes. Note: It's recommended to set this attribute since e.g. too little memory can easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must be multiplied by 1,048,576). """ - -FAAS_NAME = "faas.name" +FAAS_NAME: Final = "faas.name" """ The name of the single function that this runtime instance executes. Note: This is the name of the function as configured/deployed on the FaaS @@ -100,18 +88,15 @@ app can host multiple functions that would usually share a TracerProvider (see also the `cloud.resource_id` attribute). """ - -FAAS_TIME = "faas.time" +FAAS_TIME: Final = "faas.time" """ A string containing the function invocation time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). """ - -FAAS_TRIGGER = "faas.trigger" +FAAS_TRIGGER: Final = "faas.trigger" """ Type of the trigger which caused this function invocation. """ - -FAAS_VERSION = "faas.version" +FAAS_VERSION: Final = "faas.version" """ The immutable version of the function being executed. Note: Depending on the cloud provider and platform, use: @@ -127,35 +112,35 @@ class FaasDocumentOperationValues(Enum): - INSERT = "insert" + INSERT: Final = "insert" """When a new object is created.""" - EDIT = "edit" + EDIT: Final = "edit" """When an object is modified.""" - DELETE = "delete" + DELETE: Final = "delete" """When an object is deleted.""" class FaasInvokedProviderValues(Enum): - ALIBABA_CLOUD = "alibaba_cloud" + ALIBABA_CLOUD: Final = "alibaba_cloud" """Alibaba Cloud.""" - AWS = "aws" + AWS: Final = "aws" """Amazon Web Services.""" - AZURE = "azure" + AZURE: Final = "azure" """Microsoft Azure.""" - GCP = "gcp" + GCP: Final = "gcp" """Google Cloud Platform.""" - TENCENT_CLOUD = "tencent_cloud" + TENCENT_CLOUD: Final = "tencent_cloud" """Tencent Cloud.""" class FaasTriggerValues(Enum): - DATASOURCE = "datasource" + DATASOURCE: Final = "datasource" """A response to some data source operation such as a database or filesystem read/write.""" - HTTP = "http" + HTTP: Final = "http" """To provide an answer to an inbound HTTP request.""" - PUBSUB = "pubsub" + PUBSUB: Final = "pubsub" """A function is set to be executed when messages are sent to a messaging system.""" - TIMER = "timer" + TIMER: Final = "timer" """A function is scheduled to be executed regularly.""" - OTHER = "other" + OTHER: Final = "other" """If none of the others apply.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/feature_flag_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/feature_flag_attributes.py index 8302f9666a0..3e68699d4a7 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/feature_flag_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/feature_flag_attributes.py @@ -12,18 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -FEATURE_FLAG_KEY = "feature_flag.key" +FEATURE_FLAG_KEY: Final = "feature_flag.key" """ The unique identifier of the feature flag. """ - -FEATURE_FLAG_PROVIDER_NAME = "feature_flag.provider_name" +FEATURE_FLAG_PROVIDER_NAME: Final = "feature_flag.provider_name" """ The name of the service provider that performs the flag evaluation. """ - -FEATURE_FLAG_VARIANT = "feature_flag.variant" +FEATURE_FLAG_VARIANT: Final = "feature_flag.variant" """ SHOULD be a semantic identifier for a value. If one is unavailable, a stringified version of the value can be used. Note: A semantic identifier, commonly referred to as a variant, provides a means 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 1b760c4d1d9..6fcbdd30fcc 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 @@ -12,29 +12,26 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -FILE_DIRECTORY = "file.directory" +FILE_DIRECTORY: Final = "file.directory" """ Directory where the file is located. It should include the drive letter, when appropriate. """ - -FILE_EXTENSION = "file.extension" +FILE_EXTENSION: Final = "file.extension" """ File extension, excluding the leading dot. Note: When the file name has multiple extensions (example.tar.gz), only the last one should be captured ("gz", not "tar.gz"). """ - -FILE_NAME = "file.name" +FILE_NAME: Final = "file.name" """ Name of the file including the extension, without the directory. """ - -FILE_PATH = "file.path" +FILE_PATH: Final = "file.path" """ Full path to the file, including the file name. It should include the drive letter, when appropriate. """ - -FILE_SIZE = "file.size" +FILE_SIZE: Final = "file.size" """ File size in bytes. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gcp_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gcp_attributes.py index 0b5f6a0c963..f00948ef7c9 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gcp_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gcp_attributes.py @@ -12,23 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -GCP_CLOUD_RUN_JOB_EXECUTION = "gcp.cloud_run.job.execution" +GCP_CLOUD_RUN_JOB_EXECUTION: Final = "gcp.cloud_run.job.execution" """ The name of the Cloud Run [execution](https://cloud.google.com/run/docs/managing/job-executions) being run for the Job, as set by the [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) environment variable. """ - -GCP_CLOUD_RUN_JOB_TASK_INDEX = "gcp.cloud_run.job.task_index" +GCP_CLOUD_RUN_JOB_TASK_INDEX: Final = "gcp.cloud_run.job.task_index" """ The index for a task within an execution as provided by the [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) environment variable. """ - -GCP_GCE_INSTANCE_HOSTNAME = "gcp.gce.instance.hostname" +GCP_GCE_INSTANCE_HOSTNAME: Final = "gcp.gce.instance.hostname" """ The hostname of a GCE instance. This is the full value of the default or [custom hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). """ - -GCP_GCE_INSTANCE_NAME = "gcp.gce.instance.name" +GCP_GCE_INSTANCE_NAME: Final = "gcp.gce.instance.name" """ The instance name of a GCE instance. This is the value provided by `host.name`, the visible name of the instance in the Cloud Console UI, and the prefix for the default hostname of the instance as defined by the [default internal DNS name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/graphql_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/graphql_attributes.py index f005d167d63..b74ac99f5df 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/graphql_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/graphql_attributes.py @@ -12,30 +12,28 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -GRAPHQL_DOCUMENT = "graphql.document" +GRAPHQL_DOCUMENT: Final = "graphql.document" """ The GraphQL document being executed. Note: The value may be sanitized to exclude sensitive information. """ - -GRAPHQL_OPERATION_NAME = "graphql.operation.name" +GRAPHQL_OPERATION_NAME: Final = "graphql.operation.name" """ The name of the operation being executed. """ - -GRAPHQL_OPERATION_TYPE = "graphql.operation.type" +GRAPHQL_OPERATION_TYPE: Final = "graphql.operation.type" """ The type of the operation being executed. """ class GraphqlOperationTypeValues(Enum): - QUERY = "query" + QUERY: Final = "query" """GraphQL query.""" - MUTATION = "mutation" + MUTATION: Final = "mutation" """GraphQL mutation.""" - SUBSCRIPTION = "subscription" + SUBSCRIPTION: Final = "subscription" """GraphQL subscription.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/heroku_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/heroku_attributes.py index 27ec50229ef..5eeb7d218a7 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/heroku_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/heroku_attributes.py @@ -12,18 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -HEROKU_APP_ID = "heroku.app.id" +HEROKU_APP_ID: Final = "heroku.app.id" """ Unique identifier for the application. """ - -HEROKU_RELEASE_COMMIT = "heroku.release.commit" +HEROKU_RELEASE_COMMIT: Final = "heroku.release.commit" """ Commit hash for the current release. """ - -HEROKU_RELEASE_CREATION_TIMESTAMP = "heroku.release.creation_timestamp" +HEROKU_RELEASE_CREATION_TIMESTAMP: Final = "heroku.release.creation_timestamp" """ Time and date the release was created. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/host_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/host_attributes.py index 994c57a4060..5f7a2c28280 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/host_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/host_attributes.py @@ -12,102 +12,88 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -HOST_ARCH = "host.arch" +HOST_ARCH: Final = "host.arch" """ The CPU architecture the host system is running on. """ - -HOST_CPU_CACHE_L2_SIZE = "host.cpu.cache.l2.size" +HOST_CPU_CACHE_L2_SIZE: Final = "host.cpu.cache.l2.size" """ The amount of level 2 memory cache available to the processor (in Bytes). """ - -HOST_CPU_FAMILY = "host.cpu.family" +HOST_CPU_FAMILY: Final = "host.cpu.family" """ Family or generation of the CPU. """ - -HOST_CPU_MODEL_ID = "host.cpu.model.id" +HOST_CPU_MODEL_ID: Final = "host.cpu.model.id" """ Model identifier. It provides more granular information about the CPU, distinguishing it from other CPUs within the same family. """ - -HOST_CPU_MODEL_NAME = "host.cpu.model.name" +HOST_CPU_MODEL_NAME: Final = "host.cpu.model.name" """ Model designation of the processor. """ - -HOST_CPU_STEPPING = "host.cpu.stepping" +HOST_CPU_STEPPING: Final = "host.cpu.stepping" """ Stepping or core revisions. """ - -HOST_CPU_VENDOR_ID = "host.cpu.vendor.id" +HOST_CPU_VENDOR_ID: Final = "host.cpu.vendor.id" """ Processor manufacturer identifier. A maximum 12-character string. Note: [CPUID](https://wiki.osdev.org/CPUID) command returns the vendor ID string in EBX, EDX and ECX registers. Writing these to memory in this order results in a 12-character string. """ - -HOST_ID = "host.id" +HOST_ID: Final = "host.id" """ Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the `machine-id`. See the table below for the sources to use to determine the `machine-id` based on operating system. """ - -HOST_IMAGE_ID = "host.image.id" +HOST_IMAGE_ID: Final = "host.image.id" """ VM image ID or host OS image ID. For Cloud, this value is from the provider. """ - -HOST_IMAGE_NAME = "host.image.name" +HOST_IMAGE_NAME: Final = "host.image.name" """ Name of the VM image or OS install the host was instantiated from. """ - -HOST_IMAGE_VERSION = "host.image.version" +HOST_IMAGE_VERSION: Final = "host.image.version" """ The version string of the VM image or host OS as defined in [Version Attributes](/docs/resource/README.md#version-attributes). """ - -HOST_IP = "host.ip" +HOST_IP: Final = "host.ip" """ Available IP addresses of the host, excluding loopback interfaces. Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 addresses MUST be specified in the [RFC 5952](https://www.rfc-editor.org/rfc/rfc5952.html) format. """ - -HOST_MAC = "host.mac" +HOST_MAC: Final = "host.mac" """ Available MAC addresses of the host, excluding loopback interfaces. Note: MAC Addresses MUST be represented in [IEEE RA hexadecimal form](https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf): as hyphen-separated octets in uppercase hexadecimal form from most to least significant. """ - -HOST_NAME = "host.name" +HOST_NAME: Final = "host.name" """ Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user. """ - -HOST_TYPE = "host.type" +HOST_TYPE: Final = "host.type" """ Type of host. For Cloud, this must be the machine type. """ class HostArchValues(Enum): - AMD64 = "amd64" + AMD64: Final = "amd64" """AMD64.""" - ARM32 = "arm32" + ARM32: Final = "arm32" """ARM32.""" - ARM64 = "arm64" + ARM64: Final = "arm64" """ARM64.""" - IA64 = "ia64" + IA64: Final = "ia64" """Itanium.""" - PPC32 = "ppc32" + PPC32: Final = "ppc32" """32-bit PowerPC.""" - PPC64 = "ppc64" + PPC64: Final = "ppc64" """64-bit PowerPC.""" - S390X = "s390x" + S390X: Final = "s390x" """IBM z/Architecture.""" - X86 = "x86" + X86: Final = "x86" """32-bit x86.""" 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 70e0e8d2f3f..f3f5db7a7a8 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 @@ -12,121 +12,101 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final from deprecated import deprecated -HTTP_CONNECTION_STATE = "http.connection.state" +HTTP_CONNECTION_STATE: Final = "http.connection.state" """ State of the HTTP connection in the HTTP connection pool. """ - -HTTP_FLAVOR = "http.flavor" +HTTP_FLAVOR: Final = "http.flavor" """ Deprecated: Replaced by `network.protocol.name`. """ - -HTTP_METHOD = "http.method" +HTTP_METHOD: Final = "http.method" """ Deprecated: Replaced by `http.request.method`. """ - -HTTP_REQUEST_BODY_SIZE = "http.request.body.size" +HTTP_REQUEST_BODY_SIZE: Final = "http.request.body.size" """ The size of the request 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. """ - -HTTP_REQUEST_HEADER_TEMPLATE = "http.request.header" +HTTP_REQUEST_HEADER_TEMPLATE: Final = "http.request.header" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_REQUEST_HEADER_TEMPLATE`. """ - -HTTP_REQUEST_METHOD = "http.request.method" +HTTP_REQUEST_METHOD: Final = "http.request.method" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_REQUEST_METHOD`. """ - -HTTP_REQUEST_METHOD_ORIGINAL = "http.request.method_original" +HTTP_REQUEST_METHOD_ORIGINAL: Final = "http.request.method_original" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_REQUEST_METHOD_ORIGINAL`. """ - -HTTP_REQUEST_RESEND_COUNT = "http.request.resend_count" +HTTP_REQUEST_RESEND_COUNT: Final = "http.request.resend_count" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_REQUEST_RESEND_COUNT`. """ - -HTTP_REQUEST_SIZE = "http.request.size" +HTTP_REQUEST_SIZE: Final = "http.request.size" """ The total size of the request in bytes. This should be the total number of bytes sent over the wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request body if any. """ - -HTTP_REQUEST_CONTENT_LENGTH = "http.request_content_length" +HTTP_REQUEST_CONTENT_LENGTH: Final = "http.request_content_length" """ Deprecated: Replaced by `http.request.header.content-length`. """ - -HTTP_RESPONSE_BODY_SIZE = "http.response.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. """ - -HTTP_RESPONSE_HEADER_TEMPLATE = "http.response.header" +HTTP_RESPONSE_HEADER_TEMPLATE: Final = "http.response.header" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_RESPONSE_HEADER_TEMPLATE`. """ - -HTTP_RESPONSE_SIZE = "http.response.size" +HTTP_RESPONSE_SIZE: Final = "http.response.size" """ The total size of the response in bytes. This should be the total number of bytes sent over the wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and response body and trailers if any. """ - -HTTP_RESPONSE_STATUS_CODE = "http.response.status_code" +HTTP_RESPONSE_STATUS_CODE: Final = "http.response.status_code" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_RESPONSE_STATUS_CODE`. """ - -HTTP_RESPONSE_CONTENT_LENGTH = "http.response_content_length" +HTTP_RESPONSE_CONTENT_LENGTH: Final = "http.response_content_length" """ Deprecated: Replaced by `http.response.header.content-length`. """ - -HTTP_ROUTE = "http.route" +HTTP_ROUTE: Final = "http.route" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_ROUTE`. """ - -HTTP_SCHEME = "http.scheme" +HTTP_SCHEME: Final = "http.scheme" """ Deprecated: Replaced by `url.scheme` instead. """ - -HTTP_STATUS_CODE = "http.status_code" +HTTP_STATUS_CODE: Final = "http.status_code" """ Deprecated: Replaced by `http.response.status_code`. """ - -HTTP_TARGET = "http.target" +HTTP_TARGET: Final = "http.target" """ Deprecated: Split to `url.path` and `url.query. """ - -HTTP_URL = "http.url" +HTTP_URL: Final = "http.url" """ Deprecated: Replaced by `url.full`. """ - -HTTP_USER_AGENT = "http.user_agent" +HTTP_USER_AGENT: Final = "http.user_agent" """ Deprecated: Replaced by `user_agent.original`. """ class HttpConnectionStateValues(Enum): - ACTIVE = "active" + ACTIVE: Final = "active" """active state.""" - IDLE = "idle" + IDLE: Final = "idle" """idle state.""" @@ -134,17 +114,17 @@ class HttpConnectionStateValues(Enum): reason="The attribute http.flavor is deprecated - Replaced by `network.protocol.name`" ) class HttpFlavorValues(Enum): - HTTP_1_0 = "1.0" + HTTP_1_0: Final = "1.0" """HTTP/1.0.""" - HTTP_1_1 = "1.1" + HTTP_1_1: Final = "1.1" """HTTP/1.1.""" - HTTP_2_0 = "2.0" + HTTP_2_0: Final = "2.0" """HTTP/2.""" - HTTP_3_0 = "3.0" + HTTP_3_0: Final = "3.0" """HTTP/3.""" - SPDY = "SPDY" + SPDY: Final = "SPDY" """SPDY protocol.""" - QUIC = "QUIC" + QUIC: Final = "QUIC" """QUIC protocol.""" @@ -152,23 +132,23 @@ class HttpFlavorValues(Enum): reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues`." ) class HttpRequestMethodValues(Enum): - CONNECT = "CONNECT" + CONNECT: Final = "CONNECT" """CONNECT method.""" - DELETE = "DELETE" + DELETE: Final = "DELETE" """DELETE method.""" - GET = "GET" + GET: Final = "GET" """GET method.""" - HEAD = "HEAD" + HEAD: Final = "HEAD" """HEAD method.""" - OPTIONS = "OPTIONS" + OPTIONS: Final = "OPTIONS" """OPTIONS method.""" - PATCH = "PATCH" + PATCH: Final = "PATCH" """PATCH method.""" - POST = "POST" + POST: Final = "POST" """POST method.""" - PUT = "PUT" + PUT: Final = "PUT" """PUT method.""" - TRACE = "TRACE" + TRACE: Final = "TRACE" """TRACE method.""" - OTHER = "_OTHER" + OTHER: Final = "_OTHER" """Any HTTP method that the instrumentation has no prior knowledge of.""" 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 fcc1d0d8de0..de7480a55d8 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,13 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -K8S_CLUSTER_NAME = "k8s.cluster.name" +K8S_CLUSTER_NAME: Final = "k8s.cluster.name" """ The name of the cluster. """ - -K8S_CLUSTER_UID = "k8s.cluster.uid" +K8S_CLUSTER_UID: Final = "k8s.cluster.uid" """ A pseudo-ID for the cluster, set to the UID of the `kube-system` namespace. Note: K8s doesn't have support for obtaining a cluster ID. If this is ever @@ -44,113 +44,91 @@ Therefore, UIDs between clusters should be extremely unlikely to conflict. """ - -K8S_CONTAINER_NAME = "k8s.container.name" +K8S_CONTAINER_NAME: Final = "k8s.container.name" """ 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" +K8S_CONTAINER_RESTART_COUNT: Final = "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_CRONJOB_NAME = "k8s.cronjob.name" +K8S_CRONJOB_NAME: Final = "k8s.cronjob.name" """ The name of the CronJob. """ - -K8S_CRONJOB_UID = "k8s.cronjob.uid" +K8S_CRONJOB_UID: Final = "k8s.cronjob.uid" """ The UID of the CronJob. """ - -K8S_DAEMONSET_NAME = "k8s.daemonset.name" +K8S_DAEMONSET_NAME: Final = "k8s.daemonset.name" """ The name of the DaemonSet. """ - -K8S_DAEMONSET_UID = "k8s.daemonset.uid" +K8S_DAEMONSET_UID: Final = "k8s.daemonset.uid" """ The UID of the DaemonSet. """ - -K8S_DEPLOYMENT_NAME = "k8s.deployment.name" +K8S_DEPLOYMENT_NAME: Final = "k8s.deployment.name" """ The name of the Deployment. """ - -K8S_DEPLOYMENT_UID = "k8s.deployment.uid" +K8S_DEPLOYMENT_UID: Final = "k8s.deployment.uid" """ The UID of the Deployment. """ - -K8S_JOB_NAME = "k8s.job.name" +K8S_JOB_NAME: Final = "k8s.job.name" """ The name of the Job. """ - -K8S_JOB_UID = "k8s.job.uid" +K8S_JOB_UID: Final = "k8s.job.uid" """ The UID of the Job. """ - -K8S_NAMESPACE_NAME = "k8s.namespace.name" +K8S_NAMESPACE_NAME: Final = "k8s.namespace.name" """ The name of the namespace that the pod is running in. """ - -K8S_NODE_NAME = "k8s.node.name" +K8S_NODE_NAME: Final = "k8s.node.name" """ The name of the Node. """ - -K8S_NODE_UID = "k8s.node.uid" +K8S_NODE_UID: Final = "k8s.node.uid" """ The UID of the Node. """ - -K8S_POD_ANNOTATION_TEMPLATE = "k8s.pod.annotation" +K8S_POD_ANNOTATION_TEMPLATE: Final = "k8s.pod.annotation" """ The annotation key-value pairs placed on the Pod, the `` being the annotation name, the value being the annotation value. """ - -K8S_POD_LABEL_TEMPLATE = "k8s.pod.label" +K8S_POD_LABEL_TEMPLATE: Final = "k8s.pod.label" """ The label key-value pairs placed on the Pod, the `` being the label name, the value being the label value. """ - -K8S_POD_LABELS_TEMPLATE = "k8s.pod.labels" +K8S_POD_LABELS_TEMPLATE: Final = "k8s.pod.labels" """ Deprecated: Replaced by `k8s.pod.label`. """ - -K8S_POD_NAME = "k8s.pod.name" +K8S_POD_NAME: Final = "k8s.pod.name" """ The name of the Pod. """ - -K8S_POD_UID = "k8s.pod.uid" +K8S_POD_UID: Final = "k8s.pod.uid" """ The UID of the Pod. """ - -K8S_REPLICASET_NAME = "k8s.replicaset.name" +K8S_REPLICASET_NAME: Final = "k8s.replicaset.name" """ The name of the ReplicaSet. """ - -K8S_REPLICASET_UID = "k8s.replicaset.uid" +K8S_REPLICASET_UID: Final = "k8s.replicaset.uid" """ The UID of the ReplicaSet. """ - -K8S_STATEFULSET_NAME = "k8s.statefulset.name" +K8S_STATEFULSET_NAME: Final = "k8s.statefulset.name" """ The name of the StatefulSet. """ - -K8S_STATEFULSET_UID = "k8s.statefulset.uid" +K8S_STATEFULSET_UID: Final = "k8s.statefulset.uid" """ The UID of the StatefulSet. """ 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 ff943485584..fa3b265389d 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 @@ -12,35 +12,30 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -LOG_FILE_NAME = "log.file.name" +LOG_FILE_NAME: Final = "log.file.name" """ The basename of the file. """ - -LOG_FILE_NAME_RESOLVED = "log.file.name_resolved" +LOG_FILE_NAME_RESOLVED: Final = "log.file.name_resolved" """ The basename of the file, with symlinks resolved. """ - -LOG_FILE_PATH = "log.file.path" +LOG_FILE_PATH: Final = "log.file.path" """ The full path to the file. """ - -LOG_FILE_PATH_RESOLVED = "log.file.path_resolved" +LOG_FILE_PATH_RESOLVED: Final = "log.file.path_resolved" """ The full path to the file, with symlinks resolved. """ - -LOG_IOSTREAM = "log.iostream" +LOG_IOSTREAM: Final = "log.iostream" """ The stream associated with the log. See below for a list of well-known values. """ - -LOG_RECORD_UID = "log.record.uid" +LOG_RECORD_UID: Final = "log.record.uid" """ A unique identifier for the Log Record. Note: If an id is provided, other log records with the same id will be considered duplicates and can be removed safely. This means, that two distinguishable log records MUST have different values. @@ -49,7 +44,7 @@ class LogIostreamValues(Enum): - STDOUT = "stdout" + STDOUT: Final = "stdout" """Logs from stdout stream.""" - STDERR = "stderr" + STDERR: Final = "stderr" """Events from stderr stream.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/message_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/message_attributes.py index dea3ba65ae9..7026da28666 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/message_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/message_attributes.py @@ -12,33 +12,30 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -MESSAGE_COMPRESSED_SIZE = "message.compressed_size" +MESSAGE_COMPRESSED_SIZE: Final = "message.compressed_size" """ Compressed size of the message in bytes. """ - -MESSAGE_ID = "message.id" +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. """ - -MESSAGE_TYPE = "message.type" +MESSAGE_TYPE: Final = "message.type" """ Whether this is a received or sent message. """ - -MESSAGE_UNCOMPRESSED_SIZE = "message.uncompressed_size" +MESSAGE_UNCOMPRESSED_SIZE: Final = "message.uncompressed_size" """ Uncompressed size of the message in bytes. """ class MessageTypeValues(Enum): - SENT = "SENT" + SENT: Final = "SENT" """sent.""" - RECEIVED = "RECEIVED" + RECEIVED: Final = "RECEIVED" """received.""" 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 c3c7ce85c6c..ad8dce86aff 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 @@ -12,294 +12,267 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -MESSAGING_BATCH_MESSAGE_COUNT = "messaging.batch.message_count" +MESSAGING_BATCH_MESSAGE_COUNT: Final = "messaging.batch.message_count" """ The number of messages sent, received, or processed in the scope of the batching operation. Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on spans that operate with a single message. When a messaging client library supports both batch and single-message API for the same operation, instrumentations SHOULD use `messaging.batch.message_count` for batching APIs and SHOULD NOT use it for single-message APIs. """ - -MESSAGING_CLIENT_ID = "messaging.client_id" +MESSAGING_CLIENT_ID: Final = "messaging.client_id" """ A unique identifier for the client that consumes or produces a message. """ - -MESSAGING_DESTINATION_ANONYMOUS = "messaging.destination.anonymous" +MESSAGING_DESTINATION_ANONYMOUS: Final = "messaging.destination.anonymous" """ A boolean that is true if the message destination is anonymous (could be unnamed or have auto-generated name). """ - -MESSAGING_DESTINATION_NAME = "messaging.destination.name" +MESSAGING_DESTINATION_NAME: Final = "messaging.destination.name" """ The message destination name. Note: Destination name SHOULD uniquely identify a specific queue, topic or other entity within the broker. If the broker doesn't have such notion, the destination name SHOULD uniquely identify the broker. """ - -MESSAGING_DESTINATION_PARTITION_ID = "messaging.destination.partition.id" +MESSAGING_DESTINATION_PARTITION_ID: Final = ( + "messaging.destination.partition.id" +) """ The identifier of the partition messages are sent to or received from, unique within the `messaging.destination.name`. """ - -MESSAGING_DESTINATION_TEMPLATE = "messaging.destination.template" +MESSAGING_DESTINATION_TEMPLATE: Final = "messaging.destination.template" """ Low cardinality representation of the messaging destination name. Note: Destination names could be constructed from templates. An example would be a destination name involving a user name or product id. Although the destination name in this case is of high cardinality, the underlying template is of low cardinality and can be effectively used for grouping and aggregation. """ - -MESSAGING_DESTINATION_TEMPORARY = "messaging.destination.temporary" +MESSAGING_DESTINATION_TEMPORARY: Final = "messaging.destination.temporary" """ A boolean that is true if the message destination is temporary and might not exist anymore after messages are processed. """ - -MESSAGING_DESTINATION_PUBLISH_ANONYMOUS = ( +MESSAGING_DESTINATION_PUBLISH_ANONYMOUS: Final = ( "messaging.destination_publish.anonymous" ) """ A boolean that is true if the publish message destination is anonymous (could be unnamed or have auto-generated name). """ - -MESSAGING_DESTINATION_PUBLISH_NAME = "messaging.destination_publish.name" +MESSAGING_DESTINATION_PUBLISH_NAME: Final = ( + "messaging.destination_publish.name" +) """ The name of the original destination the message was published to. Note: The name SHOULD uniquely identify a specific queue, topic, or other entity within the broker. If the broker doesn't have such notion, the original destination name SHOULD uniquely identify the broker. """ - -MESSAGING_EVENTHUBS_CONSUMER_GROUP = "messaging.eventhubs.consumer.group" +MESSAGING_EVENTHUBS_CONSUMER_GROUP: Final = ( + "messaging.eventhubs.consumer.group" +) """ The name of the consumer group the event consumer is associated with. """ - -MESSAGING_EVENTHUBS_MESSAGE_ENQUEUED_TIME = ( +MESSAGING_EVENTHUBS_MESSAGE_ENQUEUED_TIME: Final = ( "messaging.eventhubs.message.enqueued_time" ) """ The UTC epoch seconds at which the message has been accepted and stored in the entity. """ - -MESSAGING_GCP_PUBSUB_MESSAGE_ORDERING_KEY = ( +MESSAGING_GCP_PUBSUB_MESSAGE_ORDERING_KEY: Final = ( "messaging.gcp_pubsub.message.ordering_key" ) """ The ordering key for a given message. If the attribute is not present, the message does not have an ordering key. """ - -MESSAGING_KAFKA_CONSUMER_GROUP = "messaging.kafka.consumer.group" +MESSAGING_KAFKA_CONSUMER_GROUP: Final = "messaging.kafka.consumer.group" """ Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. """ - -MESSAGING_KAFKA_DESTINATION_PARTITION = "messaging.kafka.destination.partition" +MESSAGING_KAFKA_DESTINATION_PARTITION: Final = ( + "messaging.kafka.destination.partition" +) """ Deprecated: Replaced by `messaging.destination.partition.id`. """ - -MESSAGING_KAFKA_MESSAGE_KEY = "messaging.kafka.message.key" +MESSAGING_KAFKA_MESSAGE_KEY: Final = "messaging.kafka.message.key" """ Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message.id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set. Note: If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value. """ - -MESSAGING_KAFKA_MESSAGE_OFFSET = "messaging.kafka.message.offset" +MESSAGING_KAFKA_MESSAGE_OFFSET: Final = "messaging.kafka.message.offset" """ The offset of a record in the corresponding Kafka partition. """ - -MESSAGING_KAFKA_MESSAGE_TOMBSTONE = "messaging.kafka.message.tombstone" +MESSAGING_KAFKA_MESSAGE_TOMBSTONE: Final = "messaging.kafka.message.tombstone" """ A boolean that is true if the message is a tombstone. """ - -MESSAGING_MESSAGE_BODY_SIZE = "messaging.message.body.size" +MESSAGING_MESSAGE_BODY_SIZE: Final = "messaging.message.body.size" """ The size of the message body in bytes. Note: This can refer to both the compressed or uncompressed body size. If both sizes are known, the uncompressed body size should be used. """ - -MESSAGING_MESSAGE_CONVERSATION_ID = "messaging.message.conversation_id" +MESSAGING_MESSAGE_CONVERSATION_ID: Final = "messaging.message.conversation_id" """ The conversation ID identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". """ - -MESSAGING_MESSAGE_ENVELOPE_SIZE = "messaging.message.envelope.size" +MESSAGING_MESSAGE_ENVELOPE_SIZE: Final = "messaging.message.envelope.size" """ The size of the message body and metadata in bytes. Note: This can refer to both the compressed or uncompressed size. If both sizes are known, the uncompressed size should be used. """ - -MESSAGING_MESSAGE_ID = "messaging.message.id" +MESSAGING_MESSAGE_ID: Final = "messaging.message.id" """ A value used by the messaging system as an identifier for the message, represented as a string. """ - -MESSAGING_OPERATION = "messaging.operation" +MESSAGING_OPERATION: Final = "messaging.operation" """ A string identifying the kind of messaging operation. Note: If a custom value is used, it MUST be of low cardinality. """ - -MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = ( +MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY: Final = ( "messaging.rabbitmq.destination.routing_key" ) """ RabbitMQ message routing key. """ - -MESSAGING_RABBITMQ_MESSAGE_DELIVERY_TAG = ( +MESSAGING_RABBITMQ_MESSAGE_DELIVERY_TAG: Final = ( "messaging.rabbitmq.message.delivery_tag" ) """ RabbitMQ message delivery tag. """ - -MESSAGING_ROCKETMQ_CLIENT_GROUP = "messaging.rocketmq.client_group" +MESSAGING_ROCKETMQ_CLIENT_GROUP: Final = "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_CONSUMPTION_MODEL = "messaging.rocketmq.consumption_model" +MESSAGING_ROCKETMQ_CONSUMPTION_MODEL: Final = ( + "messaging.rocketmq.consumption_model" +) """ Model of message consumption. This only applies to consumer spans. """ - -MESSAGING_ROCKETMQ_MESSAGE_DELAY_TIME_LEVEL = ( +MESSAGING_ROCKETMQ_MESSAGE_DELAY_TIME_LEVEL: Final = ( "messaging.rocketmq.message.delay_time_level" ) """ The delay time level for delay message, which determines the message delay time. """ - -MESSAGING_ROCKETMQ_MESSAGE_DELIVERY_TIMESTAMP = ( +MESSAGING_ROCKETMQ_MESSAGE_DELIVERY_TIMESTAMP: Final = ( "messaging.rocketmq.message.delivery_timestamp" ) """ The timestamp in milliseconds that the delay message is expected to be delivered to consumer. """ - -MESSAGING_ROCKETMQ_MESSAGE_GROUP = "messaging.rocketmq.message.group" +MESSAGING_ROCKETMQ_MESSAGE_GROUP: Final = "messaging.rocketmq.message.group" """ It is essential for FIFO message. Messages that belong to the same message group are always processed one by one within the same consumer group. """ - -MESSAGING_ROCKETMQ_MESSAGE_KEYS = "messaging.rocketmq.message.keys" +MESSAGING_ROCKETMQ_MESSAGE_KEYS: Final = "messaging.rocketmq.message.keys" """ Key(s) of message, another way to mark message besides message id. """ - -MESSAGING_ROCKETMQ_MESSAGE_TAG = "messaging.rocketmq.message.tag" +MESSAGING_ROCKETMQ_MESSAGE_TAG: Final = "messaging.rocketmq.message.tag" """ The secondary classifier of message besides topic. """ - -MESSAGING_ROCKETMQ_MESSAGE_TYPE = "messaging.rocketmq.message.type" +MESSAGING_ROCKETMQ_MESSAGE_TYPE: Final = "messaging.rocketmq.message.type" """ Type of message. """ - -MESSAGING_ROCKETMQ_NAMESPACE = "messaging.rocketmq.namespace" +MESSAGING_ROCKETMQ_NAMESPACE: Final = "messaging.rocketmq.namespace" """ Namespace of RocketMQ resources, resources in different namespaces are individual. """ - -MESSAGING_SERVICEBUS_DESTINATION_SUBSCRIPTION_NAME = ( +MESSAGING_SERVICEBUS_DESTINATION_SUBSCRIPTION_NAME: Final = ( "messaging.servicebus.destination.subscription_name" ) """ The name of the subscription in the topic messages are received from. """ - -MESSAGING_SERVICEBUS_DISPOSITION_STATUS = ( +MESSAGING_SERVICEBUS_DISPOSITION_STATUS: Final = ( "messaging.servicebus.disposition_status" ) """ Describes the [settlement type](https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock). """ - -MESSAGING_SERVICEBUS_MESSAGE_DELIVERY_COUNT = ( +MESSAGING_SERVICEBUS_MESSAGE_DELIVERY_COUNT: Final = ( "messaging.servicebus.message.delivery_count" ) """ Number of deliveries that have been attempted for this message. """ - -MESSAGING_SERVICEBUS_MESSAGE_ENQUEUED_TIME = ( +MESSAGING_SERVICEBUS_MESSAGE_ENQUEUED_TIME: Final = ( "messaging.servicebus.message.enqueued_time" ) """ The UTC epoch seconds at which the message has been accepted and stored in the entity. """ - -MESSAGING_SYSTEM = "messaging.system" +MESSAGING_SYSTEM: Final = "messaging.system" """ An identifier for the messaging system being used. See below for a list of well-known identifiers. """ class MessagingOperationValues(Enum): - PUBLISH = "publish" + PUBLISH: Final = "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" + CREATE: Final = "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.""" - RECEIVE = "receive" + RECEIVE: Final = "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.""" - DELIVER = "process" + DELIVER: Final = "process" """One or more messages are delivered to or processed by a consumer.""" - SETTLE = "settle" + SETTLE: Final = "settle" """One or more messages are settled.""" class MessagingRocketmqConsumptionModelValues(Enum): - CLUSTERING = "clustering" + CLUSTERING: Final = "clustering" """Clustering consumption model.""" - BROADCASTING = "broadcasting" + BROADCASTING: Final = "broadcasting" """Broadcasting consumption model.""" class MessagingRocketmqMessageTypeValues(Enum): - NORMAL = "normal" + NORMAL: Final = "normal" """Normal message.""" - FIFO = "fifo" + FIFO: Final = "fifo" """FIFO message.""" - DELAY = "delay" + DELAY: Final = "delay" """Delay message.""" - TRANSACTION = "transaction" + TRANSACTION: Final = "transaction" """Transaction message.""" class MessagingServicebusDispositionStatusValues(Enum): - COMPLETE = "complete" + COMPLETE: Final = "complete" """Message is completed.""" - ABANDON = "abandon" + ABANDON: Final = "abandon" """Message is abandoned.""" - DEAD_LETTER = "dead_letter" + DEAD_LETTER: Final = "dead_letter" """Message is sent to dead letter queue.""" - DEFER = "defer" + DEFER: Final = "defer" """Message is deferred.""" class MessagingSystemValues(Enum): - ACTIVEMQ = "activemq" + ACTIVEMQ: Final = "activemq" """Apache ActiveMQ.""" - AWS_SQS = "aws_sqs" + AWS_SQS: Final = "aws_sqs" """Amazon Simple Queue Service (SQS).""" - EVENTGRID = "eventgrid" + EVENTGRID: Final = "eventgrid" """Azure Event Grid.""" - EVENTHUBS = "eventhubs" + EVENTHUBS: Final = "eventhubs" """Azure Event Hubs.""" - SERVICEBUS = "servicebus" + SERVICEBUS: Final = "servicebus" """Azure Service Bus.""" - GCP_PUBSUB = "gcp_pubsub" + GCP_PUBSUB: Final = "gcp_pubsub" """Google Cloud Pub/Sub.""" - JMS = "jms" + JMS: Final = "jms" """Java Message Service.""" - KAFKA = "kafka" + KAFKA: Final = "kafka" """Apache Kafka.""" - RABBITMQ = "rabbitmq" + RABBITMQ: Final = "rabbitmq" """RabbitMQ.""" - ROCKETMQ = "rocketmq" + ROCKETMQ: Final = "rocketmq" """Apache RocketMQ.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/net_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/net_attributes.py index 83467d12e09..1c2b762219d 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/net_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/net_attributes.py @@ -12,72 +12,60 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final from deprecated import deprecated -NET_HOST_NAME = "net.host.name" +NET_HOST_NAME: Final = "net.host.name" """ Deprecated: Replaced by `server.address`. """ - -NET_HOST_PORT = "net.host.port" +NET_HOST_PORT: Final = "net.host.port" """ Deprecated: Replaced by `server.port`. """ - -NET_PEER_NAME = "net.peer.name" +NET_PEER_NAME: Final = "net.peer.name" """ Deprecated: Replaced by `server.address` on client spans and `client.address` on server spans. """ - -NET_PEER_PORT = "net.peer.port" +NET_PEER_PORT: Final = "net.peer.port" """ Deprecated: Replaced by `server.port` on client spans and `client.port` on server spans. """ - -NET_PROTOCOL_NAME = "net.protocol.name" +NET_PROTOCOL_NAME: Final = "net.protocol.name" """ Deprecated: Replaced by `network.protocol.name`. """ - -NET_PROTOCOL_VERSION = "net.protocol.version" +NET_PROTOCOL_VERSION: Final = "net.protocol.version" """ Deprecated: Replaced by `network.protocol.version`. """ - -NET_SOCK_FAMILY = "net.sock.family" +NET_SOCK_FAMILY: Final = "net.sock.family" """ Deprecated: Split to `network.transport` and `network.type`. """ - -NET_SOCK_HOST_ADDR = "net.sock.host.addr" +NET_SOCK_HOST_ADDR: Final = "net.sock.host.addr" """ Deprecated: Replaced by `network.local.address`. """ - -NET_SOCK_HOST_PORT = "net.sock.host.port" +NET_SOCK_HOST_PORT: Final = "net.sock.host.port" """ Deprecated: Replaced by `network.local.port`. """ - -NET_SOCK_PEER_ADDR = "net.sock.peer.addr" +NET_SOCK_PEER_ADDR: Final = "net.sock.peer.addr" """ Deprecated: Replaced by `network.peer.address`. """ - -NET_SOCK_PEER_NAME = "net.sock.peer.name" +NET_SOCK_PEER_NAME: Final = "net.sock.peer.name" """ Deprecated: Removed. """ - -NET_SOCK_PEER_PORT = "net.sock.peer.port" +NET_SOCK_PEER_PORT: Final = "net.sock.peer.port" """ Deprecated: Replaced by `network.peer.port`. """ - -NET_TRANSPORT = "net.transport" +NET_TRANSPORT: Final = "net.transport" """ Deprecated: Replaced by `network.transport`. """ @@ -87,11 +75,11 @@ reason="The attribute net.sock.family is deprecated - Split to `network.transport` and `network.type`" ) class NetSockFamilyValues(Enum): - INET = "inet" + INET: Final = "inet" """IPv4 address.""" - INET6 = "inet6" + INET6: Final = "inet6" """IPv6 address.""" - UNIX = "unix" + UNIX: Final = "unix" """Unix domain socket path.""" @@ -99,13 +87,13 @@ class NetSockFamilyValues(Enum): reason="The attribute net.transport is deprecated - Replaced by `network.transport`" ) class NetTransportValues(Enum): - IP_TCP = "ip_tcp" + IP_TCP: Final = "ip_tcp" """ip_tcp.""" - IP_UDP = "ip_udp" + IP_UDP: Final = "ip_udp" """ip_udp.""" - PIPE = "pipe" + PIPE: Final = "pipe" """Named or anonymous pipe.""" - INPROC = "inproc" + INPROC: Final = "inproc" """In-process communication.""" - OTHER = "other" + OTHER: Final = "other" """Something else (non IP-based).""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py index d226ff311cf..7609fb7ae55 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py @@ -12,149 +12,135 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final from deprecated import deprecated -NETWORK_CARRIER_ICC = "network.carrier.icc" +NETWORK_CARRIER_ICC: Final = "network.carrier.icc" """ The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. """ - -NETWORK_CARRIER_MCC = "network.carrier.mcc" +NETWORK_CARRIER_MCC: Final = "network.carrier.mcc" """ The mobile carrier country code. """ - -NETWORK_CARRIER_MNC = "network.carrier.mnc" +NETWORK_CARRIER_MNC: Final = "network.carrier.mnc" """ The mobile carrier network code. """ - -NETWORK_CARRIER_NAME = "network.carrier.name" +NETWORK_CARRIER_NAME: Final = "network.carrier.name" """ The name of the mobile carrier. """ - -NETWORK_CONNECTION_SUBTYPE = "network.connection.subtype" +NETWORK_CONNECTION_SUBTYPE: Final = "network.connection.subtype" """ This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. """ - -NETWORK_CONNECTION_TYPE = "network.connection.type" +NETWORK_CONNECTION_TYPE: Final = "network.connection.type" """ The internet connection type. """ - -NETWORK_IO_DIRECTION = "network.io.direction" +NETWORK_IO_DIRECTION: Final = "network.io.direction" """ The network IO operation direction. """ - -NETWORK_LOCAL_ADDRESS = "network.local.address" +NETWORK_LOCAL_ADDRESS: Final = "network.local.address" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_LOCAL_ADDRESS`. """ - -NETWORK_LOCAL_PORT = "network.local.port" +NETWORK_LOCAL_PORT: Final = "network.local.port" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_LOCAL_PORT`. """ - -NETWORK_PEER_ADDRESS = "network.peer.address" +NETWORK_PEER_ADDRESS: Final = "network.peer.address" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_PEER_ADDRESS`. """ - -NETWORK_PEER_PORT = "network.peer.port" +NETWORK_PEER_PORT: Final = "network.peer.port" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_PEER_PORT`. """ - -NETWORK_PROTOCOL_NAME = "network.protocol.name" +NETWORK_PROTOCOL_NAME: Final = "network.protocol.name" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_PROTOCOL_NAME`. """ - -NETWORK_PROTOCOL_VERSION = "network.protocol.version" +NETWORK_PROTOCOL_VERSION: Final = "network.protocol.version" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_PROTOCOL_VERSION`. """ - -NETWORK_TRANSPORT = "network.transport" +NETWORK_TRANSPORT: Final = "network.transport" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_TRANSPORT`. """ - -NETWORK_TYPE = "network.type" +NETWORK_TYPE: Final = "network.type" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_TYPE`. """ class NetworkConnectionSubtypeValues(Enum): - GPRS = "gprs" + GPRS: Final = "gprs" """GPRS.""" - EDGE = "edge" + EDGE: Final = "edge" """EDGE.""" - UMTS = "umts" + UMTS: Final = "umts" """UMTS.""" - CDMA = "cdma" + CDMA: Final = "cdma" """CDMA.""" - EVDO_0 = "evdo_0" + EVDO_0: Final = "evdo_0" """EVDO Rel. 0.""" - EVDO_A = "evdo_a" + EVDO_A: Final = "evdo_a" """EVDO Rev. A.""" - CDMA2000_1XRTT = "cdma2000_1xrtt" + CDMA2000_1XRTT: Final = "cdma2000_1xrtt" """CDMA2000 1XRTT.""" - HSDPA = "hsdpa" + HSDPA: Final = "hsdpa" """HSDPA.""" - HSUPA = "hsupa" + HSUPA: Final = "hsupa" """HSUPA.""" - HSPA = "hspa" + HSPA: Final = "hspa" """HSPA.""" - IDEN = "iden" + IDEN: Final = "iden" """IDEN.""" - EVDO_B = "evdo_b" + EVDO_B: Final = "evdo_b" """EVDO Rev. B.""" - LTE = "lte" + LTE: Final = "lte" """LTE.""" - EHRPD = "ehrpd" + EHRPD: Final = "ehrpd" """EHRPD.""" - HSPAP = "hspap" + HSPAP: Final = "hspap" """HSPAP.""" - GSM = "gsm" + GSM: Final = "gsm" """GSM.""" - TD_SCDMA = "td_scdma" + TD_SCDMA: Final = "td_scdma" """TD-SCDMA.""" - IWLAN = "iwlan" + IWLAN: Final = "iwlan" """IWLAN.""" - NR = "nr" + NR: Final = "nr" """5G NR (New Radio).""" - NRNSA = "nrnsa" + NRNSA: Final = "nrnsa" """5G NRNSA (New Radio Non-Standalone).""" - LTE_CA = "lte_ca" + LTE_CA: Final = "lte_ca" """LTE CA.""" class NetworkConnectionTypeValues(Enum): - WIFI = "wifi" + WIFI: Final = "wifi" """wifi.""" - WIRED = "wired" + WIRED: Final = "wired" """wired.""" - CELL = "cell" + CELL: Final = "cell" """cell.""" - UNAVAILABLE = "unavailable" + UNAVAILABLE: Final = "unavailable" """unavailable.""" - UNKNOWN = "unknown" + UNKNOWN: Final = "unknown" """unknown.""" class NetworkIoDirectionValues(Enum): - TRANSMIT = "transmit" + TRANSMIT: Final = "transmit" """transmit.""" - RECEIVE = "receive" + RECEIVE: Final = "receive" """receive.""" @@ -162,13 +148,13 @@ class NetworkIoDirectionValues(Enum): reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTransportValues`." ) class NetworkTransportValues(Enum): - TCP = "tcp" + TCP: Final = "tcp" """TCP.""" - UDP = "udp" + UDP: Final = "udp" """UDP.""" - PIPE = "pipe" + PIPE: Final = "pipe" """Named or anonymous pipe.""" - UNIX = "unix" + UNIX: Final = "unix" """Unix domain socket.""" @@ -176,7 +162,7 @@ class NetworkTransportValues(Enum): reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTypeValues`." ) class NetworkTypeValues(Enum): - IPV4 = "ipv4" + IPV4: Final = "ipv4" """IPv4.""" - IPV6 = "ipv6" + IPV6: Final = "ipv6" """IPv6.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/oci_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/oci_attributes.py index bda352d8ba9..22c05bc4aea 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/oci_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/oci_attributes.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -OCI_MANIFEST_DIGEST = "oci.manifest.digest" +OCI_MANIFEST_DIGEST: Final = "oci.manifest.digest" """ The digest of the OCI image manifest. For container images specifically is the digest by which the container image is known. Note: Follows [OCI Image Manifest Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md), and specifically the [Digest property](https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests). diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/opentracing_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/opentracing_attributes.py index 6c2f4143b99..71c0fad3903 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/opentracing_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/opentracing_attributes.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -OPENTRACING_REF_TYPE = "opentracing.ref_type" +OPENTRACING_REF_TYPE: Final = "opentracing.ref_type" """ Parent-child Reference type. Note: The causal relationship between a child Span and a parent Span. @@ -23,7 +23,7 @@ class OpentracingRefTypeValues(Enum): - CHILD_OF = "child_of" + CHILD_OF: Final = "child_of" """The parent Span depends on the child Span in some capacity.""" - FOLLOWS_FROM = "follows_from" + FOLLOWS_FROM: Final = "follows_from" """The parent Span doesn't depend in any way on the result of the child Span.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/os_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/os_attributes.py index ec3a68c87a7..66d9bf80f79 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/os_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/os_attributes.py @@ -12,55 +12,51 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -OS_BUILD_ID = "os.build_id" +OS_BUILD_ID: Final = "os.build_id" """ Unique identifier for a particular build or compilation of the operating system. """ - -OS_DESCRIPTION = "os.description" +OS_DESCRIPTION: Final = "os.description" """ Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands. """ - -OS_NAME = "os.name" +OS_NAME: Final = "os.name" """ Human readable operating system name. """ - -OS_TYPE = "os.type" +OS_TYPE: Final = "os.type" """ The operating system type. """ - -OS_VERSION = "os.version" +OS_VERSION: Final = "os.version" """ The version string of the operating system as defined in [Version Attributes](/docs/resource/README.md#version-attributes). """ class OsTypeValues(Enum): - WINDOWS = "windows" + WINDOWS: Final = "windows" """Microsoft Windows.""" - LINUX = "linux" + LINUX: Final = "linux" """Linux.""" - DARWIN = "darwin" + DARWIN: Final = "darwin" """Apple Darwin.""" - FREEBSD = "freebsd" + FREEBSD: Final = "freebsd" """FreeBSD.""" - NETBSD = "netbsd" + NETBSD: Final = "netbsd" """NetBSD.""" - OPENBSD = "openbsd" + OPENBSD: Final = "openbsd" """OpenBSD.""" - DRAGONFLYBSD = "dragonflybsd" + DRAGONFLYBSD: Final = "dragonflybsd" """DragonFly BSD.""" - HPUX = "hpux" + HPUX: Final = "hpux" """HP-UX (Hewlett Packard Unix).""" - AIX = "aix" + AIX: Final = "aix" """AIX (Advanced Interactive eXecutive).""" - SOLARIS = "solaris" + SOLARIS: Final = "solaris" """SunOS, Oracle Solaris.""" - Z_OS = "z_os" + Z_OS: Final = "z_os" """IBM z/OS.""" 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 9a04a2ac959..279475ae6ac 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 @@ -12,37 +12,32 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final from deprecated import deprecated -OTEL_LIBRARY_NAME = "otel.library.name" +OTEL_LIBRARY_NAME: Final = "otel.library.name" """ Deprecated: use the `otel.scope.name` attribute. """ - -OTEL_LIBRARY_VERSION = "otel.library.version" +OTEL_LIBRARY_VERSION: Final = "otel.library.version" """ Deprecated: use the `otel.scope.version` attribute. """ - -OTEL_SCOPE_NAME = "otel.scope.name" +OTEL_SCOPE_NAME: Final = "otel.scope.name" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OTEL_SCOPE_NAME`. """ - -OTEL_SCOPE_VERSION = "otel.scope.version" +OTEL_SCOPE_VERSION: Final = "otel.scope.version" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OTEL_SCOPE_VERSION`. """ - -OTEL_STATUS_CODE = "otel.status_code" +OTEL_STATUS_CODE: Final = "otel.status_code" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OTEL_STATUS_CODE`. """ - -OTEL_STATUS_DESCRIPTION = "otel.status_description" +OTEL_STATUS_DESCRIPTION: Final = "otel.status_description" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OTEL_STATUS_DESCRIPTION`. """ @@ -52,7 +47,7 @@ reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OtelStatusCodeValues`." ) class OtelStatusCodeValues(Enum): - OK = "OK" + OK: Final = "OK" """The operation has been validated by an Application developer or Operator to have completed successfully.""" - ERROR = "ERROR" + ERROR: Final = "ERROR" """The operation contains an error.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/other_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/other_attributes.py index 53f5cfc6383..9600adbf75f 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/other_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/other_attributes.py @@ -12,17 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -STATE = "state" +STATE: Final = "state" """ The state of a connection in the pool. """ class StateValues(Enum): - IDLE = "idle" + IDLE: Final = "idle" """idle.""" - USED = "used" + USED: Final = "used" """used.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/peer_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/peer_attributes.py index 74a6926822e..eac8e77cb87 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/peer_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/peer_attributes.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -PEER_SERVICE = "peer.service" +PEER_SERVICE: Final = "peer.service" """ The [`service.name`](/docs/resource/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/pool_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/pool_attributes.py index f02d6101d51..a4a02a5fd0f 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/pool_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/pool_attributes.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -POOL_NAME = "pool.name" +POOL_NAME: Final = "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`. """ 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 5ab7c72f491..5969742af0e 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 @@ -12,98 +12,85 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -PROCESS_COMMAND = "process.command" +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`. """ - -PROCESS_COMMAND_ARGS = "process.command_args" +PROCESS_COMMAND_ARGS: Final = "process.command_args" """ All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`. """ - -PROCESS_COMMAND_LINE = "process.command_line" +PROCESS_COMMAND_LINE: Final = "process.command_line" """ The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to assemble it just for monitoring; use `process.command_args` instead. """ - -PROCESS_CONTEXT_SWITCH_TYPE = "process.context_switch_type" +PROCESS_CONTEXT_SWITCH_TYPE: Final = "process.context_switch_type" """ Specifies whether the context switches for this data point were voluntary or involuntary. """ - -PROCESS_CPU_STATE = "process.cpu.state" +PROCESS_CPU_STATE: Final = "process.cpu.state" """ The CPU state for this data point. A process SHOULD be characterized _either_ by data points with no `state` labels, _or only_ data points with `state` labels. """ - -PROCESS_EXECUTABLE_NAME = "process.executable.name" +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`. """ - -PROCESS_EXECUTABLE_PATH = "process.executable.path" +PROCESS_EXECUTABLE_PATH: Final = "process.executable.path" """ The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. """ - -PROCESS_OWNER = "process.owner" +PROCESS_OWNER: Final = "process.owner" """ The username of the user that owns the process. """ - -PROCESS_PAGING_FAULT_TYPE = "process.paging.fault_type" +PROCESS_PAGING_FAULT_TYPE: Final = "process.paging.fault_type" """ The type of page fault for this data point. Type `major` is for major/hard page faults, and `minor` is for minor/soft page faults. """ - -PROCESS_PARENT_PID = "process.parent_pid" +PROCESS_PARENT_PID: Final = "process.parent_pid" """ Parent Process identifier (PPID). """ - -PROCESS_PID = "process.pid" +PROCESS_PID: Final = "process.pid" """ Process identifier (PID). """ - -PROCESS_RUNTIME_DESCRIPTION = "process.runtime.description" +PROCESS_RUNTIME_DESCRIPTION: Final = "process.runtime.description" """ An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment. """ - -PROCESS_RUNTIME_NAME = "process.runtime.name" +PROCESS_RUNTIME_NAME: Final = "process.runtime.name" """ The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of the compiler. """ - -PROCESS_RUNTIME_VERSION = "process.runtime.version" +PROCESS_RUNTIME_VERSION: Final = "process.runtime.version" """ The version of the runtime of this process, as returned by the runtime without modification. """ class ProcessContextSwitchTypeValues(Enum): - VOLUNTARY = "voluntary" + VOLUNTARY: Final = "voluntary" """voluntary.""" - INVOLUNTARY = "involuntary" + INVOLUNTARY: Final = "involuntary" """involuntary.""" class ProcessCpuStateValues(Enum): - SYSTEM = "system" + SYSTEM: Final = "system" """system.""" - USER = "user" + USER: Final = "user" """user.""" - WAIT = "wait" + WAIT: Final = "wait" """wait.""" class ProcessPagingFaultTypeValues(Enum): - MAJOR = "major" + MAJOR: Final = "major" """major.""" - MINOR = "minor" + MINOR: Final = "minor" """minor.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py index 0d86cc211c4..ae586092a1b 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py @@ -12,163 +12,153 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -RPC_CONNECT_RPC_ERROR_CODE = "rpc.connect_rpc.error_code" +RPC_CONNECT_RPC_ERROR_CODE: Final = "rpc.connect_rpc.error_code" """ The [error codes](https://connect.build/docs/protocol/#error-codes) of the Connect request. Error codes are always string values. """ - -RPC_CONNECT_RPC_REQUEST_METADATA_TEMPLATE = "rpc.connect_rpc.request.metadata" +RPC_CONNECT_RPC_REQUEST_METADATA_TEMPLATE: Final = ( + "rpc.connect_rpc.request.metadata" +) """ Connect request metadata, `` being the normalized Connect Metadata key (lowercase), the value being the metadata values. Note: Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured. Including all request metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information. """ - -RPC_CONNECT_RPC_RESPONSE_METADATA_TEMPLATE = ( +RPC_CONNECT_RPC_RESPONSE_METADATA_TEMPLATE: Final = ( "rpc.connect_rpc.response.metadata" ) """ Connect response metadata, `` being the normalized Connect Metadata key (lowercase), the value being the metadata values. Note: Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured. Including all response metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information. """ - -RPC_GRPC_REQUEST_METADATA_TEMPLATE = "rpc.grpc.request.metadata" +RPC_GRPC_REQUEST_METADATA_TEMPLATE: Final = "rpc.grpc.request.metadata" """ gRPC request metadata, `` being the normalized gRPC Metadata key (lowercase), the value being the metadata values. Note: Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured. Including all request metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information. """ - -RPC_GRPC_RESPONSE_METADATA_TEMPLATE = "rpc.grpc.response.metadata" +RPC_GRPC_RESPONSE_METADATA_TEMPLATE: Final = "rpc.grpc.response.metadata" """ gRPC response metadata, `` being the normalized gRPC Metadata key (lowercase), the value being the metadata values. Note: Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured. Including all response metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information. """ - -RPC_GRPC_STATUS_CODE = "rpc.grpc.status_code" +RPC_GRPC_STATUS_CODE: Final = "rpc.grpc.status_code" """ The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. """ - -RPC_JSONRPC_ERROR_CODE = "rpc.jsonrpc.error_code" +RPC_JSONRPC_ERROR_CODE: Final = "rpc.jsonrpc.error_code" """ `error.code` property of response if it is an error response. """ - -RPC_JSONRPC_ERROR_MESSAGE = "rpc.jsonrpc.error_message" +RPC_JSONRPC_ERROR_MESSAGE: Final = "rpc.jsonrpc.error_message" """ `error.message` property of response if it is an error response. """ - -RPC_JSONRPC_REQUEST_ID = "rpc.jsonrpc.request_id" +RPC_JSONRPC_REQUEST_ID: Final = "rpc.jsonrpc.request_id" """ `id` property of request or response. Since protocol allows id to be int, string, `null` or missing (for notifications), value is expected to be cast to string for simplicity. Use empty string in case of `null` value. Omit entirely if this is a notification. """ - -RPC_JSONRPC_VERSION = "rpc.jsonrpc.version" +RPC_JSONRPC_VERSION: Final = "rpc.jsonrpc.version" """ Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 doesn't specify this, the value can be omitted. """ - -RPC_METHOD = "rpc.method" +RPC_METHOD: Final = "rpc.method" """ The name of the (logical) method being called, must be equal to the $method part in the span name. Note: This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side). """ - -RPC_SERVICE = "rpc.service" +RPC_SERVICE: Final = "rpc.service" """ The full (logical) name of the service being called, including its package name, if applicable. Note: This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side). """ - -RPC_SYSTEM = "rpc.system" +RPC_SYSTEM: Final = "rpc.system" """ A string identifying the remoting system. See below for a list of well-known identifiers. """ class RpcConnectRpcErrorCodeValues(Enum): - CANCELLED = "cancelled" + CANCELLED: Final = "cancelled" """cancelled.""" - UNKNOWN = "unknown" + UNKNOWN: Final = "unknown" """unknown.""" - INVALID_ARGUMENT = "invalid_argument" + INVALID_ARGUMENT: Final = "invalid_argument" """invalid_argument.""" - DEADLINE_EXCEEDED = "deadline_exceeded" + DEADLINE_EXCEEDED: Final = "deadline_exceeded" """deadline_exceeded.""" - NOT_FOUND = "not_found" + NOT_FOUND: Final = "not_found" """not_found.""" - ALREADY_EXISTS = "already_exists" + ALREADY_EXISTS: Final = "already_exists" """already_exists.""" - PERMISSION_DENIED = "permission_denied" + PERMISSION_DENIED: Final = "permission_denied" """permission_denied.""" - RESOURCE_EXHAUSTED = "resource_exhausted" + RESOURCE_EXHAUSTED: Final = "resource_exhausted" """resource_exhausted.""" - FAILED_PRECONDITION = "failed_precondition" + FAILED_PRECONDITION: Final = "failed_precondition" """failed_precondition.""" - ABORTED = "aborted" + ABORTED: Final = "aborted" """aborted.""" - OUT_OF_RANGE = "out_of_range" + OUT_OF_RANGE: Final = "out_of_range" """out_of_range.""" - UNIMPLEMENTED = "unimplemented" + UNIMPLEMENTED: Final = "unimplemented" """unimplemented.""" - INTERNAL = "internal" + INTERNAL: Final = "internal" """internal.""" - UNAVAILABLE = "unavailable" + UNAVAILABLE: Final = "unavailable" """unavailable.""" - DATA_LOSS = "data_loss" + DATA_LOSS: Final = "data_loss" """data_loss.""" - UNAUTHENTICATED = "unauthenticated" + UNAUTHENTICATED: Final = "unauthenticated" """unauthenticated.""" class RpcGrpcStatusCodeValues(Enum): - OK = 0 + OK: Final = 0 """OK.""" - CANCELLED = 1 + CANCELLED: Final = 1 """CANCELLED.""" - UNKNOWN = 2 + UNKNOWN: Final = 2 """UNKNOWN.""" - INVALID_ARGUMENT = 3 + INVALID_ARGUMENT: Final = 3 """INVALID_ARGUMENT.""" - DEADLINE_EXCEEDED = 4 + DEADLINE_EXCEEDED: Final = 4 """DEADLINE_EXCEEDED.""" - NOT_FOUND = 5 + NOT_FOUND: Final = 5 """NOT_FOUND.""" - ALREADY_EXISTS = 6 + ALREADY_EXISTS: Final = 6 """ALREADY_EXISTS.""" - PERMISSION_DENIED = 7 + PERMISSION_DENIED: Final = 7 """PERMISSION_DENIED.""" - RESOURCE_EXHAUSTED = 8 + RESOURCE_EXHAUSTED: Final = 8 """RESOURCE_EXHAUSTED.""" - FAILED_PRECONDITION = 9 + FAILED_PRECONDITION: Final = 9 """FAILED_PRECONDITION.""" - ABORTED = 10 + ABORTED: Final = 10 """ABORTED.""" - OUT_OF_RANGE = 11 + OUT_OF_RANGE: Final = 11 """OUT_OF_RANGE.""" - UNIMPLEMENTED = 12 + UNIMPLEMENTED: Final = 12 """UNIMPLEMENTED.""" - INTERNAL = 13 + INTERNAL: Final = 13 """INTERNAL.""" - UNAVAILABLE = 14 + UNAVAILABLE: Final = 14 """UNAVAILABLE.""" - DATA_LOSS = 15 + DATA_LOSS: Final = 15 """DATA_LOSS.""" - UNAUTHENTICATED = 16 + UNAUTHENTICATED: Final = 16 """UNAUTHENTICATED.""" class RpcSystemValues(Enum): - GRPC = "grpc" + GRPC: Final = "grpc" """gRPC.""" - JAVA_RMI = "java_rmi" + JAVA_RMI: Final = "java_rmi" """Java RMI.""" - DOTNET_WCF = "dotnet_wcf" + DOTNET_WCF: Final = "dotnet_wcf" """.NET WCF.""" - APACHE_DUBBO = "apache_dubbo" + APACHE_DUBBO: Final = "apache_dubbo" """Apache Dubbo.""" - CONNECT_RPC = "connect_rpc" + CONNECT_RPC: Final = "connect_rpc" """Connect RPC.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/server_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/server_attributes.py index b763be9a6c0..c240d8ffe08 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/server_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/server_attributes.py @@ -12,13 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -SERVER_ADDRESS = "server.address" +SERVER_ADDRESS: Final = "server.address" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.server_attributes.SERVER_ADDRESS`. """ - -SERVER_PORT = "server.port" +SERVER_PORT: Final = "server.port" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.server_attributes.SERVER_PORT`. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/service_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/service_attributes.py index eb8e9f498d8..195ea229732 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/service_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/service_attributes.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -SERVICE_INSTANCE_ID = "service.instance.id" +SERVICE_INSTANCE_ID: Final = "service.instance.id" """ The string ID of the service instance. Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words @@ -43,19 +44,16 @@ for that telemetry. This is typically the case for scraping receivers, as they know the target address and port. """ - -SERVICE_NAME = "service.name" +SERVICE_NAME: Final = "service.name" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.service_attributes.SERVICE_NAME`. """ - -SERVICE_NAMESPACE = "service.namespace" +SERVICE_NAMESPACE: Final = "service.namespace" """ A namespace for `service.name`. Note: A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace. """ - -SERVICE_VERSION = "service.version" +SERVICE_VERSION: Final = "service.version" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.service_attributes.SERVICE_VERSION`. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/session_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/session_attributes.py index a0a9170aa37..cdbe5dbe2d6 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/session_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/session_attributes.py @@ -12,13 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -SESSION_ID = "session.id" +SESSION_ID: Final = "session.id" """ A unique id to identify a session. """ - -SESSION_PREVIOUS_ID = "session.previous_id" +SESSION_PREVIOUS_ID: Final = "session.previous_id" """ The previous `session.id` for this user, when known. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/source_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/source_attributes.py index b6020b30f6c..aafd0fbee3b 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/source_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/source_attributes.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -SOURCE_ADDRESS = "source.address" +SOURCE_ADDRESS: Final = "source.address" """ Source address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. Note: When observed from the destination side, and when communicating through an intermediary, `source.address` SHOULD represent the source address behind any intermediaries, for example proxies, if it's available. """ - -SOURCE_PORT = "source.port" +SOURCE_PORT: Final = "source.port" """ Source port number. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/system_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/system_attributes.py index eef41169007..5d3fb1494b0 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/system_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/system_attributes.py @@ -12,192 +12,179 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final from deprecated import deprecated -SYSTEM_CPU_LOGICAL_NUMBER = "system.cpu.logical_number" +SYSTEM_CPU_LOGICAL_NUMBER: Final = "system.cpu.logical_number" """ The logical CPU number [0..n-1]. """ - -SYSTEM_CPU_STATE = "system.cpu.state" +SYSTEM_CPU_STATE: Final = "system.cpu.state" """ The CPU state for this data point. A system's CPU SHOULD be characterized *either* by data points with no `state` labels, *or only* data points with `state` labels. """ - -SYSTEM_DEVICE = "system.device" +SYSTEM_DEVICE: Final = "system.device" """ The device identifier. """ - -SYSTEM_FILESYSTEM_MODE = "system.filesystem.mode" +SYSTEM_FILESYSTEM_MODE: Final = "system.filesystem.mode" """ The filesystem mode. """ - -SYSTEM_FILESYSTEM_MOUNTPOINT = "system.filesystem.mountpoint" +SYSTEM_FILESYSTEM_MOUNTPOINT: Final = "system.filesystem.mountpoint" """ The filesystem mount path. """ - -SYSTEM_FILESYSTEM_STATE = "system.filesystem.state" +SYSTEM_FILESYSTEM_STATE: Final = "system.filesystem.state" """ The filesystem state. """ - -SYSTEM_FILESYSTEM_TYPE = "system.filesystem.type" +SYSTEM_FILESYSTEM_TYPE: Final = "system.filesystem.type" """ The filesystem type. """ - -SYSTEM_MEMORY_STATE = "system.memory.state" +SYSTEM_MEMORY_STATE: Final = "system.memory.state" """ The memory state. """ - -SYSTEM_NETWORK_STATE = "system.network.state" +SYSTEM_NETWORK_STATE: Final = "system.network.state" """ A stateless protocol MUST NOT set this attribute. """ - -SYSTEM_PAGING_DIRECTION = "system.paging.direction" +SYSTEM_PAGING_DIRECTION: Final = "system.paging.direction" """ The paging access direction. """ - -SYSTEM_PAGING_STATE = "system.paging.state" +SYSTEM_PAGING_STATE: Final = "system.paging.state" """ The memory paging state. """ - -SYSTEM_PAGING_TYPE = "system.paging.type" +SYSTEM_PAGING_TYPE: Final = "system.paging.type" """ The memory paging type. """ - -SYSTEM_PROCESS_STATUS = "system.process.status" +SYSTEM_PROCESS_STATUS: Final = "system.process.status" """ The process state, e.g., [Linux Process State Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES). """ - -SYSTEM_PROCESSES_STATUS = "system.processes.status" +SYSTEM_PROCESSES_STATUS: Final = "system.processes.status" """ Deprecated: Replaced by `system.process.status`. """ class SystemCpuStateValues(Enum): - USER = "user" + USER: Final = "user" """user.""" - SYSTEM = "system" + SYSTEM: Final = "system" """system.""" - NICE = "nice" + NICE: Final = "nice" """nice.""" - IDLE = "idle" + IDLE: Final = "idle" """idle.""" - IOWAIT = "iowait" + IOWAIT: Final = "iowait" """iowait.""" - INTERRUPT = "interrupt" + INTERRUPT: Final = "interrupt" """interrupt.""" - STEAL = "steal" + STEAL: Final = "steal" """steal.""" class SystemFilesystemStateValues(Enum): - USED = "used" + USED: Final = "used" """used.""" - FREE = "free" + FREE: Final = "free" """free.""" - RESERVED = "reserved" + RESERVED: Final = "reserved" """reserved.""" class SystemFilesystemTypeValues(Enum): - FAT32 = "fat32" + FAT32: Final = "fat32" """fat32.""" - EXFAT = "exfat" + EXFAT: Final = "exfat" """exfat.""" - NTFS = "ntfs" + NTFS: Final = "ntfs" """ntfs.""" - REFS = "refs" + REFS: Final = "refs" """refs.""" - HFSPLUS = "hfsplus" + HFSPLUS: Final = "hfsplus" """hfsplus.""" - EXT4 = "ext4" + EXT4: Final = "ext4" """ext4.""" class SystemMemoryStateValues(Enum): - USED = "used" + USED: Final = "used" """used.""" - FREE = "free" + FREE: Final = "free" """free.""" - SHARED = "shared" + SHARED: Final = "shared" """shared.""" - BUFFERS = "buffers" + BUFFERS: Final = "buffers" """buffers.""" - CACHED = "cached" + CACHED: Final = "cached" """cached.""" class SystemNetworkStateValues(Enum): - CLOSE = "close" + CLOSE: Final = "close" """close.""" - CLOSE_WAIT = "close_wait" + CLOSE_WAIT: Final = "close_wait" """close_wait.""" - CLOSING = "closing" + CLOSING: Final = "closing" """closing.""" - DELETE = "delete" + DELETE: Final = "delete" """delete.""" - ESTABLISHED = "established" + ESTABLISHED: Final = "established" """established.""" - FIN_WAIT_1 = "fin_wait_1" + FIN_WAIT_1: Final = "fin_wait_1" """fin_wait_1.""" - FIN_WAIT_2 = "fin_wait_2" + FIN_WAIT_2: Final = "fin_wait_2" """fin_wait_2.""" - LAST_ACK = "last_ack" + LAST_ACK: Final = "last_ack" """last_ack.""" - LISTEN = "listen" + LISTEN: Final = "listen" """listen.""" - SYN_RECV = "syn_recv" + SYN_RECV: Final = "syn_recv" """syn_recv.""" - SYN_SENT = "syn_sent" + SYN_SENT: Final = "syn_sent" """syn_sent.""" - TIME_WAIT = "time_wait" + TIME_WAIT: Final = "time_wait" """time_wait.""" class SystemPagingDirectionValues(Enum): - IN = "in" + IN: Final = "in" """in.""" - OUT = "out" + OUT: Final = "out" """out.""" class SystemPagingStateValues(Enum): - USED = "used" + USED: Final = "used" """used.""" - FREE = "free" + FREE: Final = "free" """free.""" class SystemPagingTypeValues(Enum): - MAJOR = "major" + MAJOR: Final = "major" """major.""" - MINOR = "minor" + MINOR: Final = "minor" """minor.""" class SystemProcessStatusValues(Enum): - RUNNING = "running" + RUNNING: Final = "running" """running.""" - SLEEPING = "sleeping" + SLEEPING: Final = "sleeping" """sleeping.""" - STOPPED = "stopped" + STOPPED: Final = "stopped" """stopped.""" - DEFUNCT = "defunct" + DEFUNCT: Final = "defunct" """defunct.""" @@ -205,11 +192,11 @@ class SystemProcessStatusValues(Enum): reason="The attribute system.processes.status is deprecated - Replaced by `system.process.status`" ) class SystemProcessesStatusValues(Enum): - RUNNING = "running" + RUNNING: Final = "running" """running.""" - SLEEPING = "sleeping" + SLEEPING: Final = "sleeping" """sleeping.""" - STOPPED = "stopped" + STOPPED: Final = "stopped" """stopped.""" - DEFUNCT = "defunct" + DEFUNCT: Final = "defunct" """defunct.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/telemetry_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/telemetry_attributes.py index b7ac5fac6c8..598704699ca 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/telemetry_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/telemetry_attributes.py @@ -12,34 +12,30 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final from deprecated import deprecated -TELEMETRY_DISTRO_NAME = "telemetry.distro.name" +TELEMETRY_DISTRO_NAME: Final = "telemetry.distro.name" """ The name of the auto instrumentation agent or distribution, if used. Note: Official auto instrumentation agents and distributions SHOULD set the `telemetry.distro.name` attribute to a string starting with `opentelemetry-`, e.g. `opentelemetry-java-instrumentation`. """ - -TELEMETRY_DISTRO_VERSION = "telemetry.distro.version" +TELEMETRY_DISTRO_VERSION: Final = "telemetry.distro.version" """ The version string of the auto instrumentation agent or distribution, if used. """ - -TELEMETRY_SDK_LANGUAGE = "telemetry.sdk.language" +TELEMETRY_SDK_LANGUAGE: Final = "telemetry.sdk.language" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TELEMETRY_SDK_LANGUAGE`. """ - -TELEMETRY_SDK_NAME = "telemetry.sdk.name" +TELEMETRY_SDK_NAME: Final = "telemetry.sdk.name" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TELEMETRY_SDK_NAME`. """ - -TELEMETRY_SDK_VERSION = "telemetry.sdk.version" +TELEMETRY_SDK_VERSION: Final = "telemetry.sdk.version" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TELEMETRY_SDK_VERSION`. """ @@ -49,27 +45,27 @@ reason="Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues`." ) class TelemetrySdkLanguageValues(Enum): - CPP = "cpp" + CPP: Final = "cpp" """cpp.""" - DOTNET = "dotnet" + DOTNET: Final = "dotnet" """dotnet.""" - ERLANG = "erlang" + ERLANG: Final = "erlang" """erlang.""" - GO = "go" + GO: Final = "go" """go.""" - JAVA = "java" + JAVA: Final = "java" """java.""" - NODEJS = "nodejs" + NODEJS: Final = "nodejs" """nodejs.""" - PHP = "php" + PHP: Final = "php" """php.""" - PYTHON = "python" + PYTHON: Final = "python" """python.""" - RUBY = "ruby" + RUBY: Final = "ruby" """ruby.""" - RUST = "rust" + RUST: Final = "rust" """rust.""" - SWIFT = "swift" + SWIFT: Final = "swift" """swift.""" - WEBJS = "webjs" + WEBJS: Final = "webjs" """webjs.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/thread_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/thread_attributes.py index cd68db81977..7e3d6ea3674 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/thread_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/thread_attributes.py @@ -12,13 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -THREAD_ID = "thread.id" +THREAD_ID: Final = "thread.id" """ Current "managed" thread ID (as opposed to OS thread ID). """ - -THREAD_NAME = "thread.name" +THREAD_NAME: Final = "thread.name" """ Current thread name. """ 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 2abaa8cd600..d644875f022 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 @@ -12,158 +12,130 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -TLS_CIPHER = "tls.cipher" +TLS_CIPHER: Final = "tls.cipher" """ String indicating the [cipher](https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5) used during the current connection. Note: The values allowed for `tls.cipher` MUST be one of the `Descriptions` of the [registered TLS Cipher Suits](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#table-tls-parameters-4). """ - -TLS_CLIENT_CERTIFICATE = "tls.client.certificate" +TLS_CLIENT_CERTIFICATE: Final = "tls.client.certificate" """ PEM-encoded stand-alone certificate offered by the client. This is usually mutually-exclusive of `client.certificate_chain` since this value also exists in that list. """ - -TLS_CLIENT_CERTIFICATE_CHAIN = "tls.client.certificate_chain" +TLS_CLIENT_CERTIFICATE_CHAIN: Final = "tls.client.certificate_chain" """ Array of PEM-encoded certificates that make up the certificate chain offered by the client. This is usually mutually-exclusive of `client.certificate` since that value should be the first certificate in the chain. """ - -TLS_CLIENT_HASH_MD5 = "tls.client.hash.md5" +TLS_CLIENT_HASH_MD5: Final = "tls.client.hash.md5" """ Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the client. For consistency with other hash values, this value should be formatted as an uppercase hash. """ - -TLS_CLIENT_HASH_SHA1 = "tls.client.hash.sha1" +TLS_CLIENT_HASH_SHA1: Final = "tls.client.hash.sha1" """ Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by the client. For consistency with other hash values, this value should be formatted as an uppercase hash. """ - -TLS_CLIENT_HASH_SHA256 = "tls.client.hash.sha256" +TLS_CLIENT_HASH_SHA256: Final = "tls.client.hash.sha256" """ Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by the client. For consistency with other hash values, this value should be formatted as an uppercase hash. """ - -TLS_CLIENT_ISSUER = "tls.client.issuer" +TLS_CLIENT_ISSUER: Final = "tls.client.issuer" """ Distinguished name of [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of the issuer of the x.509 certificate presented by the client. """ - -TLS_CLIENT_JA3 = "tls.client.ja3" +TLS_CLIENT_JA3: Final = "tls.client.ja3" """ A hash that identifies clients based on how they perform an SSL/TLS handshake. """ - -TLS_CLIENT_NOT_AFTER = "tls.client.not_after" +TLS_CLIENT_NOT_AFTER: Final = "tls.client.not_after" """ Date/Time indicating when client certificate is no longer considered valid. """ - -TLS_CLIENT_NOT_BEFORE = "tls.client.not_before" +TLS_CLIENT_NOT_BEFORE: Final = "tls.client.not_before" """ Date/Time indicating when client certificate is first considered valid. """ - -TLS_CLIENT_SERVER_NAME = "tls.client.server_name" +TLS_CLIENT_SERVER_NAME: Final = "tls.client.server_name" """ Also called an SNI, this tells the server which hostname to which the client is attempting to connect to. """ - -TLS_CLIENT_SUBJECT = "tls.client.subject" +TLS_CLIENT_SUBJECT: Final = "tls.client.subject" """ Distinguished name of subject of the x.509 certificate presented by the client. """ - -TLS_CLIENT_SUPPORTED_CIPHERS = "tls.client.supported_ciphers" +TLS_CLIENT_SUPPORTED_CIPHERS: Final = "tls.client.supported_ciphers" """ Array of ciphers offered by the client during the client hello. """ - -TLS_CURVE = "tls.curve" +TLS_CURVE: Final = "tls.curve" """ String indicating the curve used for the given cipher, when applicable. """ - -TLS_ESTABLISHED = "tls.established" +TLS_ESTABLISHED: Final = "tls.established" """ Boolean flag indicating if the TLS negotiation was successful and transitioned to an encrypted tunnel. """ - -TLS_NEXT_PROTOCOL = "tls.next_protocol" +TLS_NEXT_PROTOCOL: Final = "tls.next_protocol" """ String indicating the protocol being tunneled. Per the values in the [IANA registry](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids), this string should be lower case. """ - -TLS_PROTOCOL_NAME = "tls.protocol.name" +TLS_PROTOCOL_NAME: Final = "tls.protocol.name" """ Normalized lowercase protocol name parsed from original string of the negotiated [SSL/TLS protocol version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES). """ - -TLS_PROTOCOL_VERSION = "tls.protocol.version" +TLS_PROTOCOL_VERSION: Final = "tls.protocol.version" """ Numeric part of the version parsed from the original string of the negotiated [SSL/TLS protocol version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES). """ - -TLS_RESUMED = "tls.resumed" +TLS_RESUMED: Final = "tls.resumed" """ Boolean flag indicating if this TLS connection was resumed from an existing TLS negotiation. """ - -TLS_SERVER_CERTIFICATE = "tls.server.certificate" +TLS_SERVER_CERTIFICATE: Final = "tls.server.certificate" """ PEM-encoded stand-alone certificate offered by the server. This is usually mutually-exclusive of `server.certificate_chain` since this value also exists in that list. """ - -TLS_SERVER_CERTIFICATE_CHAIN = "tls.server.certificate_chain" +TLS_SERVER_CERTIFICATE_CHAIN: Final = "tls.server.certificate_chain" """ Array of PEM-encoded certificates that make up the certificate chain offered by the server. This is usually mutually-exclusive of `server.certificate` since that value should be the first certificate in the chain. """ - -TLS_SERVER_HASH_MD5 = "tls.server.hash.md5" +TLS_SERVER_HASH_MD5: Final = "tls.server.hash.md5" """ Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the server. For consistency with other hash values, this value should be formatted as an uppercase hash. """ - -TLS_SERVER_HASH_SHA1 = "tls.server.hash.sha1" +TLS_SERVER_HASH_SHA1: Final = "tls.server.hash.sha1" """ Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by the server. For consistency with other hash values, this value should be formatted as an uppercase hash. """ - -TLS_SERVER_HASH_SHA256 = "tls.server.hash.sha256" +TLS_SERVER_HASH_SHA256: Final = "tls.server.hash.sha256" """ Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by the server. For consistency with other hash values, this value should be formatted as an uppercase hash. """ - -TLS_SERVER_ISSUER = "tls.server.issuer" +TLS_SERVER_ISSUER: Final = "tls.server.issuer" """ Distinguished name of [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of the issuer of the x.509 certificate presented by the client. """ - -TLS_SERVER_JA3S = "tls.server.ja3s" +TLS_SERVER_JA3S: Final = "tls.server.ja3s" """ A hash that identifies servers based on how they perform an SSL/TLS handshake. """ - -TLS_SERVER_NOT_AFTER = "tls.server.not_after" +TLS_SERVER_NOT_AFTER: Final = "tls.server.not_after" """ Date/Time indicating when server certificate is no longer considered valid. """ - -TLS_SERVER_NOT_BEFORE = "tls.server.not_before" +TLS_SERVER_NOT_BEFORE: Final = "tls.server.not_before" """ Date/Time indicating when server certificate is first considered valid. """ - -TLS_SERVER_SUBJECT = "tls.server.subject" +TLS_SERVER_SUBJECT: Final = "tls.server.subject" """ Distinguished name of subject of the x.509 certificate presented by the server. """ class TlsProtocolNameValues(Enum): - SSL = "ssl" + SSL: Final = "ssl" """ssl.""" - TLS = "tls" + TLS: Final = "tls" """tls.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/url_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/url_attributes.py index 6646f2e68d7..1dcbd8a648f 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/url_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/url_attributes.py @@ -12,69 +12,59 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -URL_DOMAIN = "url.domain" +URL_DOMAIN: Final = "url.domain" """ Domain extracted from the `url.full`, such as "opentelemetry.io". Note: In some cases a URL may refer to an IP and/or port directly, without a domain name. In this case, the IP address would go to the domain field. If the URL contains a [literal IPv6 address](https://www.rfc-editor.org/rfc/rfc2732#section-2) enclosed by `[` and `]`, the `[` and `]` characters should also be captured in the domain field. """ - -URL_EXTENSION = "url.extension" +URL_EXTENSION: Final = "url.extension" """ The file extension extracted from the `url.full`, excluding the leading dot. Note: The file extension is only set if it exists, as not every url has a file extension. When the file name has multiple extensions `example.tar.gz`, only the last one should be captured `gz`, not `tar.gz`. """ - -URL_FRAGMENT = "url.fragment" +URL_FRAGMENT: Final = "url.fragment" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.url_attributes.URL_FRAGMENT`. """ - -URL_FULL = "url.full" +URL_FULL: Final = "url.full" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.url_attributes.URL_FULL`. """ - -URL_ORIGINAL = "url.original" +URL_ORIGINAL: Final = "url.original" """ Unmodified original URL as seen in the event source. Note: In network monitoring, the observed URL may be a full URL, whereas in access logs, the URL is often just represented as a path. This field is meant to represent the URL as it was observed, complete or not. `url.original` might contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case password and username SHOULD NOT be redacted and attribute's value SHOULD remain the same. """ - -URL_PATH = "url.path" +URL_PATH: Final = "url.path" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.url_attributes.URL_PATH`. """ - -URL_PORT = "url.port" +URL_PORT: Final = "url.port" """ Port extracted from the `url.full`. """ - -URL_QUERY = "url.query" +URL_QUERY: Final = "url.query" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.url_attributes.URL_QUERY`. """ - -URL_REGISTERED_DOMAIN = "url.registered_domain" +URL_REGISTERED_DOMAIN: Final = "url.registered_domain" """ The highest registered url domain, stripped of the subdomain. Note: This value can be determined precisely with the [public suffix list](http://publicsuffix.org). For example, the registered domain for `foo.example.com` is `example.com`. Trying to approximate this by simply taking the last two labels will not work well for TLDs such as `co.uk`. """ - -URL_SCHEME = "url.scheme" +URL_SCHEME: Final = "url.scheme" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.url_attributes.URL_SCHEME`. """ - -URL_SUBDOMAIN = "url.subdomain" +URL_SUBDOMAIN: Final = "url.subdomain" """ The subdomain portion of a fully qualified domain name includes all of the names except the host name under the registered_domain. In a partially qualified domain, or if the qualification level of the full name cannot be determined, subdomain contains all of the names below the registered domain. Note: The subdomain portion of `www.east.mydomain.co.uk` is `east`. If the domain has multiple levels of subdomain, such as `sub2.sub1.example.com`, the subdomain field should contain `sub2.sub1`, with no trailing period. """ - -URL_TOP_LEVEL_DOMAIN = "url.top_level_domain" +URL_TOP_LEVEL_DOMAIN: Final = "url.top_level_domain" """ The effective top level domain (eTLD), also known as the domain suffix, is the last part of the domain name. For example, the top level domain for example.com is `com`. Note: This value can be determined precisely with the [public suffix list](http://publicsuffix.org). diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/user_agent_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/user_agent_attributes.py index 2237a2d3f11..62a7a20fa71 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/user_agent_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/user_agent_attributes.py @@ -12,19 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -USER_AGENT_NAME = "user_agent.name" +USER_AGENT_NAME: Final = "user_agent.name" """ Name of the user-agent extracted from original. Usually refers to the browser's name. Note: [Example](https://www.whatsmyua.info) of extracting browser's name from original string. In the case of using a user-agent for non-browser products, such as microservices with multiple names/versions inside the `user_agent.original`, the most significant name SHOULD be selected. In such a scenario it should align with `user_agent.version`. """ - -USER_AGENT_ORIGINAL = "user_agent.original" +USER_AGENT_ORIGINAL: Final = "user_agent.original" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.user_agent_attributes.USER_AGENT_ORIGINAL`. """ - -USER_AGENT_VERSION = "user_agent.version" +USER_AGENT_VERSION: Final = "user_agent.version" """ Version of the user-agent extracted from original. Usually refers to the browser's version. Note: [Example](https://www.whatsmyua.info) of extracting browser's version from original string. In the case of using a user-agent for non-browser products, such as microservices with multiple names/versions inside the `user_agent.original`, the most significant version SHOULD be selected. In such a scenario it should align with `user_agent.name`. diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/webengine_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/webengine_attributes.py index e29971b0325..c932310a5cd 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/webengine_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/webengine_attributes.py @@ -12,18 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -WEBENGINE_DESCRIPTION = "webengine.description" +WEBENGINE_DESCRIPTION: Final = "webengine.description" """ Additional description of the web engine (e.g. detailed version and edition information). """ - -WEBENGINE_NAME = "webengine.name" +WEBENGINE_NAME: Final = "webengine.name" """ The name of the web engine. """ - -WEBENGINE_VERSION = "webengine.version" +WEBENGINE_VERSION: Final = "webengine.version" """ The version of the web engine. """ 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 d4c8437ece8..a57056d8ee5 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,11 @@ # limitations under the License. +from typing import Final + from opentelemetry.metrics import Counter, Meter -CONTAINER_CPU_TIME = "container.cpu.time" +CONTAINER_CPU_TIME: Final = "container.cpu.time" """ Total CPU time consumed Instrument: counter @@ -33,7 +35,7 @@ def create_container_cpu_time(meter: Meter) -> Counter: ) -CONTAINER_DISK_IO = "container.disk.io" +CONTAINER_DISK_IO: Final = "container.disk.io" """ Disk bytes for the container Instrument: counter @@ -51,7 +53,7 @@ def create_container_disk_io(meter: Meter) -> Counter: ) -CONTAINER_MEMORY_USAGE = "container.memory.usage" +CONTAINER_MEMORY_USAGE: Final = "container.memory.usage" """ Memory usage of the container Instrument: counter @@ -69,7 +71,7 @@ def create_container_memory_usage(meter: Meter) -> Counter: ) -CONTAINER_NETWORK_IO = "container.network.io" +CONTAINER_NETWORK_IO: Final = "container.network.io" """ Network bytes for the container Instrument: counter 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 63a86e91c14..60e28ec9f3f 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 @@ -13,9 +13,11 @@ # limitations under the License. +from typing import Final + from opentelemetry.metrics import Counter, Histogram, Meter, UpDownCounter -DB_CLIENT_CONNECTIONS_CREATE_TIME = "db.client.connections.create_time" +DB_CLIENT_CONNECTIONS_CREATE_TIME: Final = "db.client.connections.create_time" """ The time it took to create a new connection Instrument: histogram @@ -32,7 +34,7 @@ def create_db_client_connections_create_time(meter: Meter) -> Histogram: ) -DB_CLIENT_CONNECTIONS_IDLE_MAX = "db.client.connections.idle.max" +DB_CLIENT_CONNECTIONS_IDLE_MAX: Final = "db.client.connections.idle.max" """ The maximum number of idle open connections allowed Instrument: updowncounter @@ -49,7 +51,7 @@ def create_db_client_connections_idle_max(meter: Meter) -> UpDownCounter: ) -DB_CLIENT_CONNECTIONS_IDLE_MIN = "db.client.connections.idle.min" +DB_CLIENT_CONNECTIONS_IDLE_MIN: Final = "db.client.connections.idle.min" """ The minimum number of idle open connections allowed Instrument: updowncounter @@ -66,7 +68,7 @@ def create_db_client_connections_idle_min(meter: Meter) -> UpDownCounter: ) -DB_CLIENT_CONNECTIONS_MAX = "db.client.connections.max" +DB_CLIENT_CONNECTIONS_MAX: Final = "db.client.connections.max" """ The maximum number of open connections allowed Instrument: updowncounter @@ -83,7 +85,7 @@ def create_db_client_connections_max(meter: Meter) -> UpDownCounter: ) -DB_CLIENT_CONNECTIONS_PENDING_REQUESTS = ( +DB_CLIENT_CONNECTIONS_PENDING_REQUESTS: Final = ( "db.client.connections.pending_requests" ) """ @@ -104,7 +106,7 @@ def create_db_client_connections_pending_requests( ) -DB_CLIENT_CONNECTIONS_TIMEOUTS = "db.client.connections.timeouts" +DB_CLIENT_CONNECTIONS_TIMEOUTS: Final = "db.client.connections.timeouts" """ The number of connection timeouts that have occurred trying to obtain a connection from the pool Instrument: counter @@ -121,7 +123,7 @@ def create_db_client_connections_timeouts(meter: Meter) -> Counter: ) -DB_CLIENT_CONNECTIONS_USAGE = "db.client.connections.usage" +DB_CLIENT_CONNECTIONS_USAGE: Final = "db.client.connections.usage" """ The number of connections that are currently in state described by the `state` attribute Instrument: updowncounter @@ -138,7 +140,7 @@ def create_db_client_connections_usage(meter: Meter) -> UpDownCounter: ) -DB_CLIENT_CONNECTIONS_USE_TIME = "db.client.connections.use_time" +DB_CLIENT_CONNECTIONS_USE_TIME: Final = "db.client.connections.use_time" """ The time between borrowing a connection and returning it to the pool Instrument: histogram @@ -155,7 +157,7 @@ def create_db_client_connections_use_time(meter: Meter) -> Histogram: ) -DB_CLIENT_CONNECTIONS_WAIT_TIME = "db.client.connections.wait_time" +DB_CLIENT_CONNECTIONS_WAIT_TIME: Final = "db.client.connections.wait_time" """ The time it took to obtain an open connection from the pool Instrument: histogram diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/dns_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/dns_metrics.py index 200b309c95e..8d818c0a2c2 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/dns_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/dns_metrics.py @@ -13,9 +13,11 @@ # limitations under the License. +from typing import Final + from opentelemetry.metrics import Histogram, Meter -DNS_LOOKUP_DURATION = "dns.lookup.duration" +DNS_LOOKUP_DURATION: Final = "dns.lookup.duration" """ Measures the time taken to perform a DNS lookup Instrument: histogram diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/faas_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/faas_metrics.py index f93e707c009..f3d0eed463c 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/faas_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/faas_metrics.py @@ -13,9 +13,11 @@ # limitations under the License. +from typing import Final + from opentelemetry.metrics import Counter, Histogram, Meter -FAAS_COLDSTARTS = "faas.coldstarts" +FAAS_COLDSTARTS: Final = "faas.coldstarts" """ Number of invocation cold starts Instrument: counter @@ -32,7 +34,7 @@ def create_faas_coldstarts(meter: Meter) -> Counter: ) -FAAS_CPU_USAGE = "faas.cpu_usage" +FAAS_CPU_USAGE: Final = "faas.cpu_usage" """ Distribution of CPU usage per invocation Instrument: histogram @@ -49,7 +51,7 @@ def create_faas_cpu_usage(meter: Meter) -> Histogram: ) -FAAS_ERRORS = "faas.errors" +FAAS_ERRORS: Final = "faas.errors" """ Number of invocation errors Instrument: counter @@ -66,7 +68,7 @@ def create_faas_errors(meter: Meter) -> Counter: ) -FAAS_INIT_DURATION = "faas.init_duration" +FAAS_INIT_DURATION: Final = "faas.init_duration" """ Measures the duration of the function's initialization, such as a cold start Instrument: histogram @@ -83,7 +85,7 @@ def create_faas_init_duration(meter: Meter) -> Histogram: ) -FAAS_INVOCATIONS = "faas.invocations" +FAAS_INVOCATIONS: Final = "faas.invocations" """ Number of successful invocations Instrument: counter @@ -100,7 +102,7 @@ def create_faas_invocations(meter: Meter) -> Counter: ) -FAAS_INVOKE_DURATION = "faas.invoke_duration" +FAAS_INVOKE_DURATION: Final = "faas.invoke_duration" """ Measures the duration of the function's logic execution Instrument: histogram @@ -117,7 +119,7 @@ def create_faas_invoke_duration(meter: Meter) -> Histogram: ) -FAAS_MEM_USAGE = "faas.mem_usage" +FAAS_MEM_USAGE: Final = "faas.mem_usage" """ Distribution of max memory usage per invocation Instrument: histogram @@ -134,7 +136,7 @@ def create_faas_mem_usage(meter: Meter) -> Histogram: ) -FAAS_NET_IO = "faas.net_io" +FAAS_NET_IO: Final = "faas.net_io" """ Distribution of net I/O usage per invocation Instrument: histogram @@ -151,7 +153,7 @@ def create_faas_net_io(meter: Meter) -> Histogram: ) -FAAS_TIMEOUTS = "faas.timeouts" +FAAS_TIMEOUTS: Final = "faas.timeouts" """ Number of invocation timeouts Instrument: counter diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py index 7852a395874..3e7ee799ddc 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py @@ -13,9 +13,11 @@ # limitations under the License. +from typing import Final + from opentelemetry.metrics import Histogram, Meter, UpDownCounter -HTTP_CLIENT_ACTIVE_REQUESTS = "http.client.active_requests" +HTTP_CLIENT_ACTIVE_REQUESTS: Final = "http.client.active_requests" """ Number of active HTTP requests Instrument: updowncounter @@ -32,7 +34,7 @@ def create_http_client_active_requests(meter: Meter) -> UpDownCounter: ) -HTTP_CLIENT_CONNECTION_DURATION = "http.client.connection.duration" +HTTP_CLIENT_CONNECTION_DURATION: Final = "http.client.connection.duration" """ The duration of the successfully established outbound HTTP connections Instrument: histogram @@ -49,7 +51,7 @@ def create_http_client_connection_duration(meter: Meter) -> Histogram: ) -HTTP_CLIENT_OPEN_CONNECTIONS = "http.client.open_connections" +HTTP_CLIENT_OPEN_CONNECTIONS: Final = "http.client.open_connections" """ Number of outbound HTTP connections that are currently active or idle on the client Instrument: updowncounter @@ -66,7 +68,7 @@ def create_http_client_open_connections(meter: Meter) -> UpDownCounter: ) -HTTP_CLIENT_REQUEST_BODY_SIZE = "http.client.request.body.size" +HTTP_CLIENT_REQUEST_BODY_SIZE: Final = "http.client.request.body.size" """ Size of HTTP client request bodies Instrument: histogram @@ -84,7 +86,7 @@ def create_http_client_request_body_size(meter: Meter) -> Histogram: ) -HTTP_CLIENT_REQUEST_DURATION = "http.client.request.duration" +HTTP_CLIENT_REQUEST_DURATION: Final = "http.client.request.duration" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.metrics.http_metrics.HTTP_CLIENT_REQUEST_DURATION`. """ @@ -99,7 +101,7 @@ def create_http_client_request_duration(meter: Meter) -> Histogram: ) -HTTP_CLIENT_RESPONSE_BODY_SIZE = "http.client.response.body.size" +HTTP_CLIENT_RESPONSE_BODY_SIZE: Final = "http.client.response.body.size" """ Size of HTTP client response bodies Instrument: histogram @@ -117,7 +119,7 @@ def create_http_client_response_body_size(meter: Meter) -> Histogram: ) -HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests" +HTTP_SERVER_ACTIVE_REQUESTS: Final = "http.server.active_requests" """ Number of active HTTP server requests Instrument: updowncounter @@ -134,7 +136,7 @@ def create_http_server_active_requests(meter: Meter) -> UpDownCounter: ) -HTTP_SERVER_REQUEST_BODY_SIZE = "http.server.request.body.size" +HTTP_SERVER_REQUEST_BODY_SIZE: Final = "http.server.request.body.size" """ Size of HTTP server request bodies Instrument: histogram @@ -152,7 +154,7 @@ def create_http_server_request_body_size(meter: Meter) -> Histogram: ) -HTTP_SERVER_REQUEST_DURATION = "http.server.request.duration" +HTTP_SERVER_REQUEST_DURATION: Final = "http.server.request.duration" """ Deprecated in favor of stable :py:const:`opentelemetry.semconv.metrics.http_metrics.HTTP_SERVER_REQUEST_DURATION`. """ @@ -167,7 +169,7 @@ def create_http_server_request_duration(meter: Meter) -> Histogram: ) -HTTP_SERVER_RESPONSE_BODY_SIZE = "http.server.response.body.size" +HTTP_SERVER_RESPONSE_BODY_SIZE: Final = "http.server.response.body.size" """ Size of HTTP server response bodies Instrument: histogram 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 ac3cb549ab5..0b1da4c13a9 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 @@ -13,9 +13,11 @@ # limitations under the License. +from typing import Final + from opentelemetry.metrics import Counter, Histogram, Meter -MESSAGING_PROCESS_DURATION = "messaging.process.duration" +MESSAGING_PROCESS_DURATION: Final = "messaging.process.duration" """ Measures the duration of process operation Instrument: histogram @@ -32,7 +34,7 @@ def create_messaging_process_duration(meter: Meter) -> Histogram: ) -MESSAGING_PROCESS_MESSAGES = "messaging.process.messages" +MESSAGING_PROCESS_MESSAGES: Final = "messaging.process.messages" """ Measures the number of processed messages Instrument: counter @@ -49,7 +51,7 @@ def create_messaging_process_messages(meter: Meter) -> Counter: ) -MESSAGING_PUBLISH_DURATION = "messaging.publish.duration" +MESSAGING_PUBLISH_DURATION: Final = "messaging.publish.duration" """ Measures the duration of publish operation Instrument: histogram @@ -66,7 +68,7 @@ def create_messaging_publish_duration(meter: Meter) -> Histogram: ) -MESSAGING_PUBLISH_MESSAGES = "messaging.publish.messages" +MESSAGING_PUBLISH_MESSAGES: Final = "messaging.publish.messages" """ Measures the number of published messages Instrument: counter @@ -83,7 +85,7 @@ def create_messaging_publish_messages(meter: Meter) -> Counter: ) -MESSAGING_RECEIVE_DURATION = "messaging.receive.duration" +MESSAGING_RECEIVE_DURATION: Final = "messaging.receive.duration" """ Measures the duration of receive operation Instrument: histogram @@ -100,7 +102,7 @@ def create_messaging_receive_duration(meter: Meter) -> Histogram: ) -MESSAGING_RECEIVE_MESSAGES = "messaging.receive.messages" +MESSAGING_RECEIVE_MESSAGES: Final = "messaging.receive.messages" """ Measures the number of received messages Instrument: counter 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 8d6e7fc75c4..09d99824fd0 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 @@ -13,7 +13,7 @@ # limitations under the License. -from typing import Callable, Sequence +from typing import Callable, Final, Sequence from opentelemetry.metrics import ( Counter, @@ -22,7 +22,7 @@ UpDownCounter, ) -PROCESS_CONTEXT_SWITCHES = "process.context_switches" +PROCESS_CONTEXT_SWITCHES: Final = "process.context_switches" """ Number of times the process has been context switched Instrument: counter @@ -39,7 +39,7 @@ def create_process_context_switches(meter: Meter) -> Counter: ) -PROCESS_CPU_TIME = "process.cpu.time" +PROCESS_CPU_TIME: Final = "process.cpu.time" """ Total CPU seconds broken down by different states Instrument: counter @@ -56,7 +56,7 @@ def create_process_cpu_time(meter: Meter) -> Counter: ) -PROCESS_CPU_UTILIZATION = "process.cpu.utilization" +PROCESS_CPU_UTILIZATION: Final = "process.cpu.utilization" """ Difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs available to the process Instrument: gauge @@ -76,7 +76,7 @@ def create_process_cpu_utilization( ) -PROCESS_DISK_IO = "process.disk.io" +PROCESS_DISK_IO: Final = "process.disk.io" """ Disk bytes transferred Instrument: counter @@ -93,7 +93,7 @@ def create_process_disk_io(meter: Meter) -> Counter: ) -PROCESS_MEMORY_USAGE = "process.memory.usage" +PROCESS_MEMORY_USAGE: Final = "process.memory.usage" """ The amount of physical memory in use Instrument: updowncounter @@ -110,7 +110,7 @@ def create_process_memory_usage(meter: Meter) -> UpDownCounter: ) -PROCESS_MEMORY_VIRTUAL = "process.memory.virtual" +PROCESS_MEMORY_VIRTUAL: Final = "process.memory.virtual" """ The amount of committed virtual memory Instrument: updowncounter @@ -127,7 +127,7 @@ def create_process_memory_virtual(meter: Meter) -> UpDownCounter: ) -PROCESS_NETWORK_IO = "process.network.io" +PROCESS_NETWORK_IO: Final = "process.network.io" """ Network bytes transferred Instrument: counter @@ -144,7 +144,9 @@ def create_process_network_io(meter: Meter) -> Counter: ) -PROCESS_OPEN_FILE_DESCRIPTOR_COUNT = "process.open_file_descriptor.count" +PROCESS_OPEN_FILE_DESCRIPTOR_COUNT: Final = ( + "process.open_file_descriptor.count" +) """ Number of file descriptors in use by the process Instrument: updowncounter @@ -161,7 +163,7 @@ def create_process_open_file_descriptor_count(meter: Meter) -> UpDownCounter: ) -PROCESS_PAGING_FAULTS = "process.paging.faults" +PROCESS_PAGING_FAULTS: Final = "process.paging.faults" """ Number of page faults the process has made Instrument: counter @@ -178,7 +180,7 @@ def create_process_paging_faults(meter: Meter) -> Counter: ) -PROCESS_THREAD_COUNT = "process.thread.count" +PROCESS_THREAD_COUNT: Final = "process.thread.count" """ Process threads count Instrument: updowncounter diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/rpc_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/rpc_metrics.py index eb2f5edd758..1fa9ccfdf95 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/rpc_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/rpc_metrics.py @@ -13,9 +13,11 @@ # limitations under the License. +from typing import Final + from opentelemetry.metrics import Histogram, Meter -RPC_CLIENT_DURATION = "rpc.client.duration" +RPC_CLIENT_DURATION: Final = "rpc.client.duration" """ Measures the duration of outbound RPC Instrument: histogram @@ -36,7 +38,7 @@ def create_rpc_client_duration(meter: Meter) -> Histogram: ) -RPC_CLIENT_REQUEST_SIZE = "rpc.client.request.size" +RPC_CLIENT_REQUEST_SIZE: Final = "rpc.client.request.size" """ Measures the size of RPC request messages (uncompressed) Instrument: histogram @@ -54,7 +56,7 @@ def create_rpc_client_request_size(meter: Meter) -> Histogram: ) -RPC_CLIENT_REQUESTS_PER_RPC = "rpc.client.requests_per_rpc" +RPC_CLIENT_REQUESTS_PER_RPC: Final = "rpc.client.requests_per_rpc" """ Measures the number of messages received per RPC Instrument: histogram @@ -74,7 +76,7 @@ def create_rpc_client_requests_per_rpc(meter: Meter) -> Histogram: ) -RPC_CLIENT_RESPONSE_SIZE = "rpc.client.response.size" +RPC_CLIENT_RESPONSE_SIZE: Final = "rpc.client.response.size" """ Measures the size of RPC response messages (uncompressed) Instrument: histogram @@ -92,7 +94,7 @@ def create_rpc_client_response_size(meter: Meter) -> Histogram: ) -RPC_CLIENT_RESPONSES_PER_RPC = "rpc.client.responses_per_rpc" +RPC_CLIENT_RESPONSES_PER_RPC: Final = "rpc.client.responses_per_rpc" """ Measures the number of messages sent per RPC Instrument: histogram @@ -112,7 +114,7 @@ def create_rpc_client_responses_per_rpc(meter: Meter) -> Histogram: ) -RPC_SERVER_DURATION = "rpc.server.duration" +RPC_SERVER_DURATION: Final = "rpc.server.duration" """ Measures the duration of inbound RPC Instrument: histogram @@ -133,7 +135,7 @@ def create_rpc_server_duration(meter: Meter) -> Histogram: ) -RPC_SERVER_REQUEST_SIZE = "rpc.server.request.size" +RPC_SERVER_REQUEST_SIZE: Final = "rpc.server.request.size" """ Measures the size of RPC request messages (uncompressed) Instrument: histogram @@ -151,7 +153,7 @@ def create_rpc_server_request_size(meter: Meter) -> Histogram: ) -RPC_SERVER_REQUESTS_PER_RPC = "rpc.server.requests_per_rpc" +RPC_SERVER_REQUESTS_PER_RPC: Final = "rpc.server.requests_per_rpc" """ Measures the number of messages received per RPC Instrument: histogram @@ -171,7 +173,7 @@ def create_rpc_server_requests_per_rpc(meter: Meter) -> Histogram: ) -RPC_SERVER_RESPONSE_SIZE = "rpc.server.response.size" +RPC_SERVER_RESPONSE_SIZE: Final = "rpc.server.response.size" """ Measures the size of RPC response messages (uncompressed) Instrument: histogram @@ -189,7 +191,7 @@ def create_rpc_server_response_size(meter: Meter) -> Histogram: ) -RPC_SERVER_RESPONSES_PER_RPC = "rpc.server.responses_per_rpc" +RPC_SERVER_RESPONSES_PER_RPC: Final = "rpc.server.responses_per_rpc" """ Measures the number of messages sent per RPC Instrument: histogram 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 72fb32649ca..3cf60e142bb 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 @@ -13,7 +13,7 @@ # limitations under the License. -from typing import Callable, Sequence +from typing import Callable, Final, Sequence from opentelemetry.metrics import ( Counter, @@ -22,7 +22,7 @@ UpDownCounter, ) -SYSTEM_CPU_FREQUENCY = "system.cpu.frequency" +SYSTEM_CPU_FREQUENCY: Final = "system.cpu.frequency" """ Reports the current frequency of the CPU in Hz Instrument: gauge @@ -42,7 +42,7 @@ def create_system_cpu_frequency( ) -SYSTEM_CPU_LOGICAL_COUNT = "system.cpu.logical.count" +SYSTEM_CPU_LOGICAL_COUNT: Final = "system.cpu.logical.count" """ Reports the number of logical (virtual) processor cores created by the operating system to manage multitasking Instrument: updowncounter @@ -59,7 +59,7 @@ def create_system_cpu_logical_count(meter: Meter) -> UpDownCounter: ) -SYSTEM_CPU_PHYSICAL_COUNT = "system.cpu.physical.count" +SYSTEM_CPU_PHYSICAL_COUNT: Final = "system.cpu.physical.count" """ Reports the number of actual physical processor cores on the hardware Instrument: updowncounter @@ -76,7 +76,7 @@ def create_system_cpu_physical_count(meter: Meter) -> UpDownCounter: ) -SYSTEM_CPU_TIME = "system.cpu.time" +SYSTEM_CPU_TIME: Final = "system.cpu.time" """ Seconds each logical CPU spent on each mode Instrument: counter @@ -93,7 +93,7 @@ def create_system_cpu_time(meter: Meter) -> Counter: ) -SYSTEM_CPU_UTILIZATION = "system.cpu.utilization" +SYSTEM_CPU_UTILIZATION: Final = "system.cpu.utilization" """ Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs Instrument: gauge @@ -113,7 +113,7 @@ def create_system_cpu_utilization( ) -SYSTEM_DISK_IO = "system.disk.io" +SYSTEM_DISK_IO: Final = "system.disk.io" """ Instrument: counter Unit: By @@ -128,7 +128,7 @@ def create_system_disk_io(meter: Meter) -> Counter: ) -SYSTEM_DISK_IO_TIME = "system.disk.io_time" +SYSTEM_DISK_IO_TIME: Final = "system.disk.io_time" """ Time disk spent activated Instrument: counter @@ -151,7 +151,7 @@ def create_system_disk_io_time(meter: Meter) -> Counter: ) -SYSTEM_DISK_MERGED = "system.disk.merged" +SYSTEM_DISK_MERGED: Final = "system.disk.merged" """ Instrument: counter Unit: {operation} @@ -166,7 +166,7 @@ def create_system_disk_merged(meter: Meter) -> Counter: ) -SYSTEM_DISK_OPERATION_TIME = "system.disk.operation_time" +SYSTEM_DISK_OPERATION_TIME: Final = "system.disk.operation_time" """ Sum of the time each operation took to complete Instrument: counter @@ -187,7 +187,7 @@ def create_system_disk_operation_time(meter: Meter) -> Counter: ) -SYSTEM_DISK_OPERATIONS = "system.disk.operations" +SYSTEM_DISK_OPERATIONS: Final = "system.disk.operations" """ Instrument: counter Unit: {operation} @@ -202,7 +202,7 @@ def create_system_disk_operations(meter: Meter) -> Counter: ) -SYSTEM_FILESYSTEM_USAGE = "system.filesystem.usage" +SYSTEM_FILESYSTEM_USAGE: Final = "system.filesystem.usage" """ Instrument: updowncounter Unit: By @@ -217,7 +217,7 @@ def create_system_filesystem_usage(meter: Meter) -> UpDownCounter: ) -SYSTEM_FILESYSTEM_UTILIZATION = "system.filesystem.utilization" +SYSTEM_FILESYSTEM_UTILIZATION: Final = "system.filesystem.utilization" """ Instrument: gauge Unit: 1 @@ -235,7 +235,7 @@ def create_system_filesystem_utilization( ) -SYSTEM_LINUX_MEMORY_AVAILABLE = "system.linux.memory.available" +SYSTEM_LINUX_MEMORY_AVAILABLE: Final = "system.linux.memory.available" """ An estimate of how much memory is available for starting new applications, without causing swapping Instrument: updowncounter @@ -257,7 +257,7 @@ def create_system_linux_memory_available(meter: Meter) -> UpDownCounter: ) -SYSTEM_MEMORY_LIMIT = "system.memory.limit" +SYSTEM_MEMORY_LIMIT: Final = "system.memory.limit" """ Total memory available in the system Instrument: updowncounter @@ -275,7 +275,7 @@ def create_system_memory_limit(meter: Meter) -> UpDownCounter: ) -SYSTEM_MEMORY_USAGE = "system.memory.usage" +SYSTEM_MEMORY_USAGE: Final = "system.memory.usage" """ Reports memory in use by state Instrument: updowncounter @@ -294,7 +294,7 @@ def create_system_memory_usage(meter: Meter) -> UpDownCounter: ) -SYSTEM_MEMORY_UTILIZATION = "system.memory.utilization" +SYSTEM_MEMORY_UTILIZATION: Final = "system.memory.utilization" """ Instrument: gauge Unit: 1 @@ -312,7 +312,7 @@ def create_system_memory_utilization( ) -SYSTEM_NETWORK_CONNECTIONS = "system.network.connections" +SYSTEM_NETWORK_CONNECTIONS: Final = "system.network.connections" """ Instrument: updowncounter Unit: {connection} @@ -327,7 +327,7 @@ def create_system_network_connections(meter: Meter) -> UpDownCounter: ) -SYSTEM_NETWORK_DROPPED = "system.network.dropped" +SYSTEM_NETWORK_DROPPED: Final = "system.network.dropped" """ Count of packets that are dropped or discarded even though there was no error Instrument: counter @@ -349,7 +349,7 @@ def create_system_network_dropped(meter: Meter) -> Counter: ) -SYSTEM_NETWORK_ERRORS = "system.network.errors" +SYSTEM_NETWORK_ERRORS: Final = "system.network.errors" """ Count of network errors detected Instrument: counter @@ -371,7 +371,7 @@ def create_system_network_errors(meter: Meter) -> Counter: ) -SYSTEM_NETWORK_IO = "system.network.io" +SYSTEM_NETWORK_IO: Final = "system.network.io" """ Instrument: counter Unit: By @@ -386,7 +386,7 @@ def create_system_network_io(meter: Meter) -> Counter: ) -SYSTEM_NETWORK_PACKETS = "system.network.packets" +SYSTEM_NETWORK_PACKETS: Final = "system.network.packets" """ Instrument: counter Unit: {packet} @@ -401,7 +401,7 @@ def create_system_network_packets(meter: Meter) -> Counter: ) -SYSTEM_PAGING_FAULTS = "system.paging.faults" +SYSTEM_PAGING_FAULTS: Final = "system.paging.faults" """ Instrument: counter Unit: {fault} @@ -416,7 +416,7 @@ def create_system_paging_faults(meter: Meter) -> Counter: ) -SYSTEM_PAGING_OPERATIONS = "system.paging.operations" +SYSTEM_PAGING_OPERATIONS: Final = "system.paging.operations" """ Instrument: counter Unit: {operation} @@ -431,7 +431,7 @@ def create_system_paging_operations(meter: Meter) -> Counter: ) -SYSTEM_PAGING_USAGE = "system.paging.usage" +SYSTEM_PAGING_USAGE: Final = "system.paging.usage" """ Unix swap or windows pagefile usage Instrument: updowncounter @@ -448,7 +448,7 @@ def create_system_paging_usage(meter: Meter) -> UpDownCounter: ) -SYSTEM_PAGING_UTILIZATION = "system.paging.utilization" +SYSTEM_PAGING_UTILIZATION: Final = "system.paging.utilization" """ Instrument: gauge Unit: 1 @@ -466,7 +466,7 @@ def create_system_paging_utilization( ) -SYSTEM_PROCESS_COUNT = "system.process.count" +SYSTEM_PROCESS_COUNT: Final = "system.process.count" """ Total number of processes in each state Instrument: updowncounter @@ -483,7 +483,7 @@ def create_system_process_count(meter: Meter) -> UpDownCounter: ) -SYSTEM_PROCESS_CREATED = "system.process.created" +SYSTEM_PROCESS_CREATED: Final = "system.process.created" """ Total number of processes created over uptime of the host Instrument: counter diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/client_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/client_attributes.py index 77c904c4920..4b2a1a1fc06 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/client_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/client_attributes.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -CLIENT_ADDRESS = "client.address" +CLIENT_ADDRESS: Final = "client.address" """ Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. Note: When observed from the server side, and when communicating through an intermediary, `client.address` SHOULD represent the client address behind any intermediaries, for example proxies, if it's available. """ - -CLIENT_PORT = "client.port" +CLIENT_PORT: Final = "client.port" """ Client port number. Note: When observed from the server side, and when communicating through an intermediary, `client.port` SHOULD represent the client port behind any intermediaries, for example proxies, if it's available. diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/error_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/error_attributes.py index 43d1bd8944b..c657ecb36f9 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/error_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/error_attributes.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -ERROR_TYPE = "error.type" +ERROR_TYPE: Final = "error.type" """ Describes a class of error the operation ended with. Note: The `error.type` SHOULD be predictable and SHOULD have low cardinality. @@ -37,5 +37,5 @@ class ErrorTypeValues(Enum): - OTHER = "_OTHER" + OTHER: Final = "_OTHER" """A fallback error value to be used when the instrumentation doesn't define a custom value.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py index 2d6be1e2bed..b343853b2f6 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -EXCEPTION_ESCAPED = "exception.escaped" +EXCEPTION_ESCAPED: Final = "exception.escaped" """ SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. Note: An exception is considered to have escaped (or left) the scope of a span, @@ -33,18 +34,15 @@ since the event might have been recorded at a time where it was not clear whether the exception will escape. """ - -EXCEPTION_MESSAGE = "exception.message" +EXCEPTION_MESSAGE: Final = "exception.message" """ The exception message. """ - -EXCEPTION_STACKTRACE = "exception.stacktrace" +EXCEPTION_STACKTRACE: Final = "exception.stacktrace" """ A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. """ - -EXCEPTION_TYPE = "exception.type" +EXCEPTION_TYPE: Final = "exception.type" """ The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/http_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/http_attributes.py index 337dbf06e22..6b5edff905a 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/http_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/http_attributes.py @@ -12,18 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -HTTP_REQUEST_HEADER_TEMPLATE = "http.request.header" +HTTP_REQUEST_HEADER_TEMPLATE: Final = "http.request.header" """ HTTP request headers, `` being the normalized HTTP Header name (lowercase), the value being the header values. Note: Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information. The `User-Agent` header is already captured in the `user_agent.original` attribute. Users MAY explicitly configure instrumentations to capture them even though it is not recommended. The attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers. """ - -HTTP_REQUEST_METHOD = "http.request.method" +HTTP_REQUEST_METHOD: Final = "http.request.method" """ HTTP request method. Note: HTTP request method value SHOULD be "known" to the instrumentation. @@ -41,32 +40,27 @@ Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent. Tracing instrumentations that do so, MUST also set `http.request.method_original` to the original value. """ - -HTTP_REQUEST_METHOD_ORIGINAL = "http.request.method_original" +HTTP_REQUEST_METHOD_ORIGINAL: Final = "http.request.method_original" """ Original HTTP method sent by the client in the request line. """ - -HTTP_REQUEST_RESEND_COUNT = "http.request.resend_count" +HTTP_REQUEST_RESEND_COUNT: Final = "http.request.resend_count" """ The ordinal number of request resending attempt (for any reason, including redirects). Note: The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other). """ - -HTTP_RESPONSE_HEADER_TEMPLATE = "http.response.header" +HTTP_RESPONSE_HEADER_TEMPLATE: Final = "http.response.header" """ HTTP response headers, `` being the normalized HTTP Header name (lowercase), the value being the header values. Note: Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information. Users MAY explicitly configure instrumentations to capture them even though it is not recommended. The attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers. """ - -HTTP_RESPONSE_STATUS_CODE = "http.response.status_code" +HTTP_RESPONSE_STATUS_CODE: Final = "http.response.status_code" """ [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). """ - -HTTP_ROUTE = "http.route" +HTTP_ROUTE: Final = "http.route" """ The matched route, that is, the path template in the format used by the respective server framework. Note: MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it. @@ -75,23 +69,23 @@ class HttpRequestMethodValues(Enum): - CONNECT = "CONNECT" + CONNECT: Final = "CONNECT" """CONNECT method.""" - DELETE = "DELETE" + DELETE: Final = "DELETE" """DELETE method.""" - GET = "GET" + GET: Final = "GET" """GET method.""" - HEAD = "HEAD" + HEAD: Final = "HEAD" """HEAD method.""" - OPTIONS = "OPTIONS" + OPTIONS: Final = "OPTIONS" """OPTIONS method.""" - PATCH = "PATCH" + PATCH: Final = "PATCH" """PATCH method.""" - POST = "POST" + POST: Final = "POST" """POST method.""" - PUT = "PUT" + PUT: Final = "PUT" """PUT method.""" - TRACE = "TRACE" + TRACE: Final = "TRACE" """TRACE method.""" - OTHER = "_OTHER" + OTHER: Final = "_OTHER" """Any HTTP method that the instrumentation has no prior knowledge of.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py index fd256ee8a40..9320362651e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py @@ -12,42 +12,36 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -NETWORK_LOCAL_ADDRESS = "network.local.address" +NETWORK_LOCAL_ADDRESS: Final = "network.local.address" """ Local address of the network connection - IP address or Unix domain socket name. """ - -NETWORK_LOCAL_PORT = "network.local.port" +NETWORK_LOCAL_PORT: Final = "network.local.port" """ Local port number of the network connection. """ - -NETWORK_PEER_ADDRESS = "network.peer.address" +NETWORK_PEER_ADDRESS: Final = "network.peer.address" """ Peer address of the network connection - IP address or Unix domain socket name. """ - -NETWORK_PEER_PORT = "network.peer.port" +NETWORK_PEER_PORT: Final = "network.peer.port" """ Peer port number of the network connection. """ - -NETWORK_PROTOCOL_NAME = "network.protocol.name" +NETWORK_PROTOCOL_NAME: Final = "network.protocol.name" """ [OSI application layer](https://osi-model.com/application-layer/) or non-OSI equivalent. Note: The value SHOULD be normalized to lowercase. """ - -NETWORK_PROTOCOL_VERSION = "network.protocol.version" +NETWORK_PROTOCOL_VERSION: Final = "network.protocol.version" """ The actual version of the protocol used for network communication. Note: If protocol version is subject to negotiation (for example using [ALPN](https://www.rfc-editor.org/rfc/rfc7301.html)), this attribute SHOULD be set to the negotiated version. If the actual protocol version is not known, this attribute SHOULD NOT be set. """ - -NETWORK_TRANSPORT = "network.transport" +NETWORK_TRANSPORT: Final = "network.transport" """ [OSI transport layer](https://osi-model.com/transport-layer/) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication). Note: The value SHOULD be normalized to lowercase. @@ -56,8 +50,7 @@ a port number is ambiguous without knowing the transport. For example different processes could be listening on TCP port 12345 and UDP port 12345. """ - -NETWORK_TYPE = "network.type" +NETWORK_TYPE: Final = "network.type" """ [OSI network layer](https://osi-model.com/network-layer/) or non-OSI equivalent. Note: The value SHOULD be normalized to lowercase. @@ -65,18 +58,18 @@ class NetworkTransportValues(Enum): - TCP = "tcp" + TCP: Final = "tcp" """TCP.""" - UDP = "udp" + UDP: Final = "udp" """UDP.""" - PIPE = "pipe" + PIPE: Final = "pipe" """Named or anonymous pipe.""" - UNIX = "unix" + UNIX: Final = "unix" """Unix domain socket.""" class NetworkTypeValues(Enum): - IPV4 = "ipv4" + IPV4: Final = "ipv4" """IPv4.""" - IPV6 = "ipv6" + IPV6: Final = "ipv6" """IPv6.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/otel_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/otel_attributes.py index 1ccb108c3ee..a0e66a84f7a 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/otel_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/otel_attributes.py @@ -12,32 +12,29 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -OTEL_SCOPE_NAME = "otel.scope.name" +OTEL_SCOPE_NAME: Final = "otel.scope.name" """ The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). """ - -OTEL_SCOPE_VERSION = "otel.scope.version" +OTEL_SCOPE_VERSION: Final = "otel.scope.version" """ The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP). """ - -OTEL_STATUS_CODE = "otel.status_code" +OTEL_STATUS_CODE: Final = "otel.status_code" """ Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. """ - -OTEL_STATUS_DESCRIPTION = "otel.status_description" +OTEL_STATUS_DESCRIPTION: Final = "otel.status_description" """ Description of the Status if it has a value, otherwise not set. """ class OtelStatusCodeValues(Enum): - OK = "OK" + OK: Final = "OK" """The operation has been validated by an Application developer or Operator to have completed successfully.""" - ERROR = "ERROR" + ERROR: Final = "ERROR" """The operation contains an error.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/server_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/server_attributes.py index 1b882a3fd49..8ee3ecfa0f5 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/server_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/server_attributes.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -SERVER_ADDRESS = "server.address" +SERVER_ADDRESS: Final = "server.address" """ Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. Note: When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available. """ - -SERVER_PORT = "server.port" +SERVER_PORT: Final = "server.port" """ Server port number. Note: When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available. diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/service_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/service_attributes.py index 4efd06f6545..cb9dcda6534 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/service_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/service_attributes.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -SERVICE_NAME = "service.name" +SERVICE_NAME: Final = "service.name" """ Logical name of the service. Note: MUST be the same for all instances of horizontally scaled services. If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value MUST be set to `unknown_service`. """ - -SERVICE_VERSION = "service.version" +SERVICE_VERSION: Final = "service.version" """ The version string of the service API or implementation. The format is not defined by these conventions. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/telemetry_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/telemetry_attributes.py index 5909f5d2c4f..74f9671ab33 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/telemetry_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/telemetry_attributes.py @@ -12,15 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. - from enum import Enum +from typing import Final -TELEMETRY_SDK_LANGUAGE = "telemetry.sdk.language" +TELEMETRY_SDK_LANGUAGE: Final = "telemetry.sdk.language" """ The language of the telemetry SDK. """ - -TELEMETRY_SDK_NAME = "telemetry.sdk.name" +TELEMETRY_SDK_NAME: Final = "telemetry.sdk.name" """ The name of the telemetry SDK as defined above. Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute to `opentelemetry`. @@ -30,35 +29,34 @@ The identifier `opentelemetry` is reserved and MUST NOT be used in this case. All custom identifiers SHOULD be stable across different versions of an implementation. """ - -TELEMETRY_SDK_VERSION = "telemetry.sdk.version" +TELEMETRY_SDK_VERSION: Final = "telemetry.sdk.version" """ The version string of the telemetry SDK. """ class TelemetrySdkLanguageValues(Enum): - CPP = "cpp" + CPP: Final = "cpp" """cpp.""" - DOTNET = "dotnet" + DOTNET: Final = "dotnet" """dotnet.""" - ERLANG = "erlang" + ERLANG: Final = "erlang" """erlang.""" - GO = "go" + GO: Final = "go" """go.""" - JAVA = "java" + JAVA: Final = "java" """java.""" - NODEJS = "nodejs" + NODEJS: Final = "nodejs" """nodejs.""" - PHP = "php" + PHP: Final = "php" """php.""" - PYTHON = "python" + PYTHON: Final = "python" """python.""" - RUBY = "ruby" + RUBY: Final = "ruby" """ruby.""" - RUST = "rust" + RUST: Final = "rust" """rust.""" - SWIFT = "swift" + SWIFT: Final = "swift" """swift.""" - WEBJS = "webjs" + WEBJS: Final = "webjs" """webjs.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/url_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/url_attributes.py index feacc0746f6..9e9ab23eddc 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/url_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/url_attributes.py @@ -12,33 +12,30 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -URL_FRAGMENT = "url.fragment" +URL_FRAGMENT: Final = "url.fragment" """ The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component. """ - -URL_FULL = "url.full" +URL_FULL: Final = "url.full" """ Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986). Note: For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment is not transmitted over HTTP, but if it is known, it SHOULD be included nevertheless. `url.full` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case username and password SHOULD be redacted and attribute's value SHOULD be `https://REDACTED:REDACTED@www.example.com/`. `url.full` SHOULD capture the absolute URL when it is available (or can be reconstructed). Sensitive content provided in `url.full` SHOULD be scrubbed when instrumentations can identify it. """ - -URL_PATH = "url.path" +URL_PATH: Final = "url.path" """ The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component. Note: Sensitive content provided in `url.path` SHOULD be scrubbed when instrumentations can identify it. """ - -URL_QUERY = "url.query" +URL_QUERY: Final = "url.query" """ The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component. Note: Sensitive content provided in `url.query` SHOULD be scrubbed when instrumentations can identify it. """ - -URL_SCHEME = "url.scheme" +URL_SCHEME: Final = "url.scheme" """ The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/user_agent_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/user_agent_attributes.py index 41ea48eeea3..af5002ef34e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/user_agent_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/user_agent_attributes.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Final -USER_AGENT_ORIGINAL = "user_agent.original" +USER_AGENT_ORIGINAL: Final = "user_agent.original" """ Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/http_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/http_metrics.py index 9006c83959d..d0e0db65013 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/http_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/http_metrics.py @@ -13,7 +13,9 @@ # limitations under the License. -HTTP_CLIENT_REQUEST_DURATION = "http.client.request.duration" +from typing import Final + +HTTP_CLIENT_REQUEST_DURATION: Final = "http.client.request.duration" """ Duration of HTTP client requests Instrument: histogram @@ -21,7 +23,7 @@ """ -HTTP_SERVER_REQUEST_DURATION = "http.server.request.duration" +HTTP_SERVER_REQUEST_DURATION: Final = "http.server.request.duration" """ Duration of HTTP server requests Instrument: histogram diff --git a/scripts/semconv/templates/common.j2 b/scripts/semconv/templates/common.j2 index 8eba58eb24d..8a1231f6e66 100644 --- a/scripts/semconv/templates/common.j2 +++ b/scripts/semconv/templates/common.j2 @@ -24,12 +24,3 @@ from deprecated import deprecated {%- endif %} {%- endmacro-%} - -{%- macro add_and_check_constant(fqn, const_name, all_names) -%} -{%- if const_name in all_names -%} -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ------------------- ERROR ------------------------ -{{ "Failed to generate `" ~ fqn ~ "`, constant `" ~ const_name ~ "` is already defined." }} - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -{%- else -%}{%- set _ = all_names.append(const_name) -%}{%- endif -%}{%- endmacro -%} diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index cf363cc6ec5..8347d503978 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -59,6 +59,8 @@ Note: {{ common.to_docstring(attribute.note | indent)}}. {%- set filtered_enum_attributes = enum_attributes | rejectattr("fqn", "in", excluded_attributes)| list %} {%- endif -%} +from typing import Final + {{common.import_deprecated(filtered_enum_attributes)}} {% if filtered_enum_attributes | count > 0 %} @@ -71,9 +73,7 @@ from enum import Enum {%- set constant_names = [] -%} {% for attribute in filtered_attributes -%} -{%- set name = attribute_name(attribute) -%} -{{common.add_and_check_constant(attribute.fqn, name, constant_names)}} -{{name}} = "{{attribute.fqn}}" +{{attribute_name(attribute)}} : Final = "{{attribute.fqn}}" {{attribute_brief(attribute)}} {% endfor %} {%- for attribute in filtered_enum_attributes -%} @@ -85,7 +85,7 @@ from enum import Enum {%- endif %} class {{class_name}}(Enum): {%- for member in attribute.attr_type.members %} - {{ member.member_id | to_const_name }} = {{ attribute | print_member_value(member) }} + {{ member.member_id | to_const_name }} : Final = {{ attribute | print_member_value(member) }} """{{ common.to_docstring(member.brief) }}.""" {%- endfor %} {%- endfor -%} diff --git a/scripts/semconv/templates/semantic_metrics.j2 b/scripts/semconv/templates/semantic_metrics.j2 index 1833848898b..ee1adf0d09a 100644 --- a/scripts/semconv/templates/semantic_metrics.j2 +++ b/scripts/semconv/templates/semantic_metrics.j2 @@ -96,14 +96,12 @@ from opentelemetry.metrics import Counter {{ common.file_header()}} +from typing import Final {{ import_instrument_classes(filtered_metrics) }} {%- set constant_names = [] -%} {%- for metric in filtered_metrics %} -{% set name = metric.metric_name | to_const_name %} -{{common.add_and_check_constant(metric.metric_name, name, constant_names)}} - -{{name}} = "{{metric.metric_name}}" +{{metric.metric_name | to_const_name}}: Final = "{{metric.metric_name}}" {{metric_brief(metric, metric.metric_name | to_const_name) }} {% if filter == "any" %}