diff --git a/.codespellrc b/.codespellrc index f5236d7c1bc..b81e62f640c 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,4 +1,4 @@ [codespell] # skipping auto generated folders -skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv,.git +skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv,.git,./opentelemetry-semantic-conventions ignore-words-list = ans,ue,ot,hist,ro diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd600c03af2..88c1675c470 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -119,7 +119,7 @@ jobs: # Contrib unit test suite in order to ensure changes in core do not break anything in contrib. # We only run contrib unit tests on the oldest supported Python version (3.7) as running the same tests - # on all versions is somewhat redundant. + # on all versions is somewhat redundant. contrib-build: env: # We use these variables to convert between tox and GHA version literals diff --git a/.gitignore b/.gitignore index 9b3ce8568f3..f2324c7bfca 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,6 @@ target # Django example docs/examples/django/db.sqlite3 + +# Semantic conventions +scripts/semconv/semantic-conventions diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a8b0656e55..e5e0dd09f51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#3442](https://github.com/open-telemetry/opentelemetry-python/pull/3442)) - Do not load Resource on sdk import ([#3447](https://github.com/open-telemetry/opentelemetry-python/pull/3447)) +- Update semantic conventions to version 1.21.0 + ([#3251](https://github.com/open-telemetry/opentelemetry-python/pull/3251)) ## Version 1.20.0/0.41b0 (2023-09-04) @@ -29,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#3372](https://github.com/open-telemetry/opentelemetry-python/pull/3372)) - Update the body type in the log ([$3343](https://github.com/open-telemetry/opentelemetry-python/pull/3343)) -- Add max_scale option to Exponential Bucket Histogram Aggregation +- Add max_scale option to Exponential Bucket Histogram Aggregation ([#3323](https://github.com/open-telemetry/opentelemetry-python/pull/3323)) - Use BoundedAttributes instead of raw dict to extract attributes from LogRecord ([#3310](https://github.com/open-telemetry/opentelemetry-python/pull/3310)) diff --git a/docs/examples/django/README.rst b/docs/examples/django/README.rst index 2e071127ff2..1dd8999c036 100644 --- a/docs/examples/django/README.rst +++ b/docs/examples/django/README.rst @@ -84,16 +84,14 @@ output similar to this one: "status_code": "OK" }, "attributes": { - "http.method": "GET", - "http.server_name": "localhost", - "http.scheme": "http", - "host.port": 8000, - "http.host": "localhost:8000", - "http.url": "http://localhost:8000/?param=hello", - "net.peer.ip": "127.0.0.1", - "http.flavor": "1.1", - "http.status_text": "OK", - "http.status_code": 200 + "http.request.method": "GET", + "server.address": "localhost", + "url.scheme": "http", + "server.port": 8000, + "url.full": "http://localhost:8000/?param=hello", + "server.socket.address": "127.0.0.1", + "network.protocol.version": "1.1", + "http.response.status_code": 200 }, "events": [], "links": [] diff --git a/opentelemetry-sdk/tests/trace/test_trace.py b/opentelemetry-sdk/tests/trace/test_trace.py index fc46cb136f3..b08afce4a6d 100644 --- a/opentelemetry-sdk/tests/trace/test_trace.py +++ b/opentelemetry-sdk/tests/trace/test_trace.py @@ -640,12 +640,12 @@ def test_attributes(self): with self.tracer.start_as_current_span("root") as root: root.set_attributes( { - "http.method": "GET", - "http.url": "https://example.com:779/path/12/?q=d#123", + "http.request.method": "GET", + "url.full": "https://example.com:779/path/12/?q=d#123", } ) - root.set_attribute("http.status_code", 200) + root.set_attribute("http.response.status_code", 200) root.set_attribute("http.status_text", "OK") root.set_attribute("misc.pi", 3.14) @@ -661,12 +661,12 @@ def test_attributes(self): root.set_attribute("list-of-numerics", list_of_numerics) self.assertEqual(len(root.attributes), 9) - self.assertEqual(root.attributes["http.method"], "GET") + self.assertEqual(root.attributes["http.request.method"], "GET") self.assertEqual( - root.attributes["http.url"], + root.attributes["url.full"], "https://example.com:779/path/12/?q=d#123", ) - self.assertEqual(root.attributes["http.status_code"], 200) + self.assertEqual(root.attributes["http.response.status_code"], 200) self.assertEqual(root.attributes["http.status_text"], "OK") self.assertEqual(root.attributes["misc.pi"], 3.14) self.assertEqual(root.attributes["attr-key"], "attr-value2") @@ -1007,7 +1007,7 @@ def test_ended_span(self): self.assertEqual(end_time0, root.end_time) with self.assertLogs(level=WARNING): - root.set_attribute("http.method", "GET") + root.set_attribute("http.request.method", "GET") self.assertEqual(len(root.attributes), 0) with self.assertLogs(level=WARNING): diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py index e7a03cf818a..9cd7cee94f9 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py @@ -12,23 +12,200 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=too-many-lines - class MetricInstruments: + SCHEMA_URL = "https://opentelemetry.io/schemas/v1.21.0" + """ + The URL of the OpenTelemetry schema for these keys and values. + """ HTTP_SERVER_DURATION = "http.server.duration" + """ + Measures the duration of inbound HTTP requests + Instrument: histogram + Unit: s + """ + + HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests" + """ + Measures the number of concurrent HTTP requests that are currently in-flight + Instrument: updowncounter + Unit: {request} + """ HTTP_SERVER_REQUEST_SIZE = "http.server.request.size" + """ + Measures the size of HTTP request messages (compressed) + Instrument: histogram + Unit: By + """ HTTP_SERVER_RESPONSE_SIZE = "http.server.response.size" - - HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests" + """ + Measures the size of HTTP response messages (compressed) + Instrument: histogram + Unit: By + """ HTTP_CLIENT_DURATION = "http.client.duration" + """ + Measures the duration of outbound HTTP requests + Instrument: histogram + Unit: s + """ HTTP_CLIENT_REQUEST_SIZE = "http.client.request.size" + """ + Measures the size of HTTP request messages (compressed) + Instrument: histogram + Unit: By + """ HTTP_CLIENT_RESPONSE_SIZE = "http.client.response.size" + """ + Measures the size of HTTP response messages (compressed) + Instrument: histogram + Unit: By + """ + + PROCESS_RUNTIME_JVM_MEMORY_INIT = "process.runtime.jvm.memory.init" + """ + Measure of initial memory requested + Instrument: updowncounter + Unit: By + """ + + PROCESS_RUNTIME_JVM_SYSTEM_CPU_UTILIZATION = ( + "process.runtime.jvm.system.cpu.utilization" + ) + """ + Recent CPU utilization for the whole system as reported by the JVM + Instrument: gauge + Unit: 1 + """ + + PROCESS_RUNTIME_JVM_SYSTEM_CPU_LOAD_1M = ( + "process.runtime.jvm.system.cpu.load_1m" + ) + """ + Average CPU load of the whole system for the last minute as reported by the JVM + Instrument: gauge + Unit: 1 + """ + + PROCESS_RUNTIME_JVM_BUFFER_USAGE = "process.runtime.jvm.buffer.usage" + """ + Measure of memory used by buffers + Instrument: updowncounter + Unit: By + """ + + PROCESS_RUNTIME_JVM_BUFFER_LIMIT = "process.runtime.jvm.buffer.limit" + """ + Measure of total memory capacity of buffers + Instrument: updowncounter + Unit: By + """ + + PROCESS_RUNTIME_JVM_BUFFER_COUNT = "process.runtime.jvm.buffer.count" + """ + Number of buffers in the pool + Instrument: updowncounter + Unit: {buffer} + """ + + PROCESS_RUNTIME_JVM_MEMORY_USAGE = "process.runtime.jvm.memory.usage" + """ + Measure of memory used + Instrument: updowncounter + Unit: By + """ + + PROCESS_RUNTIME_JVM_MEMORY_COMMITTED = ( + "process.runtime.jvm.memory.committed" + ) + """ + Measure of memory committed + Instrument: updowncounter + Unit: By + """ + + PROCESS_RUNTIME_JVM_MEMORY_LIMIT = "process.runtime.jvm.memory.limit" + """ + Measure of max obtainable memory + Instrument: updowncounter + Unit: By + """ + + PROCESS_RUNTIME_JVM_MEMORY_USAGE_AFTER_LAST_GC = ( + "process.runtime.jvm.memory.usage_after_last_gc" + ) + """ + Measure of memory used, as measured after the most recent garbage collection event on this pool + Instrument: updowncounter + Unit: By + """ + + PROCESS_RUNTIME_JVM_GC_DURATION = "process.runtime.jvm.gc.duration" + """ + Duration of JVM garbage collection actions + Instrument: histogram + Unit: s + """ + + PROCESS_RUNTIME_JVM_THREADS_COUNT = "process.runtime.jvm.threads.count" + """ + Number of executing platform threads + Instrument: updowncounter + Unit: {thread} + """ + + PROCESS_RUNTIME_JVM_CLASSES_LOADED = "process.runtime.jvm.classes.loaded" + """ + Number of classes loaded since JVM start + Instrument: counter + Unit: {class} + """ + + PROCESS_RUNTIME_JVM_CLASSES_UNLOADED = ( + "process.runtime.jvm.classes.unloaded" + ) + """ + Number of classes unloaded since JVM start + Instrument: counter + Unit: {class} + """ + + PROCESS_RUNTIME_JVM_CLASSES_CURRENT_LOADED = ( + "process.runtime.jvm.classes.current_loaded" + ) + """ + Number of classes currently loaded + Instrument: updowncounter + Unit: {class} + """ + + PROCESS_RUNTIME_JVM_CPU_TIME = "process.runtime.jvm.cpu.time" + """ + CPU time used by the process as reported by the JVM + Instrument: counter + Unit: s + """ + + PROCESS_RUNTIME_JVM_CPU_RECENT_UTILIZATION = ( + "process.runtime.jvm.cpu.recent_utilization" + ) + """ + Recent CPU utilization for the process as reported by the JVM + Instrument: gauge + Unit: 1 + """ + + # Manually defined metrics DB_CLIENT_CONNECTIONS_USAGE = "db.client.connections.usage" + """ + The number of connections that are currently in state described by the `state` attribute + Instrument: UpDownCounter + Unit: {connection} + """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index 028fedd6df1..590135934c8 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -12,10 +12,47 @@ # See the License for the specific language governing permissions and # limitations under the License. +# pylint: disable=too-many-lines + from enum import Enum class ResourceAttributes: + SCHEMA_URL = "https://opentelemetry.io/schemas/v1.21.0" + """ + The URL of the OpenTelemetry schema for these keys and values. + """ + BROWSER_BRANDS = "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_PLATFORM = "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. + The list of possible values is defined in the [W3C User-Agent Client Hints specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). Note that some (but not all) of these values can overlap with values in the [`os.type` and `os.name` attributes](./os.md). However, for consistency, the values in the `browser.platform` attribute should capture the exact value that the user agent provides. + """ + + BROWSER_MOBILE = "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_LANGUAGE = "browser.language" + """ + Preferred language of the user using the browser. + Note: This value is intended to be taken from the Navigator API `navigator.language`. + """ + + USER_AGENT_ORIGINAL = "user_agent.original" + """ + Full user-agent string provided by the browser. + Note: The user-agent value SHOULD be provided only from browsers that do not have a mechanism to retrieve brands and platform individually from the User-Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` API can be used. + """ + CLOUD_PROVIDER = "cloud.provider" """ Name of the cloud provider. @@ -29,7 +66,29 @@ class ResourceAttributes: CLOUD_REGION = "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/en-us/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://intl.cloud.tencent.com/document/product/213/6091). + Note: Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091). + """ + + CLOUD_RESOURCE_ID = "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/en-us/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, + so it may be necessary to set `cloud.resource_id` as a span attribute instead. + + The exact value to use for `cloud.resource_id` depends on the cloud provider. + The following well-known definitions MUST be used if you set this attribute and they apply: + + * **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + Take care not to use the "invoked ARN" directly but replace any + [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + with the resolved function version, as the same runtime instance may be invokable with + multiple different aliases. + * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names) + * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) of the invoked function, + *not* the function app, having the form + `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share + a TracerProvider. """ CLOUD_AVAILABILITY_ZONE = "cloud.availability_zone" @@ -102,6 +161,41 @@ class ResourceAttributes: 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. """ + GCP_CLOUD_RUN_JOB_EXECUTION = "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" + """ + 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_NAME = "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). + """ + + GCP_GCE_INSTANCE_HOSTNAME = "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). + """ + + HEROKU_RELEASE_CREATION_TIMESTAMP = "heroku.release.creation_timestamp" + """ + Time and date the release was created. + """ + + HEROKU_RELEASE_COMMIT = "heroku.release.commit" + """ + Commit hash for the current release. + """ + + HEROKU_APP_ID = "heroku.app.id" + """ + Unique identifier for the application. + """ + CONTAINER_NAME = "container.name" """ Container name used by container runtime. @@ -127,6 +221,30 @@ class ResourceAttributes: Container image tag. """ + CONTAINER_IMAGE_ID = "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"`. + OCI defines a digest of manifest. + """ + + CONTAINER_COMMAND = "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_LINE = "container.command_line" + """ + The full command run by the container as a single string representing the full command. [2]. + """ + + CONTAINER_COMMAND_ARGS = "container.command_args" + """ + All the command arguments (including the command/executable itself) run by the container. [2]. + """ + DEPLOYMENT_ENVIRONMENT = "deployment.environment" """ Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka deployment tier). @@ -159,26 +277,22 @@ class ResourceAttributes: FAAS_NAME = "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 platform and is usually different from the name of the callback function (which may be stored in the [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) span attributes). - """ + Note: This is the name of the function as configured/deployed on the FaaS + platform and is usually different from the name of the callback + function (which may be stored in the + [`code.namespace`/`code.function`](/docs/general/general-attributes.md#source-code-attributes) + span attributes). - FAAS_ID = "faas.id" - """ - The unique ID of the single function that this runtime instance executes. - Note: Depending on the cloud provider, use: - -* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). -Take care not to use the "invoked ARN" directly but replace any -[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) with the resolved function version, as the same runtime instance may be invocable with multiple -different aliases. -* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names) -* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id). + For some cloud providers, the above definition is ambiguous. The following + definition of function name MUST be used for this attribute + (and consequently the span name) for the listed cloud providers/products: -On some providers, it may not be possible to determine the full ID at startup, -which is why this field cannot be made required. For example, on AWS the account ID -part of the ARN is not available without calling another AWS API -which may be deemed too slow for a short-running lambda function. -As an alternative, consider setting `faas.id` as a span attribute instead. + * **Azure:** The full name `/`, i.e., function app name + followed by a forward slash followed by the function name (this form + can also be seen in the resource JSON for the function). + This means that a span attribute MUST be used, as an Azure function + app can host multiple functions that would usually share + a TracerProvider (see also the `cloud.resource_id` attribute). """ FAAS_VERSION = "faas.version" @@ -186,13 +300,13 @@ class ResourceAttributes: The immutable version of the function being executed. Note: Depending on the cloud provider and platform, use: -* **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) - (an integer represented as a decimal string). -* **Google Cloud Run:** The [revision](https://cloud.google.com/run/docs/managing/revisions) - (i.e., the function name plus the revision suffix). -* **Google Cloud Functions:** The value of the - [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). -* **Azure Functions:** Not applicable. Do not set this attribute. + * **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + (an integer represented as a decimal string). + * **Google Cloud Run (Services):** The [revision](https://cloud.google.com/run/docs/managing/revisions) + (i.e., the function name plus the revision suffix). + * **Google Cloud Functions:** The value of the + [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). + * **Azure Functions:** Not applicable. Do not set this attribute. """ FAAS_INSTANCE = "faas.instance" @@ -203,13 +317,13 @@ class ResourceAttributes: FAAS_MAX_MEMORY = "faas.max_memory" """ - The amount of memory available to the serverless function in MiB. - 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. + 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). """ HOST_ID = "host.id" """ - Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. + 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_NAME = "host.name" @@ -234,12 +348,12 @@ class ResourceAttributes: HOST_IMAGE_ID = "host.image.id" """ - VM image ID. For Cloud, this value is from the provider. + VM image ID or host OS image ID. For Cloud, this value is from the provider. """ HOST_IMAGE_VERSION = "host.image.version" """ - The version string of the VM image as defined in [Version Attributes](README.md#version-attributes). + The version string of the VM image or host OS as defined in [Version Attributes](README.md#version-attributes). """ K8S_CLUSTER_NAME = "k8s.cluster.name" @@ -247,6 +361,33 @@ class ResourceAttributes: The name of the cluster. """ + K8S_CLUSTER_UID = "k8s.cluster.uid" + """ + A pseudo-ID for the cluster, set to the UID of the `kube-system` namespace. + Note: K8s does not have support for obtaining a cluster ID. If this is ever + added, we will recommend collecting the `k8s.cluster.uid` through the + official APIs. In the meantime, we are able to use the `uid` of the + `kube-system` namespace as a proxy for cluster ID. Read on for the + rationale. + + Every object created in a K8s cluster is assigned a distinct UID. The + `kube-system` namespace is used by Kubernetes itself and will exist + for the lifetime of the cluster. Using the `uid` of the `kube-system` + namespace is a reasonable proxy for the K8s ClusterID as it will only + change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are + UUIDs as standardized by + [ISO/IEC 9834-8 and ITU-T X.667](https://www.itu.int/ITU-T/studygroups/com17/oid.html). + Which states: + + > If generated according to one of the mechanisms defined in Rec. + ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be + different from all other UUIDs generated before 3603 A.D., or is + extremely likely to be different (depending on the mechanism chosen). + + Therefore, UIDs between clusters should be extremely unlikely to + conflict. + """ + K8S_NODE_NAME = "k8s.node.name" """ The name of the Node. @@ -359,7 +500,7 @@ class ResourceAttributes: OS_VERSION = "os.version" """ - The version string of the operating system as defined in [Version Attributes](../../resource/semantic_conventions/README.md#version-attributes). + The version string of the operating system as defined in [Version Attributes](/docs/resource/README.md#version-attributes). """ PROCESS_PID = "process.pid" @@ -367,6 +508,11 @@ class ResourceAttributes: Process identifier (PID). """ + PROCESS_PARENT_PID = "process.parent_pid" + """ + Parent Process identifier (PID). + """ + PROCESS_EXECUTABLE_NAME = "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`. @@ -418,6 +564,11 @@ class ResourceAttributes: 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" + """ + The version string of the service API or implementation. The format is not defined by these conventions. + """ + SERVICE_NAMESPACE = "service.namespace" """ A namespace for `service.name`. @@ -430,14 +581,15 @@ class ResourceAttributes: Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words `service.namespace,service.name,service.instance.id` triplet MUST be globally unique). The ID helps to distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled service). It is preferable for the ID to be persistent and stay the same for the lifetime of the service instance, however it is acceptable that the ID is ephemeral and changes during important lifetime events for the service (e.g. service restarts). If the service has no inherent unique ID that can be used as the value of this attribute it is recommended to generate a random Version 1 or Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use Version 5, see RFC 4122 for more recommendations). """ - SERVICE_VERSION = "service.version" - """ - The version string of the service API or implementation. - """ - TELEMETRY_SDK_NAME = "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`. + If another SDK, like a fork or a vendor-provided implementation, is used, this SDK MUST set the + `telemetry.sdk.name` attribute to the fully-qualified class or module name of this SDK's main entry point + or another suitable identifier depending on the language. + 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_LANGUAGE = "telemetry.sdk.language" @@ -470,6 +622,33 @@ class ResourceAttributes: Additional description of the web engine (e.g. detailed version and edition information). """ + OTEL_SCOPE_NAME = "otel.scope.name" + """ + The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). + """ + + OTEL_SCOPE_VERSION = "otel.scope.version" + """ + The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + """ + + OTEL_LIBRARY_NAME = "otel.library.name" + """ + Deprecated, use the `otel.scope.name` attribute. + """ + + OTEL_LIBRARY_VERSION = "otel.library.version" + """ + Deprecated, use the `otel.scope.version` attribute. + """ + + # Manually defined deprecated attributes + + FAAS_ID = "faas.id" + """ + Deprecated, use the `cloud.resource.id` attribute. + """ + class CloudProviderValues(Enum): ALIBABA_CLOUD = "alibaba_cloud" @@ -484,6 +663,12 @@ class CloudProviderValues(Enum): GCP = "gcp" """Google Cloud Platform.""" + HEROKU = "heroku" + """Heroku Platform as a Service.""" + + IBM_CLOUD = "ibm_cloud" + """IBM Cloud.""" + TENCENT_CLOUD = "tencent_cloud" """Tencent Cloud.""" @@ -495,6 +680,9 @@ class CloudPlatformValues(Enum): ALIBABA_CLOUD_FC = "alibaba_cloud_fc" """Alibaba Cloud Function Compute.""" + ALIBABA_CLOUD_OPENSHIFT = "alibaba_cloud_openshift" + """Red Hat OpenShift on Alibaba Cloud.""" + AWS_EC2 = "aws_ec2" """AWS Elastic Compute Cloud.""" @@ -513,6 +701,9 @@ class CloudPlatformValues(Enum): AWS_APP_RUNNER = "aws_app_runner" """AWS App Runner.""" + AWS_OPENSHIFT = "aws_openshift" + """Red Hat OpenShift on AWS (ROSA).""" + AZURE_VM = "azure_vm" """Azure Virtual Machines.""" @@ -528,6 +719,12 @@ class CloudPlatformValues(Enum): AZURE_APP_SERVICE = "azure_app_service" """Azure App Service.""" + AZURE_OPENSHIFT = "azure_openshift" + """Azure Red Hat OpenShift.""" + + GCP_BARE_METAL_SOLUTION = "gcp_bare_metal_solution" + """Google Bare Metal Solution (BMS).""" + GCP_COMPUTE_ENGINE = "gcp_compute_engine" """Google Cloud Compute Engine (GCE).""" @@ -543,6 +740,12 @@ class CloudPlatformValues(Enum): GCP_APP_ENGINE = "gcp_app_engine" """Google Cloud App Engine (GAE).""" + GCP_OPENSHIFT = "gcp_openshift" + """Red Hat OpenShift on Google Cloud.""" + + IBM_CLOUD_OPENSHIFT = "ibm_cloud_openshift" + """Red Hat OpenShift on IBM Cloud.""" + TENCENT_CLOUD_CVM = "tencent_cloud_cvm" """Tencent Cloud Cloud Virtual Machine (CVM).""" @@ -650,8 +853,11 @@ class TelemetrySdkLanguageValues(Enum): RUBY = "ruby" """ruby.""" - WEBJS = "webjs" - """webjs.""" + RUST = "rust" + """rust.""" SWIFT = "swift" """swift.""" + + WEBJS = "webjs" + """webjs.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index 36bab3d1a13..48df586dc18 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -16,162 +16,150 @@ from enum import Enum +from deprecated import deprecated + class SpanAttributes: - AWS_LAMBDA_INVOKED_ARN = "aws.lambda.invoked_arn" + SCHEMA_URL = "https://opentelemetry.io/schemas/v1.21.0" """ - 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 `faas.id` if an alias is involved. + The URL of the OpenTelemetry schema for these keys and values. """ - - CLOUDEVENTS_EVENT_ID = "cloudevents.event_id" + CLIENT_ADDRESS = "client.address" """ - The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) uniquely identifies the event. + Client address - unix domain socket name, IPv4 or IPv6 address. + Note: When observed from the server side, and when communicating through an intermediary, `client.address` SHOULD represent client address behind any intermediaries (e.g. proxies) if it's available. """ - CLOUDEVENTS_EVENT_SOURCE = "cloudevents.event_source" + CLIENT_PORT = "client.port" """ - The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) identifies the context in which an event happened. + Client port number. + Note: When observed from the server side, and when communicating through an intermediary, `client.port` SHOULD represent client port behind any intermediaries (e.g. proxies) if it's available. """ - CLOUDEVENTS_EVENT_SPEC_VERSION = "cloudevents.event_spec_version" + CLIENT_SOCKET_ADDRESS = "client.socket.address" """ - The [version of the CloudEvents specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. + Immediate client peer address - unix domain socket name, IPv4 or IPv6 address. """ - CLOUDEVENTS_EVENT_TYPE = "cloudevents.event_type" + CLIENT_SOCKET_PORT = "client.socket.port" """ - 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. + Immediate client peer port number. """ - CLOUDEVENTS_EVENT_SUBJECT = "cloudevents.event_subject" + HTTP_METHOD = "http.method" """ - 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). + Deprecated, use `http.request.method` instead. """ - OPENTRACING_REF_TYPE = "opentracing.ref_type" + HTTP_STATUS_CODE = "http.status_code" """ - Parent-child Reference type. - Note: The causal relationship between a child Span and a parent Span. + Deprecated, use `http.response.status_code` instead. """ - DB_SYSTEM = "db.system" + HTTP_SCHEME = "http.scheme" """ - An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + Deprecated, use `url.scheme` instead. """ - DB_CONNECTION_STRING = "db.connection_string" + HTTP_URL = "http.url" """ - The connection string used to connect to the database. It is recommended to remove embedded credentials. + Deprecated, use `url.full` instead. """ - DB_USER = "db.user" + HTTP_TARGET = "http.target" """ - Username for accessing the database. + Deprecated, use `url.path` and `url.query` instead. """ - DB_JDBC_DRIVER_CLASSNAME = "db.jdbc.driver_classname" + HTTP_REQUEST_CONTENT_LENGTH = "http.request_content_length" """ - The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect. + Deprecated, use `http.request.body.size` instead. """ - DB_NAME = "db.name" + HTTP_RESPONSE_CONTENT_LENGTH = "http.response_content_length" """ - This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails). - Note: In some SQL databases, the database name to be used is called "schema name". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name). + Deprecated, use `http.response.body.size` instead. """ - DB_STATEMENT = "db.statement" + NET_SOCK_PEER_NAME = "net.sock.peer.name" """ - The database statement being executed. - Note: The value may be sanitized to exclude sensitive information. + Deprecated, use `server.socket.domain` on client spans. """ - DB_OPERATION = "db.operation" + NET_SOCK_PEER_ADDR = "net.sock.peer.addr" """ - The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword. - Note: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted. + Deprecated, use `server.socket.address` on client spans and `client.socket.address` on server spans. """ - NET_PEER_NAME = "net.peer.name" + NET_SOCK_PEER_PORT = "net.sock.peer.port" """ - Remote hostname or similar, see note below. - Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra DNS lookup. + Deprecated, use `server.socket.port` on client spans and `client.socket.port` on server spans. """ - NET_PEER_IP = "net.peer.ip" + NET_PEER_NAME = "net.peer.name" """ - Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6). + Deprecated, use `server.address` on client spans and `client.address` on server spans. """ NET_PEER_PORT = "net.peer.port" """ - Remote port number. - """ - - NET_TRANSPORT = "net.transport" - """ - Transport protocol used. See note below. + Deprecated, use `server.port` on client spans and `client.port` on server spans. """ - DB_MSSQL_INSTANCE_NAME = "db.mssql.instance_name" + NET_HOST_NAME = "net.host.name" """ - The Microsoft SQL Server [instance name](https://docs.microsoft.com/en-us/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`, `net.peer.port` is no longer required (but still recommended if non-standard). + Deprecated, use `server.address`. """ - DB_CASSANDRA_PAGE_SIZE = "db.cassandra.page_size" + NET_HOST_PORT = "net.host.port" """ - The fetch size used for paging, i.e. how many rows will be returned at once. + Deprecated, use `server.port`. """ - DB_CASSANDRA_CONSISTENCY_LEVEL = "db.cassandra.consistency_level" + NET_SOCK_HOST_ADDR = "net.sock.host.addr" """ - 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). + Deprecated, use `server.socket.address`. """ - DB_CASSANDRA_TABLE = "db.cassandra.table" + NET_SOCK_HOST_PORT = "net.sock.host.port" """ - The name of the primary table that the operation is acting upon, including the keyspace name (if applicable). - Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. + Deprecated, use `server.socket.port`. """ - DB_CASSANDRA_IDEMPOTENCE = "db.cassandra.idempotence" + NET_TRANSPORT = "net.transport" """ - Whether or not the query is idempotent. + Deprecated, use `network.transport`. """ - DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( - "db.cassandra.speculative_execution_count" - ) + NET_PROTOCOL_NAME = "net.protocol.name" """ - The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. + Deprecated, use `network.protocol.name`. """ - DB_CASSANDRA_COORDINATOR_ID = "db.cassandra.coordinator.id" + NET_PROTOCOL_VERSION = "net.protocol.version" """ - The ID of the coordinating node for a query. + Deprecated, use `network.protocol.version`. """ - DB_CASSANDRA_COORDINATOR_DC = "db.cassandra.coordinator.dc" + NET_SOCK_FAMILY = "net.sock.family" """ - The data center of the coordinating node for a query. + Deprecated, use `network.transport` and `network.type`. """ - DB_REDIS_DATABASE_INDEX = "db.redis.database_index" + DESTINATION_DOMAIN = "destination.domain" """ - 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. + The domain name of the destination system. + Note: This value may be a host name, a fully qualified domain name, or another host naming format. """ - DB_MONGODB_COLLECTION = "db.mongodb.collection" + DESTINATION_ADDRESS = "destination.address" """ - The collection being accessed within the database stated in `db.name`. + Peer address, for example IP address or UNIX socket name. """ - DB_SQL_TABLE = "db.sql.table" + DESTINATION_PORT = "destination.port" """ - 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. + Peer port number. """ EXCEPTION_TYPE = "exception.type" @@ -189,377 +177,703 @@ class SpanAttributes: 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_ESCAPED = "exception.escaped" + HTTP_REQUEST_METHOD = "http.request.method" """ - 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, -if that span is ended while the exception is still logically "in flight". -This may be actually "in flight" in some languages (e.g. if the exception -is passed to a Context manager's `__exit__` method in Python) but will -usually be caught at the point of recording the exception in most languages. + HTTP request method. + Note: HTTP request method value SHOULD be "known" to the instrumentation. + By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) + and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). -It is usually not possible to determine at the point where an exception is thrown -whether it will escape the scope of a span. -However, it is trivial to know that an exception -will escape, if one checks for an active exception just before ending the span, -as done in the [example above](#recording-an-exception). + If the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER` and, except if reporting a metric, MUST + set the exact method received in the request line as value of the `http.request.method_original` attribute. -It follows that an exception may still escape the scope of the span -even if the `exception.escaped` attribute was not set or set to false, -since the event might have been recorded at a time where it was not -clear whether the exception will escape. - """ + If the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override + the list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named + OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods + (this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults). - FAAS_TRIGGER = "faas.trigger" + HTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly. + 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. """ - Type of the trigger which caused this function execution. - Note: For the server/consumer span on the incoming side, -`faas.trigger` MUST be set. -Clients invoking FaaS instances usually cannot set `faas.trigger`, -since they would typically need to look in the payload to determine -the event type. If clients set it, it should be the same as the -trigger that corresponding incoming would have (i.e., this has -nothing to do with the underlying transport used to make the API -call to invoke the lambda, which is often HTTP). + HTTP_RESPONSE_STATUS_CODE = "http.response.status_code" + """ + [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). """ - FAAS_EXECUTION = "faas.execution" + NETWORK_PROTOCOL_NAME = "network.protocol.name" """ - The execution ID of the current function execution. + [OSI Application Layer](https://osi-model.com/application-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. """ - FAAS_DOCUMENT_COLLECTION = "faas.document.collection" + NETWORK_PROTOCOL_VERSION = "network.protocol.version" """ - 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. + Version of the application layer protocol used. See note below. + Note: `network.protocol.version` refers to the version of the protocol used and might be different from the protocol client's version. If the HTTP client used has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`. """ - FAAS_DOCUMENT_OPERATION = "faas.document.operation" + SERVER_ADDRESS = "server.address" """ - Describes the type of the operation that was performed on the data. + Host identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to. + Note: Determined by using the first of the following that applies + + - Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) + if it's sent in absolute-form + - Host identifier of the `Host` header + + SHOULD NOT be set if capturing it would require an extra DNS lookup. """ - FAAS_DOCUMENT_TIME = "faas.document.time" + SERVER_PORT = "server.port" """ - 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). + Port identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to. + Note: When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `server.port` MUST match URI port identifier, otherwise it MUST match `Host` header port identifier. """ - FAAS_DOCUMENT_NAME = "faas.document.name" + HTTP_ROUTE = "http.route" """ - 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. + The matched route (path template in the format used by the respective server framework). See note below. + 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. + SHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one. """ - HTTP_METHOD = "http.method" + URL_SCHEME = "url.scheme" """ - HTTP request method. + The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. """ - HTTP_URL = "http.url" + EVENT_NAME = "event.name" """ - Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. - Note: `http.url` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case the attribute's value should be `https://www.example.com/`. + The name identifies the event. """ - HTTP_TARGET = "http.target" + EVENT_DOMAIN = "event.domain" """ - The full request target as passed in a HTTP request line or equivalent. + The domain identifies the business context for the events. + Note: Events across different domains may have same `event.name`, yet be + unrelated events. """ - HTTP_HOST = "http.host" + LOG_RECORD_UID = "log.record.uid" """ - The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header should also be reported, see note. - Note: When the header is present but empty the attribute SHOULD be set to the empty string. Note that this is a valid situation that is expected in certain cases, according the aforementioned [section of RFC 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not set the attribute MUST NOT be set. + 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. + The id MAY be an [Universally Unique Lexicographically Sortable Identifier (ULID)](https://github.com/ulid/spec), but other identifiers (e.g. UUID) may be used as needed. """ - HTTP_SCHEME = "http.scheme" + FEATURE_FLAG_KEY = "feature_flag.key" """ - The URI scheme identifying the used protocol. + The unique identifier of the feature flag. """ - HTTP_STATUS_CODE = "http.status_code" + FEATURE_FLAG_PROVIDER_NAME = "feature_flag.provider_name" """ - [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + The name of the service provider that performs the flag evaluation. """ - HTTP_FLAVOR = "http.flavor" + FEATURE_FLAG_VARIANT = "feature_flag.variant" """ - Kind of HTTP protocol used. - Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + 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 + for referring to a value without including the value itself. This can + provide additional context for understanding the meaning behind a value. + For example, the variant `red` maybe be used for the value `#c05543`. + + A stringified version of the value can be used in situations where a + semantic identifier is unavailable. String representation of the value + should be determined by the implementer. """ - HTTP_USER_AGENT = "http.user_agent" + LOG_IOSTREAM = "log.iostream" """ - Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. + The stream associated with the log. See below for a list of well-known values. """ - HTTP_REQUEST_CONTENT_LENGTH = "http.request_content_length" + LOG_FILE_NAME = "log.file.name" """ - 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://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size. + The basename of the file. """ - HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED = ( - "http.request_content_length_uncompressed" - ) + LOG_FILE_PATH = "log.file.path" """ - The size of the uncompressed request payload body after transport decoding. Not set if transport encoding not used. + The full path to the file. """ - HTTP_RESPONSE_CONTENT_LENGTH = "http.response_content_length" + LOG_FILE_NAME_RESOLVED = "log.file.name_resolved" """ - 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://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size. + The basename of the file, with symlinks resolved. """ - HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = ( - "http.response_content_length_uncompressed" - ) + LOG_FILE_PATH_RESOLVED = "log.file.path_resolved" """ - The size of the uncompressed response payload body after transport decoding. Not set if transport encoding not used. + The full path to the file, with symlinks resolved. """ - HTTP_RETRY_COUNT = "http.retry_count" + SERVER_SOCKET_ADDRESS = "server.socket.address" """ - The ordinal number of request re-sending attempt. + Physical server IP address or Unix socket address. If set from the client, should simply use the socket's peer address, and not attempt to find any actual server IP (i.e., if set from client, this may represent some proxy server instead of the logical server). """ - HTTP_SERVER_NAME = "http.server_name" + POOL = "pool" """ - The primary server name of the matched virtual host. This should be obtained via configuration. If no such configuration can be obtained, this attribute MUST NOT be set ( `net.host.name` should be used instead). - Note: `http.url` is usually not readily available on the server side but would have to be assembled in a cumbersome and sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available. + Name of the buffer pool. + Note: Pool names are generally obtained via [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()). """ - HTTP_ROUTE = "http.route" + TYPE = "type" """ - The matched route (path template). + The type of memory. """ - HTTP_CLIENT_IP = "http.client_ip" + SERVER_SOCKET_DOMAIN = "server.socket.domain" + """ + The domain name of an immediate peer. + Note: Typically observed from the client side, and represents a proxy or other intermediary domain name. """ - The IP address of the original client behind all proxies, if known (e.g. from [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). - Note: This is not necessarily the same as `net.peer.ip`, which would -identify the network-level peer, which may be a proxy. -This attribute should be set when a source of information different -from the one used for `net.peer.ip`, is available even if that other -source just confirms the same value as `net.peer.ip`. -Rationale: For `net.peer.ip`, one typically does not know if it -comes from a proxy, reverse proxy, or the actual client. Setting -`http.client_ip` when it's the same as `net.peer.ip` means that -one is at least somewhat confident that the address is not that of -the closest proxy. + SERVER_SOCKET_PORT = "server.socket.port" + """ + Physical server port. """ - NET_HOST_IP = "net.host.ip" + SOURCE_DOMAIN = "source.domain" """ - Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. + The domain name of the source system. + Note: This value may be a host name, a fully qualified domain name, or another host naming format. """ - NET_HOST_PORT = "net.host.port" + SOURCE_ADDRESS = "source.address" """ - Like `net.peer.port` but for the host port. + Source address, for example IP address or Unix socket name. """ - NET_HOST_NAME = "net.host.name" + SOURCE_PORT = "source.port" """ - Local hostname or similar, see note below. + Source port number. """ - NET_HOST_CONNECTION_TYPE = "net.host.connection.type" + AWS_LAMBDA_INVOKED_ARN = "aws.lambda.invoked_arn" """ - The internet connection type currently being used by the host. + 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. """ - NET_HOST_CONNECTION_SUBTYPE = "net.host.connection.subtype" + CLOUDEVENTS_EVENT_ID = "cloudevents.event_id" """ - 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. + The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) uniquely identifies the event. """ - NET_HOST_CARRIER_NAME = "net.host.carrier.name" + CLOUDEVENTS_EVENT_SOURCE = "cloudevents.event_source" """ - The name of the mobile carrier. + The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) identifies the context in which an event happened. """ - NET_HOST_CARRIER_MCC = "net.host.carrier.mcc" + CLOUDEVENTS_EVENT_SPEC_VERSION = "cloudevents.event_spec_version" """ - The mobile carrier country code. + The [version of the CloudEvents specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. """ - NET_HOST_CARRIER_MNC = "net.host.carrier.mnc" + CLOUDEVENTS_EVENT_TYPE = "cloudevents.event_type" """ - The mobile carrier network code. + 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. """ - NET_HOST_CARRIER_ICC = "net.host.carrier.icc" + CLOUDEVENTS_EVENT_SUBJECT = "cloudevents.event_subject" """ - The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. + 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). """ - MESSAGING_SYSTEM = "messaging.system" + OPENTRACING_REF_TYPE = "opentracing.ref_type" """ - A string identifying the messaging system. + Parent-child Reference type. + Note: The causal relationship between a child Span and a parent Span. """ - MESSAGING_DESTINATION = "messaging.destination" + DB_SYSTEM = "db.system" """ - The message destination name. This might be equal to the span name but is required nevertheless. + An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. """ - MESSAGING_DESTINATION_KIND = "messaging.destination_kind" + DB_CONNECTION_STRING = "db.connection_string" """ - The kind of message destination. + The connection string used to connect to the database. It is recommended to remove embedded credentials. """ - MESSAGING_TEMP_DESTINATION = "messaging.temp_destination" + DB_USER = "db.user" """ - A boolean that is true if the message destination is temporary. + Username for accessing the database. """ - MESSAGING_PROTOCOL = "messaging.protocol" + DB_JDBC_DRIVER_CLASSNAME = "db.jdbc.driver_classname" """ - The name of the transport protocol. + The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect. """ - MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version" + DB_NAME = "db.name" """ - The version of the transport protocol. + 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). """ - MESSAGING_URL = "messaging.url" + DB_STATEMENT = "db.statement" """ - Connection string. + The database statement being executed. """ - MESSAGING_MESSAGE_ID = "messaging.message_id" + DB_OPERATION = "db.operation" """ - A value used by the messaging system as an identifier for the message, represented as a string. + 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. """ - MESSAGING_CONVERSATION_ID = "messaging.conversation_id" + NETWORK_TRANSPORT = "network.transport" """ - The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". + [OSI Transport Layer](https://osi-model.com/transport-layer/) or [Inter-process Communication method](https://en.wikipedia.org/wiki/Inter-process_communication). The value SHOULD be normalized to lowercase. """ - MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES = ( - "messaging.message_payload_size_bytes" - ) + NETWORK_TYPE = "network.type" """ - The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported. + [OSI Network Layer](https://osi-model.com/network-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. """ - MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = ( - "messaging.message_payload_compressed_size_bytes" - ) + DB_MSSQL_INSTANCE_NAME = "db.mssql.instance_name" """ - The compressed size of the message payload in bytes. + The Microsoft SQL Server [instance name](https://docs.microsoft.com/en-us/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). """ - FAAS_TIME = "faas.time" + DB_CASSANDRA_PAGE_SIZE = "db.cassandra.page_size" """ - 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). + The fetch size used for paging, i.e. how many rows will be returned at once. """ - FAAS_CRON = "faas.cron" + DB_CASSANDRA_CONSISTENCY_LEVEL = "db.cassandra.consistency_level" """ - A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + 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). """ - FAAS_COLDSTART = "faas.coldstart" + DB_CASSANDRA_TABLE = "db.cassandra.table" """ - A boolean that is true if the serverless function is executed for the first time (aka cold-start). + The name of the primary table that the operation is acting upon, including the keyspace name (if applicable). + Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. """ - FAAS_INVOKED_NAME = "faas.invoked_name" + DB_CASSANDRA_IDEMPOTENCE = "db.cassandra.idempotence" """ - The name of the invoked function. - Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function. + Whether or not the query is idempotent. """ - FAAS_INVOKED_PROVIDER = "faas.invoked_provider" + DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( + "db.cassandra.speculative_execution_count" + ) """ - The cloud provider of the invoked function. - Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. + The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. """ - FAAS_INVOKED_REGION = "faas.invoked_region" + DB_CASSANDRA_COORDINATOR_ID = "db.cassandra.coordinator.id" """ - The cloud region of the invoked function. - Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function. + The ID of the coordinating node for a query. """ - PEER_SERVICE = "peer.service" + DB_CASSANDRA_COORDINATOR_DC = "db.cassandra.coordinator.dc" """ - The [`service.name`](../../resource/semantic_conventions/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any. + The data center of the coordinating node for a query. """ - ENDUSER_ID = "enduser.id" + DB_REDIS_DATABASE_INDEX = "db.redis.database_index" """ - 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. + 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. """ - ENDUSER_ROLE = "enduser.role" + DB_MONGODB_COLLECTION = "db.mongodb.collection" """ - Actual/assumed role the client is making the request under extracted from token or application security context. + The collection being accessed within the database stated in `db.name`. """ - ENDUSER_SCOPE = "enduser.scope" + URL_FULL = "url.full" """ - 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). + 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) and SHOULD NOT be validated or modified except for sanitizing purposes. """ - THREAD_ID = "thread.id" + DB_SQL_TABLE = "db.sql.table" """ - Current "managed" thread ID (as opposed to OS thread ID). + 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. """ - THREAD_NAME = "thread.name" + DB_COSMOSDB_CLIENT_ID = "db.cosmosdb.client_id" """ - Current thread name. + Unique Cosmos client instance id. """ - CODE_FUNCTION = "code.function" + DB_COSMOSDB_OPERATION_TYPE = "db.cosmosdb.operation_type" """ - The method or function name, or equivalent (usually rightmost part of the code unit's name). + CosmosDB Operation Type. """ - CODE_NAMESPACE = "code.namespace" + USER_AGENT_ORIGINAL = "user_agent.original" """ - 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. + Full user-agent string is generated by Cosmos DB SDK. + Note: The user-agent value is generated by SDK which is a combination of
`sdk_version` : Current version of SDK. e.g. 'cosmos-netstandard-sdk/3.23.0'
`direct_pkg_version` : Direct package version used by Cosmos DB SDK. e.g. '3.23.1'
`number_of_client_instances` : Number of cosmos client instances created by the application. e.g. '1'
`type_of_machine_architecture` : Machine architecture. e.g. 'X64'
`operating_system` : Operating System. e.g. 'Linux 5.4.0-1098-azure 104 18'
`runtime_framework` : Runtime Framework. e.g. '.NET Core 3.1.32'
`failover_information` : Generated key to determine if region failover enabled. + Format Reg-{D (Disabled discovery)}-S(application region)|L(List of preferred regions)|N(None, user did not configure it). + Default value is "NS". """ - CODE_FILEPATH = "code.filepath" + DB_COSMOSDB_CONNECTION_MODE = "db.cosmosdb.connection_mode" """ - The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). + Cosmos client connection mode. """ - CODE_LINENO = "code.lineno" + DB_COSMOSDB_CONTAINER = "db.cosmosdb.container" """ - The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. + Cosmos DB container name. """ - RPC_SYSTEM = "rpc.system" + DB_COSMOSDB_REQUEST_CONTENT_LENGTH = "db.cosmosdb.request_content_length" """ - The value `aws-api`. + Request payload size in bytes. """ - RPC_SERVICE = "rpc.service" + DB_COSMOSDB_STATUS_CODE = "db.cosmosdb.status_code" """ - The name of the service to which a request is made, as returned by the AWS SDK. - 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). + Cosmos DB status code. """ - RPC_METHOD = "rpc.method" + DB_COSMOSDB_SUB_STATUS_CODE = "db.cosmosdb.sub_status_code" """ - The name of the operation corresponding to the request, as returned by the AWS SDK. - 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). + Cosmos DB sub status code. """ - AWS_DYNAMODB_TABLE_NAMES = "aws.dynamodb.table_names" + DB_COSMOSDB_REQUEST_CHARGE = "db.cosmosdb.request_charge" """ - The keys in the `RequestItems` object field. + RU consumed for that operation. """ - AWS_DYNAMODB_CONSUMED_CAPACITY = "aws.dynamodb.consumed_capacity" + OTEL_STATUS_CODE = "otel.status_code" """ - The JSON-serialized value of each item in the `ConsumedCapacity` response field. + Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. + """ + + OTEL_STATUS_DESCRIPTION = "otel.status_description" + """ + Description of the Status if it has a value, otherwise not set. + """ + + FAAS_TRIGGER = "faas.trigger" + """ + Type of the trigger which caused this function invocation. + Note: For the server/consumer span on the incoming side, + `faas.trigger` MUST be set. + + Clients invoking FaaS instances usually cannot set `faas.trigger`, + since they would typically need to look in the payload to determine + the event type. If clients set it, it should be the same as the + trigger that corresponding incoming would have (i.e., this has + nothing to do with the underlying transport used to make the API + call to invoke the lambda, which is often HTTP). + """ + + FAAS_INVOCATION_ID = "faas.invocation_id" + """ + The invocation ID of the current function invocation. + """ + + CLOUD_RESOURCE_ID = "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/en-us/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, + so it may be necessary to set `cloud.resource_id` as a span attribute instead. + + The exact value to use for `cloud.resource_id` depends on the cloud provider. + The following well-known definitions MUST be used if you set this attribute and they apply: + + * **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). + Take care not to use the "invoked ARN" directly but replace any + [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) + with the resolved function version, as the same runtime instance may be invokable with + multiple different aliases. + * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names) + * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) of the invoked function, + *not* the function app, having the form + `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. + This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share + a TracerProvider. + """ + + FAAS_DOCUMENT_COLLECTION = "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_OPERATION = "faas.document.operation" + """ + Describes the type of the operation that was performed on the data. + """ + + FAAS_DOCUMENT_TIME = "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_DOCUMENT_NAME = "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. + """ + + URL_PATH = "url.path" + """ + The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component. + Note: When missing, the value is assumed to be `/`. + """ + + URL_QUERY = "url.query" + """ + The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component. + Note: Sensitive content provided in query string SHOULD be scrubbed when instrumentations can identify it. + """ + + MESSAGING_SYSTEM = "messaging.system" + """ + A string identifying the messaging system. + """ + + MESSAGING_OPERATION = "messaging.operation" + """ + A string identifying the kind of messaging operation as defined in the [Operation names](#operation-names) section above. + Note: If a custom value is used, it MUST be of low cardinality. + """ + + MESSAGING_BATCH_MESSAGE_COUNT = "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" + """ + A unique identifier for the client that consumes or produces a message. + """ + + MESSAGING_DESTINATION_NAME = "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 does not have such notion, the destination name SHOULD uniquely identify the broker. + """ + + MESSAGING_DESTINATION_TEMPLATE = "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" + """ + A boolean that is true if the message destination is temporary and might not exist anymore after messages are processed. + """ + + MESSAGING_DESTINATION_ANONYMOUS = "messaging.destination.anonymous" + """ + A boolean that is true if the message destination is anonymous (could be unnamed or have auto-generated name). + """ + + MESSAGING_MESSAGE_ID = "messaging.message.id" + """ + A value used by the messaging system as an identifier for the message, represented as a string. + """ + + MESSAGING_MESSAGE_CONVERSATION_ID = "messaging.message.conversation_id" + """ + The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". + """ + + MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES = ( + "messaging.message.payload_size_bytes" + ) + """ + The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported. + """ + + MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = ( + "messaging.message.payload_compressed_size_bytes" + ) + """ + The compressed size of the message payload in bytes. + """ + + FAAS_TIME = "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_CRON = "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_COLDSTART = "faas.coldstart" + """ + A boolean that is true if the serverless function is executed for the first time (aka cold-start). + """ + + FAAS_INVOKED_NAME = "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" + """ + 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" + """ + The cloud region of the invoked function. + Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function. + """ + + NETWORK_CONNECTION_TYPE = "network.connection.type" + """ + The internet connection type. + """ + + NETWORK_CONNECTION_SUBTYPE = "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_CARRIER_NAME = "network.carrier.name" + """ + The name of the mobile carrier. + """ + + NETWORK_CARRIER_MCC = "network.carrier.mcc" + """ + The mobile carrier country code. + """ + + NETWORK_CARRIER_MNC = "network.carrier.mnc" + """ + The mobile carrier network code. + """ + + NETWORK_CARRIER_ICC = "network.carrier.icc" + """ + The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. + """ + + PEER_SERVICE = "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. + """ + + ENDUSER_ID = "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" + """ + Actual/assumed role the client is making the request under extracted from token or application security context. + """ + + ENDUSER_SCOPE = "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). + """ + + THREAD_ID = "thread.id" + """ + Current "managed" thread ID (as opposed to OS thread ID). + """ + + THREAD_NAME = "thread.name" + """ + Current thread name. + """ + + CODE_FUNCTION = "code.function" + """ + The method or function name, or equivalent (usually rightmost part of the code unit's name). + """ + + CODE_NAMESPACE = "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_FILEPATH = "code.filepath" + """ + The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). + """ + + CODE_LINENO = "code.lineno" + """ + The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. + """ + + CODE_COLUMN = "code.column" + """ + The column number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. + """ + + HTTP_REQUEST_METHOD_ORIGINAL = "http.request.method_original" + """ + Original HTTP method sent by the client in the request line. + """ + + HTTP_REQUEST_BODY_SIZE = "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_RESPONSE_BODY_SIZE = "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_RESEND_COUNT = "http.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). + """ + + RPC_SYSTEM = "rpc.system" + """ + The value `aws-api`. + """ + + RPC_SERVICE = "rpc.service" + """ + The name of the service to which a request is made, as returned by the AWS SDK. + 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_METHOD = "rpc.method" + """ + The name of the operation corresponding to the request, as returned by the AWS SDK. + 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). + """ + + AWS_REQUEST_ID = "aws.request_id" + """ + The AWS request ID as returned in the response headers `x-amz-request-id` or `x-amz-requestid`. + """ + + AWS_DYNAMODB_TABLE_NAMES = "aws.dynamodb.table_names" + """ + The keys in the `RequestItems` object field. + """ + + AWS_DYNAMODB_CONSUMED_CAPACITY = "aws.dynamodb.consumed_capacity" + """ + The JSON-serialized value of each item in the `ConsumedCapacity` response field. """ AWS_DYNAMODB_ITEM_COLLECTION_METRICS = ( @@ -632,171 +946,664 @@ class SpanAttributes: The value of the `ExclusiveStartTableName` request parameter. """ - AWS_DYNAMODB_TABLE_COUNT = "aws.dynamodb.table_count" - """ - The the number of items in the `TableNames` response parameter. - """ + AWS_DYNAMODB_TABLE_COUNT = "aws.dynamodb.table_count" + """ + The the number of items in the `TableNames` response parameter. + """ + + AWS_DYNAMODB_SCAN_FORWARD = "aws.dynamodb.scan_forward" + """ + The value of the `ScanIndexForward` request parameter. + """ + + AWS_DYNAMODB_SEGMENT = "aws.dynamodb.segment" + """ + The value of the `Segment` request parameter. + """ + + AWS_DYNAMODB_TOTAL_SEGMENTS = "aws.dynamodb.total_segments" + """ + The value of the `TotalSegments` request parameter. + """ + + AWS_DYNAMODB_COUNT = "aws.dynamodb.count" + """ + The value of the `Count` response parameter. + """ + + AWS_DYNAMODB_SCANNED_COUNT = "aws.dynamodb.scanned_count" + """ + The value of the `ScannedCount` response parameter. + """ + + AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS = "aws.dynamodb.attribute_definitions" + """ + The JSON-serialized value of each item in the `AttributeDefinitions` request field. + """ + + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = ( + "aws.dynamodb.global_secondary_index_updates" + ) + """ + The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field. + """ + + AWS_S3_BUCKET = "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_KEY = "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. + This applies in particular to the following operations: + + - [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) + - [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) + - [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) + - [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) + - [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) + - [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) + - [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) + - [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + - [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + - [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) + - [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + - [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_COPY_SOURCE = "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 + of the [copy-object operation within the S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). + This applies in particular to the following operations: + + - [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_UPLOAD_ID = "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 + of the [S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) multipart operations. + This applies in particular to the following operations: + + - [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) + - [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) + - [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) + - [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_DELETE = "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_PART_NUMBER = "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) + and [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) operations. + 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). + """ + + GRAPHQL_OPERATION_NAME = "graphql.operation.name" + """ + The name of the operation being executed. + """ + + GRAPHQL_OPERATION_TYPE = "graphql.operation.type" + """ + The type of the operation being executed. + """ + + GRAPHQL_DOCUMENT = "graphql.document" + """ + The GraphQL document being executed. + Note: The value may be sanitized to exclude sensitive information. + """ + + MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = ( + "messaging.rabbitmq.destination.routing_key" + ) + """ + RabbitMQ message routing key. + """ + + MESSAGING_KAFKA_MESSAGE_KEY = "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_CONSUMER_GROUP = "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" + ) + """ + Partition the message is sent to. + """ + + MESSAGING_KAFKA_MESSAGE_OFFSET = "messaging.kafka.message.offset" + """ + The offset of a record in the corresponding Kafka partition. + """ + + MESSAGING_KAFKA_MESSAGE_TOMBSTONE = "messaging.kafka.message.tombstone" + """ + A boolean that is true if the message is a tombstone. + """ + + MESSAGING_ROCKETMQ_NAMESPACE = "messaging.rocketmq.namespace" + """ + Namespace of RocketMQ resources, resources in different namespaces are individual. + """ + + MESSAGING_ROCKETMQ_CLIENT_GROUP = "messaging.rocketmq.client_group" + """ + Name of the RocketMQ producer/consumer group that is handling the message. The client type is identified by the SpanKind. + """ + + MESSAGING_ROCKETMQ_MESSAGE_DELIVERY_TIMESTAMP = ( + "messaging.rocketmq.message.delivery_timestamp" + ) + """ + The timestamp in milliseconds that the delay message is expected to be delivered to consumer. + """ + + MESSAGING_ROCKETMQ_MESSAGE_DELAY_TIME_LEVEL = ( + "messaging.rocketmq.message.delay_time_level" + ) + """ + The delay time level for delay message, which determines the message delay time. + """ + + MESSAGING_ROCKETMQ_MESSAGE_GROUP = "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_TYPE = "messaging.rocketmq.message.type" + """ + Type of message. + """ + + MESSAGING_ROCKETMQ_MESSAGE_TAG = "messaging.rocketmq.message.tag" + """ + The secondary classifier of message besides topic. + """ + + MESSAGING_ROCKETMQ_MESSAGE_KEYS = "messaging.rocketmq.message.keys" + """ + Key(s) of message, another way to mark message besides message id. + """ + + MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = ( + "messaging.rocketmq.consumption_model" + ) + """ + Model of message consumption. This only applies to consumer spans. + """ + + RPC_GRPC_STATUS_CODE = "rpc.grpc.status_code" + """ + The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + """ + + RPC_JSONRPC_VERSION = "rpc.jsonrpc.version" + """ + Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 does not specify this, the value can be omitted. + """ + + RPC_JSONRPC_REQUEST_ID = "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_ERROR_CODE = "rpc.jsonrpc.error_code" + """ + `error.code` property of response if it is an error response. + """ + + RPC_JSONRPC_ERROR_MESSAGE = "rpc.jsonrpc.error_message" + """ + `error.message` property of response if it is an error response. + """ + + MESSAGE_TYPE = "message.type" + """ + Whether this is a received or sent message. + """ + + MESSAGE_ID = "message.id" + """ + MUST be calculated as two different counters starting from `1` one for sent messages and one for received message. + Note: This way we guarantee that the values will be consistent between different implementations. + """ + + MESSAGE_COMPRESSED_SIZE = "message.compressed_size" + """ + Compressed size of the message in bytes. + """ + + MESSAGE_UNCOMPRESSED_SIZE = "message.uncompressed_size" + """ + Uncompressed size of the message in bytes. + """ + + RPC_CONNECT_RPC_ERROR_CODE = "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. + """ + + EXCEPTION_ESCAPED = "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, + if that span is ended while the exception is still logically "in flight". + This may be actually "in flight" in some languages (e.g. if the exception + is passed to a Context manager's `__exit__` method in Python) but will + usually be caught at the point of recording the exception in most languages. + + It is usually not possible to determine at the point where an exception is thrown + whether it will escape the scope of a span. + However, it is trivial to know that an exception + will escape, if one checks for an active exception just before ending the span, + as done in the [example above](#recording-an-exception). + + It follows that an exception may still escape the scope of the span + even if the `exception.escaped` attribute was not set or set to false, + since the event might have been recorded at a time where it was not + clear whether the exception will escape. + """ + + URL_FRAGMENT = "url.fragment" + """ + The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component. + """ + + # Manually defined deprecated attributes + + NET_PEER_IP = "net.peer.ip" + """ + Deprecated, use the `client.socket.address` attribute. + """ + + NET_HOST_IP = "net.host.ip" + """ + Deprecated, use the `server.socket.address` attribute. + """ + + HTTP_SERVER_NAME = "http.server_name" + """ + Deprecated, use the `server.address` attribute. + """ + + HTTP_HOST = "http.host" + """ + Deprecated, use the `server.address` and `server.port` attributes. + """ + + HTTP_RETRY_COUNT = "http.retry_count" + """ + Deprecated, use the `http.resend_count` attribute. + """ + + HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED = ( + "http.request_content_length_uncompressed" + ) + """ + Deprecated, use the `http.request.body.size` attribute. + """ + + HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = ( + "http.response_content_length_uncompressed" + ) + """ + Deprecated, use the `http.response.body.size` attribute. + """ + + MESSAGING_DESTINATION = "messaging.destination" + """ + Deprecated, use the `messaging.destination.name` attribute. + """ + + MESSAGING_DESTINATION_KIND = "messaging.destination_kind" + """ + Deprecated. + """ + + MESSAGING_TEMP_DESTINATION = "messaging.temp_destination" + """ + Deprecated. Use `messaging.destination.temporary` attribute. + """ + + MESSAGING_PROTOCOL = "messaging.protocol" + """ + Deprecated. Use `network.protocol.name` attribute. + """ + + MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version" + """ + Deprecated. Use `network.protocol.version` attribute. + """ + + MESSAGING_URL = "messaging.url" + """ + Deprecated. Use `server.address` and `server.port` attributes. + """ + + MESSAGING_CONVERSATION_ID = "messaging.conversation_id" + """ + Deprecated. Use `messaging.message.conversation.id` attribute. + """ + + MESSAGING_KAFKA_PARTITION = "messaging.kafka.partition" + """ + Deprecated. Use `messaging.kafka.destination.partition` attribute. + """ + + FAAS_EXECUTION = "faas.execution" + """ + Deprecated. Use `faas.invocation_id` attribute. + """ + + HTTP_USER_AGENT = "http.user_agent" + """ + Deprecated. Use `user_agent.original` attribute. + """ + + MESSAGING_RABBITMQ_ROUTING_KEY = "messaging.rabbitmq.routing_key" + """ + Deprecated. Use `messaging.rabbitmq.destination.routing_key` attribute. + """ + + MESSAGING_KAFKA_TOMBSTONE = "messaging.kafka.tombstone" + """ + Deprecated. Use `messaging.kafka.destination.tombstone` attribute. + """ + + NET_APP_PROTOCOL_NAME = "net.app.protocol.name" + """ + Deprecated. Use `network.protocol.name` attribute. + """ + + NET_APP_PROTOCOL_VERSION = "net.app.protocol.version" + """ + Deprecated. Use `network.protocol.version` attribute. + """ + + HTTP_CLIENT_IP = "http.client_ip" + """ + Deprecated. Use `client.address` attribute. + """ + + HTTP_FLAVOR = "http.flavor" + """ + Deprecated. Use `network.protocol.name` and `network.protocol.version` attributes. + """ + + NET_HOST_CONNECTION_TYPE = "net.host.connection.type" + """ + Deprecated. Use `network.connection.type` attribute. + """ + + NET_HOST_CONNECTION_SUBTYPE = "net.host.connection.subtype" + """ + Deprecated. Use `network.connection.subtype` attribute. + """ + + NET_HOST_CARRIER_NAME = "net.host.carrier.name" + """ + Deprecated. Use `network.carrier.name` attribute. + """ + + NET_HOST_CARRIER_MCC = "net.host.carrier.mcc" + """ + Deprecated. Use `network.carrier.mcc` attribute. + """ + + NET_HOST_CARRIER_MNC = "net.host.carrier.mnc" + """ + Deprecated. Use `network.carrier.mnc` attribute. + """ + + MESSAGING_CONSUMER_ID = "messaging.consumer_id" + """ + Deprecated. Use `messaging.client_id` attribute. + """ + + MESSAGING_KAFKA_CLIENT_ID = "messaging.kafka.client_id" + """ + Deprecated. Use `messaging.client_id` attribute. + """ + + MESSAGING_ROCKETMQ_CLIENT_ID = "messaging.rocketmq.client_id" + """ + Deprecated. Use `messaging.client_id` attribute. + """ + + +@deprecated( + version="1.18.0", + reason="Removed from the specification in favor of `network.protocol.name` and `network.protocol.version` attributes", +) +class HttpFlavorValues(Enum): + HTTP_1_0 = "1.0" + + HTTP_1_1 = "1.1" + + HTTP_2_0 = "2.0" + + HTTP_3_0 = "3.0" + + SPDY = "SPDY" + + QUIC = "QUIC" + + +@deprecated( + version="1.18.0", + reason="Removed from the specification", +) +class MessagingDestinationKindValues(Enum): + QUEUE = "queue" + """A message sent to a queue.""" + + TOPIC = "topic" + """A message sent to a topic.""" + + +@deprecated( + version="1.21.0", + reason="Renamed to NetworkConnectionTypeValues", +) +class NetHostConnectionTypeValues(Enum): + WIFI = "wifi" + """wifi.""" + + WIRED = "wired" + """wired.""" + + CELL = "cell" + """cell.""" + + UNAVAILABLE = "unavailable" + """unavailable.""" + + UNKNOWN = "unknown" + """unknown.""" + + +@deprecated( + version="1.21.0", + reason="Renamed to NetworkConnectionSubtypeValues", +) +class NetHostConnectionSubtypeValues(Enum): + GPRS = "gprs" + """GPRS.""" + + EDGE = "edge" + """EDGE.""" + + UMTS = "umts" + """UMTS.""" + + CDMA = "cdma" + """CDMA.""" + + EVDO_0 = "evdo_0" + """EVDO Rel. 0.""" + + EVDO_A = "evdo_a" + """EVDO Rev. A.""" + + CDMA2000_1XRTT = "cdma2000_1xrtt" + """CDMA2000 1XRTT.""" + + HSDPA = "hsdpa" + """HSDPA.""" + + HSUPA = "hsupa" + """HSUPA.""" + + HSPA = "hspa" + """HSPA.""" + + IDEN = "iden" + """IDEN.""" + + EVDO_B = "evdo_b" + """EVDO Rev. B.""" + + LTE = "lte" + """LTE.""" + + EHRPD = "ehrpd" + """EHRPD.""" + + HSPAP = "hspap" + """HSPAP.""" + + GSM = "gsm" + """GSM.""" + + TD_SCDMA = "td_scdma" + """TD-SCDMA.""" + + IWLAN = "iwlan" + """IWLAN.""" + + NR = "nr" + """5G NR (New Radio).""" + + NRNSA = "nrnsa" + """5G NRNSA (New Radio Non-Standalone).""" + + LTE_CA = "lte_ca" + """LTE CA.""" - AWS_DYNAMODB_SCAN_FORWARD = "aws.dynamodb.scan_forward" - """ - The value of the `ScanIndexForward` request parameter. - """ - AWS_DYNAMODB_SEGMENT = "aws.dynamodb.segment" - """ - The value of the `Segment` request parameter. - """ +class NetTransportValues(Enum): + IP_TCP = "ip_tcp" + """ip_tcp.""" - AWS_DYNAMODB_TOTAL_SEGMENTS = "aws.dynamodb.total_segments" - """ - The value of the `TotalSegments` request parameter. - """ + IP_UDP = "ip_udp" + """ip_udp.""" - AWS_DYNAMODB_COUNT = "aws.dynamodb.count" - """ - The value of the `Count` response parameter. - """ + PIPE = "pipe" + """Named or anonymous pipe.""" - AWS_DYNAMODB_SCANNED_COUNT = "aws.dynamodb.scanned_count" - """ - The value of the `ScannedCount` response parameter. - """ + INPROC = "inproc" + """In-process communication.""" - AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS = "aws.dynamodb.attribute_definitions" - """ - The JSON-serialized value of each item in the `AttributeDefinitions` request field. - """ + OTHER = "other" + """Something else (non IP-based).""" - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = ( - "aws.dynamodb.global_secondary_index_updates" - ) - """ - The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field. - """ - MESSAGING_OPERATION = "messaging.operation" - """ - A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case. - """ +class NetSockFamilyValues(Enum): + INET = "inet" + """IPv4 address.""" - MESSAGING_CONSUMER_ID = "messaging.consumer_id" - """ - The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer_group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. - """ + INET6 = "inet6" + """IPv6 address.""" - MESSAGING_RABBITMQ_ROUTING_KEY = "messaging.rabbitmq.routing_key" - """ - RabbitMQ message routing key. - """ + UNIX = "unix" + """Unix domain socket path.""" - MESSAGING_KAFKA_MESSAGE_KEY = "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_CONSUMER_GROUP = "messaging.kafka.consumer_group" - """ - Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. - """ +class HttpRequestMethodValues(Enum): + CONNECT = "CONNECT" + """CONNECT method.""" - MESSAGING_KAFKA_CLIENT_ID = "messaging.kafka.client_id" - """ - Client Id for the Consumer or Producer that is handling the message. - """ + DELETE = "DELETE" + """DELETE method.""" - MESSAGING_KAFKA_PARTITION = "messaging.kafka.partition" - """ - Partition the message is sent to. - """ + GET = "GET" + """GET method.""" - MESSAGING_KAFKA_TOMBSTONE = "messaging.kafka.tombstone" - """ - A boolean that is true if the message is a tombstone. - """ + HEAD = "HEAD" + """HEAD method.""" - MESSAGING_ROCKETMQ_NAMESPACE = "messaging.rocketmq.namespace" - """ - Namespace of RocketMQ resources, resources in different namespaces are individual. - """ + OPTIONS = "OPTIONS" + """OPTIONS method.""" - MESSAGING_ROCKETMQ_CLIENT_GROUP = "messaging.rocketmq.client_group" - """ - Name of the RocketMQ producer/consumer group that is handling the message. The client type is identified by the SpanKind. - """ + PATCH = "PATCH" + """PATCH method.""" - MESSAGING_ROCKETMQ_CLIENT_ID = "messaging.rocketmq.client_id" - """ - The unique identifier for each client. - """ + POST = "POST" + """POST method.""" - MESSAGING_ROCKETMQ_MESSAGE_TYPE = "messaging.rocketmq.message_type" - """ - Type of message. - """ + PUT = "PUT" + """PUT method.""" - MESSAGING_ROCKETMQ_MESSAGE_TAG = "messaging.rocketmq.message_tag" - """ - The secondary classifier of message besides topic. - """ + TRACE = "TRACE" + """TRACE method.""" - MESSAGING_ROCKETMQ_MESSAGE_KEYS = "messaging.rocketmq.message_keys" - """ - Key(s) of message, another way to mark message besides message id. - """ + OTHER = "_OTHER" + """Any HTTP method that the instrumentation has no prior knowledge of.""" - MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = ( - "messaging.rocketmq.consumption_model" - ) - """ - Model of message consumption. This only applies to consumer spans. - """ - RPC_GRPC_STATUS_CODE = "rpc.grpc.status_code" - """ - The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. - """ +class EventDomainValues(Enum): + BROWSER = "browser" + """Events from browser apps.""" - RPC_JSONRPC_VERSION = "rpc.jsonrpc.version" - """ - Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 does not specify this, the value can be omitted. - """ + DEVICE = "device" + """Events from mobile apps.""" - RPC_JSONRPC_REQUEST_ID = "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. - """ + K8S = "k8s" + """Events from Kubernetes.""" - RPC_JSONRPC_ERROR_CODE = "rpc.jsonrpc.error_code" - """ - `error.code` property of response if it is an error response. - """ - RPC_JSONRPC_ERROR_MESSAGE = "rpc.jsonrpc.error_message" - """ - `error.message` property of response if it is an error response. - """ +class LogIostreamValues(Enum): + STDOUT = "stdout" + """Logs from stdout stream.""" - MESSAGE_TYPE = "message.type" - """ - Whether this is a received or sent message. - """ + STDERR = "stderr" + """Events from stderr stream.""" - MESSAGE_ID = "message.id" - """ - MUST be calculated as two different counters starting from `1` one for sent messages and one for received message. - Note: This way we guarantee that the values will be consistent between different implementations. - """ - MESSAGE_COMPRESSED_SIZE = "message.compressed_size" - """ - Compressed size of the message in bytes. - """ +class TypeValues(Enum): + HEAP = "heap" + """Heap memory.""" - MESSAGE_UNCOMPRESSED_SIZE = "message.uncompressed_size" - """ - Uncompressed size of the message in bytes. - """ + NON_HEAP = "non_heap" + """Non-heap memory.""" class OpentracingRefTypeValues(Enum): @@ -814,6 +1621,9 @@ class DbSystemValues(Enum): MSSQL = "mssql" """Microsoft SQL Server.""" + MSSQLCOMPACT = "mssqlcompact" + """Microsoft SQL Server Compact.""" + MYSQL = "mysql" """MySQL.""" @@ -949,28 +1759,39 @@ class DbSystemValues(Enum): COCKROACHDB = "cockroachdb" """CockroachDB.""" + OPENSEARCH = "opensearch" + """OpenSearch.""" -class NetTransportValues(Enum): - IP_TCP = "ip_tcp" - """ip_tcp.""" + CLICKHOUSE = "clickhouse" + """ClickHouse.""" - IP_UDP = "ip_udp" - """ip_udp.""" + SPANNER = "spanner" + """Cloud Spanner.""" - IP = "ip" - """Another IP-based protocol.""" + TRINO = "trino" + """Trino.""" - UNIX = "unix" - """Unix Domain socket. See below.""" + +class NetworkTransportValues(Enum): + TCP = "tcp" + """TCP.""" + + UDP = "udp" + """UDP.""" PIPE = "pipe" """Named or anonymous pipe. See note below.""" - INPROC = "inproc" - """In-process communication.""" + UNIX = "unix" + """Unix domain socket.""" - OTHER = "other" - """Something else (non IP-based).""" + +class NetworkTypeValues(Enum): + IPV4 = "ipv4" + """IPv4.""" + + IPV6 = "ipv6" + """IPv6.""" class DbCassandraConsistencyLevelValues(Enum): @@ -1008,6 +1829,69 @@ class DbCassandraConsistencyLevelValues(Enum): """local_serial.""" +class DbCosmosdbOperationTypeValues(Enum): + INVALID = "Invalid" + """invalid.""" + + CREATE = "Create" + """create.""" + + PATCH = "Patch" + """patch.""" + + READ = "Read" + """read.""" + + READ_FEED = "ReadFeed" + """read_feed.""" + + DELETE = "Delete" + """delete.""" + + REPLACE = "Replace" + """replace.""" + + EXECUTE = "Execute" + """execute.""" + + QUERY = "Query" + """query.""" + + HEAD = "Head" + """head.""" + + HEAD_FEED = "HeadFeed" + """head_feed.""" + + UPSERT = "Upsert" + """upsert.""" + + BATCH = "Batch" + """batch.""" + + QUERY_PLAN = "QueryPlan" + """query_plan.""" + + EXECUTE_JAVASCRIPT = "ExecuteJavaScript" + """execute_javascript.""" + + +class DbCosmosdbConnectionModeValues(Enum): + GATEWAY = "gateway" + """Gateway (HTTP) connections mode.""" + + DIRECT = "direct" + """Direct connection.""" + + +class OtelStatusCodeValues(Enum): + OK = "OK" + """The operation has been validated by an Application developer or Operator to have completed successfully.""" + + ERROR = "ERROR" + """The operation contains an error.""" + + class FaasTriggerValues(Enum): DATASOURCE = "datasource" """A response to some data source operation such as a database or filesystem read/write.""" @@ -1036,27 +1920,35 @@ class FaasDocumentOperationValues(Enum): """When an object is deleted.""" -class HttpFlavorValues(Enum): - HTTP_1_0 = "1.0" - """HTTP/1.0.""" +class MessagingOperationValues(Enum): + PUBLISH = "publish" + """publish.""" - HTTP_1_1 = "1.1" - """HTTP/1.1.""" + RECEIVE = "receive" + """receive.""" - HTTP_2_0 = "2.0" - """HTTP/2.""" + PROCESS = "process" + """process.""" - HTTP_3_0 = "3.0" - """HTTP/3.""" - SPDY = "SPDY" - """SPDY protocol.""" +class FaasInvokedProviderValues(Enum): + ALIBABA_CLOUD = "alibaba_cloud" + """Alibaba Cloud.""" - QUIC = "QUIC" - """QUIC protocol.""" + AWS = "aws" + """Amazon Web Services.""" + AZURE = "azure" + """Microsoft Azure.""" -class NetHostConnectionTypeValues(Enum): + GCP = "gcp" + """Google Cloud Platform.""" + + TENCENT_CLOUD = "tencent_cloud" + """Tencent Cloud.""" + + +class NetworkConnectionTypeValues(Enum): WIFI = "wifi" """wifi.""" @@ -1073,7 +1965,7 @@ class NetHostConnectionTypeValues(Enum): """unknown.""" -class NetHostConnectionSubtypeValues(Enum): +class NetworkConnectionSubtypeValues(Enum): GPRS = "gprs" """GPRS.""" @@ -1138,31 +2030,6 @@ class NetHostConnectionSubtypeValues(Enum): """LTE CA.""" -class MessagingDestinationKindValues(Enum): - QUEUE = "queue" - """A message sent to a queue.""" - - TOPIC = "topic" - """A message sent to a topic.""" - - -class FaasInvokedProviderValues(Enum): - ALIBABA_CLOUD = "alibaba_cloud" - """Alibaba Cloud.""" - - AWS = "aws" - """Amazon Web Services.""" - - AZURE = "azure" - """Microsoft Azure.""" - - GCP = "gcp" - """Google Cloud Platform.""" - - TENCENT_CLOUD = "tencent_cloud" - """Tencent Cloud.""" - - class RpcSystemValues(Enum): GRPC = "grpc" """gRPC.""" @@ -1176,13 +2043,19 @@ class RpcSystemValues(Enum): APACHE_DUBBO = "apache_dubbo" """Apache Dubbo.""" + CONNECT_RPC = "connect_rpc" + """Connect RPC.""" -class MessagingOperationValues(Enum): - RECEIVE = "receive" - """receive.""" - PROCESS = "process" - """process.""" +class GraphqlOperationTypeValues(Enum): + QUERY = "query" + """GraphQL query.""" + + MUTATION = "mutation" + """GraphQL mutation.""" + + SUBSCRIPTION = "subscription" + """GraphQL subscription.""" class MessagingRocketmqMessageTypeValues(Enum): @@ -1266,3 +2139,53 @@ class MessageTypeValues(Enum): RECEIVED = "RECEIVED" """received.""" + + +class RpcConnectRpcErrorCodeValues(Enum): + CANCELLED = "cancelled" + """cancelled.""" + + UNKNOWN = "unknown" + """unknown.""" + + INVALID_ARGUMENT = "invalid_argument" + """invalid_argument.""" + + DEADLINE_EXCEEDED = "deadline_exceeded" + """deadline_exceeded.""" + + NOT_FOUND = "not_found" + """not_found.""" + + ALREADY_EXISTS = "already_exists" + """already_exists.""" + + PERMISSION_DENIED = "permission_denied" + """permission_denied.""" + + RESOURCE_EXHAUSTED = "resource_exhausted" + """resource_exhausted.""" + + FAILED_PRECONDITION = "failed_precondition" + """failed_precondition.""" + + ABORTED = "aborted" + """aborted.""" + + OUT_OF_RANGE = "out_of_range" + """out_of_range.""" + + UNIMPLEMENTED = "unimplemented" + """unimplemented.""" + + INTERNAL = "internal" + """internal.""" + + UNAVAILABLE = "unavailable" + """unavailable.""" + + DATA_LOSS = "data_loss" + """data_loss.""" + + UNAUTHENTICATED = "unauthenticated" + """unauthenticated.""" diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index 866832fe6b3..3a453db025d 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -4,39 +4,56 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec version to make SemanticAttributes generation reproducible -SPEC_VERSION=v1.11.0 -OTEL_SEMCONV_GEN_IMG_VERSION=0.11.1 +SPEC_VERSION=v1.21.0 +SCHEMA_URL=https://opentelemetry.io/schemas/$SPEC_VERSION +OTEL_SEMCONV_GEN_IMG_VERSION=0.21.0 cd ${SCRIPT_DIR} -rm -rf opentelemetry-specification || true -mkdir opentelemetry-specification -cd opentelemetry-specification +rm -rf semantic-conventions || true +mkdir semantic-conventions +cd semantic-conventions git init -git remote add origin https://github.com/open-telemetry/opentelemetry-specification.git +git remote add origin https://github.com/open-telemetry/semantic-conventions.git git fetch origin "$SPEC_VERSION" git reset --hard FETCH_HEAD cd ${SCRIPT_DIR} docker run --rm \ - -v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/trace:/source \ + -v ${SCRIPT_DIR}/semantic-conventions/model:/source \ -v ${SCRIPT_DIR}/templates:/templates \ -v ${ROOT_DIR}/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/:/output \ otel/semconvgen:$OTEL_SEMCONV_GEN_IMG_VERSION \ + --only span,event,attribute_group \ -f /source code \ --template /templates/semantic_attributes.j2 \ --output /output/__init__.py \ - -Dclass=SpanAttributes + -Dclass=SpanAttributes \ + -DschemaUrl=$SCHEMA_URL docker run --rm \ - -v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/resource:/source \ + -v ${SCRIPT_DIR}/semantic-conventions/model:/source \ -v ${SCRIPT_DIR}/templates:/templates \ -v ${ROOT_DIR}/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/:/output \ otel/semconvgen:$OTEL_SEMCONV_GEN_IMG_VERSION \ + --only resource \ -f /source code \ --template /templates/semantic_attributes.j2 \ --output /output/__init__.py \ - -Dclass=ResourceAttributes + -Dclass=ResourceAttributes \ + -DschemaUrl=$SCHEMA_URL + +docker run --rm \ + -v ${SCRIPT_DIR}/semantic-conventions/model:/source \ + -v ${SCRIPT_DIR}/templates:/templates \ + -v ${ROOT_DIR}/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/:/output \ + otel/semconvgen:$OTEL_SEMCONV_GEN_IMG_VERSION \ + --only metric \ + -f /source code \ + --template /templates/semantic_metrics.j2 \ + --output /output/__init__.py \ + -Dclass=MetricInstruments \ + -DschemaUrl=$SCHEMA_URL cd "$ROOT_DIR" diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index 32d3f18a1ba..7e48d747683 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -12,22 +12,32 @@ # See the License for the specific language governing permissions and # limitations under the License. - +# pylint: disable=too-many-lines {%- macro print_value(type, value) -%} {{ "\"" if type == "string"}}{{value}}{{ "\"" if type == "string"}} {%- endmacro %} from enum import Enum +{%- if class == "SpanAttributes" %} + +from deprecated import deprecated + +{%- endif %} + class {{class}}: + SCHEMA_URL = "{{schemaUrl}}" + """ + The URL of the OpenTelemetry schema for these keys and values. + """ {%- for attribute in attributes | unique(attribute="fqn") %} {{attribute.fqn | to_const_name}} = "{{attribute.fqn}}" """ {{attribute.brief | to_doc_brief}}. {%- if attribute.note %} - Note: {{attribute.note | to_doc_brief}}. + Note: {{attribute.note | to_doc_brief | indent}}. {%- endif %} {%- if attribute.deprecated %} @@ -37,6 +47,315 @@ class {{class}}: {# Extra line #} {%- endfor %} + {%- if class == "SpanAttributes" %} + # Manually defined deprecated attributes + {# + Deprecated attributes and types are defined here for backward compatibility reasons. + They were removed from OpenTelemetry semantic conventions completely. + + Attributes that were deprecated in OpenTelemetry semantic conventions + (https://github.com/open-telemetry/semantic-conventions/tree/main/model/deprecated) + are auto-generated with comments indicating deprecated status, so they don't need + to be manually defined. + #} + + NET_PEER_IP = "net.peer.ip" + """ + Deprecated, use the `client.socket.address` attribute. + """ + + NET_HOST_IP = "net.host.ip" + """ + Deprecated, use the `server.socket.address` attribute. + """ + + HTTP_SERVER_NAME = "http.server_name" + """ + Deprecated, use the `server.address` attribute. + """ + + HTTP_HOST = "http.host" + """ + Deprecated, use the `server.address` and `server.port` attributes. + """ + + HTTP_RETRY_COUNT = "http.retry_count" + """ + Deprecated, use the `http.resend_count` attribute. + """ + + HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED = ( + "http.request_content_length_uncompressed" + ) + """ + Deprecated, use the `http.request.body.size` attribute. + """ + + HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = ( + "http.response_content_length_uncompressed" + ) + """ + Deprecated, use the `http.response.body.size` attribute. + """ + + MESSAGING_DESTINATION = "messaging.destination" + """ + Deprecated, use the `messaging.destination.name` attribute. + """ + + MESSAGING_DESTINATION_KIND = "messaging.destination_kind" + """ + Deprecated. + """ + + MESSAGING_TEMP_DESTINATION = "messaging.temp_destination" + """ + Deprecated. Use `messaging.destination.temporary` attribute. + """ + + MESSAGING_PROTOCOL = "messaging.protocol" + """ + Deprecated. Use `network.protocol.name` attribute. + """ + + MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version" + """ + Deprecated. Use `network.protocol.version` attribute. + """ + + MESSAGING_URL = "messaging.url" + """ + Deprecated. Use `server.address` and `server.port` attributes. + """ + + MESSAGING_CONVERSATION_ID = "messaging.conversation_id" + """ + Deprecated. Use `messaging.message.conversation.id` attribute. + """ + + MESSAGING_KAFKA_PARTITION = "messaging.kafka.partition" + """ + Deprecated. Use `messaging.kafka.destination.partition` attribute. + """ + + FAAS_EXECUTION = "faas.execution" + """ + Deprecated. Use `faas.invocation_id` attribute. + """ + + HTTP_USER_AGENT = "http.user_agent" + """ + Deprecated. Use `user_agent.original` attribute. + """ + + MESSAGING_RABBITMQ_ROUTING_KEY = "messaging.rabbitmq.routing_key" + """ + Deprecated. Use `messaging.rabbitmq.destination.routing_key` attribute. + """ + + MESSAGING_KAFKA_TOMBSTONE = "messaging.kafka.tombstone" + """ + Deprecated. Use `messaging.kafka.destination.tombstone` attribute. + """ + + NET_APP_PROTOCOL_NAME = "net.app.protocol.name" + """ + Deprecated. Use `network.protocol.name` attribute. + """ + + NET_APP_PROTOCOL_VERSION = "net.app.protocol.version" + """ + Deprecated. Use `network.protocol.version` attribute. + """ + + HTTP_CLIENT_IP = "http.client_ip" + """ + Deprecated. Use `client.address` attribute. + """ + + HTTP_FLAVOR = "http.flavor" + """ + Deprecated. Use `network.protocol.name` and `network.protocol.version` attributes. + """ + + NET_HOST_CONNECTION_TYPE = "net.host.connection.type" + """ + Deprecated. Use `network.connection.type` attribute. + """ + + NET_HOST_CONNECTION_SUBTYPE = "net.host.connection.subtype" + """ + Deprecated. Use `network.connection.subtype` attribute. + """ + + NET_HOST_CARRIER_NAME = "net.host.carrier.name" + """ + Deprecated. Use `network.carrier.name` attribute. + """ + + NET_HOST_CARRIER_MCC = "net.host.carrier.mcc" + """ + Deprecated. Use `network.carrier.mcc` attribute. + """ + + NET_HOST_CARRIER_MNC = "net.host.carrier.mnc" + """ + Deprecated. Use `network.carrier.mnc` attribute. + """ + + MESSAGING_CONSUMER_ID = "messaging.consumer_id" + """ + Deprecated. Use `messaging.client_id` attribute. + """ + + MESSAGING_KAFKA_CLIENT_ID = "messaging.kafka.client_id" + """ + Deprecated. Use `messaging.client_id` attribute. + """ + + MESSAGING_ROCKETMQ_CLIENT_ID = "messaging.rocketmq.client_id" + """ + Deprecated. Use `messaging.client_id` attribute. + """ + +@deprecated( + version="1.18.0", + reason="Removed from the specification in favor of `network.protocol.name` and `network.protocol.version` attributes", +) +class HttpFlavorValues(Enum): + HTTP_1_0 = "1.0" + + HTTP_1_1 = "1.1" + + HTTP_2_0 = "2.0" + + HTTP_3_0 = "3.0" + + SPDY = "SPDY" + + QUIC = "QUIC" + +@deprecated( + version="1.18.0", + reason="Removed from the specification", +) +class MessagingDestinationKindValues(Enum): + QUEUE = "queue" + """A message sent to a queue.""" + + TOPIC = "topic" + """A message sent to a topic.""" + + +@deprecated( + version="1.21.0", + reason="Renamed to NetworkConnectionTypeValues", +) +class NetHostConnectionTypeValues(Enum): + WIFI = "wifi" + """wifi.""" + + WIRED = "wired" + """wired.""" + + CELL = "cell" + """cell.""" + + UNAVAILABLE = "unavailable" + """unavailable.""" + + UNKNOWN = "unknown" + """unknown.""" + + +@deprecated( + version="1.21.0", + reason="Renamed to NetworkConnectionSubtypeValues", +) +class NetHostConnectionSubtypeValues(Enum): + GPRS = "gprs" + """GPRS.""" + + EDGE = "edge" + """EDGE.""" + + UMTS = "umts" + """UMTS.""" + + CDMA = "cdma" + """CDMA.""" + + EVDO_0 = "evdo_0" + """EVDO Rel. 0.""" + + EVDO_A = "evdo_a" + """EVDO Rev. A.""" + + CDMA2000_1XRTT = "cdma2000_1xrtt" + """CDMA2000 1XRTT.""" + + HSDPA = "hsdpa" + """HSDPA.""" + + HSUPA = "hsupa" + """HSUPA.""" + + HSPA = "hspa" + """HSPA.""" + + IDEN = "iden" + """IDEN.""" + + EVDO_B = "evdo_b" + """EVDO Rev. B.""" + + LTE = "lte" + """LTE.""" + + EHRPD = "ehrpd" + """EHRPD.""" + + HSPAP = "hspap" + """HSPAP.""" + + GSM = "gsm" + """GSM.""" + + TD_SCDMA = "td_scdma" + """TD-SCDMA.""" + + IWLAN = "iwlan" + """IWLAN.""" + + NR = "nr" + """5G NR (New Radio).""" + + NRNSA = "nrnsa" + """5G NRNSA (New Radio Non-Standalone).""" + + LTE_CA = "lte_ca" + """LTE CA.""" + + {% endif %} + + {%- if class == "ResourceAttributes" %} + # Manually defined deprecated attributes + {# + Deprecated attributes and types are defined here for backward compatibility reasons. + They were removed from OpenTelemetry semantic conventions completely. + + Attributes that were deprecated in OpenTelemetry semantic conventions + (https://github.com/open-telemetry/semantic-conventions/tree/main/model/deprecated) + are auto-generated with comments indicating deprecated status, so they don't need + to be manually defined. + #} + + FAAS_ID = "faas.id" + """ + Deprecated, use the `cloud.resource.id` attribute. + """ + {% endif %} + {%- for attribute in attributes | unique(attribute="fqn") %} {%- if attribute.is_enum %} {%- set class_name = attribute.fqn | to_camelcase(True) ~ "Values" %} diff --git a/scripts/semconv/templates/semantic_metrics.j2 b/scripts/semconv/templates/semantic_metrics.j2 new file mode 100644 index 00000000000..4fa1260cb56 --- /dev/null +++ b/scripts/semconv/templates/semantic_metrics.j2 @@ -0,0 +1,40 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +class {{class}}: + SCHEMA_URL = "{{schemaUrl}}" + """ + The URL of the OpenTelemetry schema for these keys and values. + """ + {% for id in semconvs %}{%- if semconvs[id].GROUP_TYPE_NAME == 'metric' %}{% set metric = semconvs[id] %} + {{metric.metric_name | to_const_name}} = "{{metric.metric_name}}" + """ + {{metric.brief | to_doc_brief}} + Instrument: {{ metric.instrument }} + Unit: {{ metric.unit }} + """ +{# Extra line #} + {%- endif %}{% endfor %} + + # Manually defined metrics + {# + Metrics defined here manually were not yaml-ified in 1.21.0 release + and therefore are not auto-generated. + #} + DB_CLIENT_CONNECTIONS_USAGE = "db.client.connections.usage" + """ + The number of connections that are currently in state described by the `state` attribute + Instrument: UpDownCounter + Unit: {connection} + """ \ No newline at end of file