From fccd7c8b7c8f595c04ac12a80a67ad6127e73555 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 5 Apr 2023 22:45:25 -0700 Subject: [PATCH 01/22] Update semconv to 1.20.0 version --- docs/examples/django/README.rst | 10 +- .../semconv/resource/__init__.py | 322 +++-- .../opentelemetry/semconv/trace/__init__.py | 1094 +++++++++++------ scripts/semconv/generate.sh | 10 +- .../semconv/templates/semantic_attributes.j2 | 115 +- 5 files changed, 1075 insertions(+), 476 deletions(-) diff --git a/docs/examples/django/README.rst b/docs/examples/django/README.rst index 2e071127ff2..37dca9cc624 100644 --- a/docs/examples/django/README.rst +++ b/docs/examples/django/README.rst @@ -85,14 +85,12 @@ output similar to this one: }, "attributes": { "http.method": "GET", - "http.server_name": "localhost", + "net.peer.name": "localhost", "http.scheme": "http", - "host.port": 8000, - "http.host": "localhost:8000", + "net.peer.port": 8000, "http.url": "http://localhost:8000/?param=hello", - "net.peer.ip": "127.0.0.1", - "http.flavor": "1.1", - "http.status_text": "OK", + "net.sock.peer.addr": "127.0.0.1", + "net.protocol.version": "1.1", "http.status_code": 200 }, "events": [], diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index 028fedd6df1..d9a8335f759 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -14,172 +14,235 @@ from enum import Enum - class ResourceAttributes: + 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. - """ + """ CLOUD_ACCOUNT_ID = "cloud.account.id" """ The cloud account ID the resource is assigned to. - """ + """ 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" """ Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running. Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. - """ + """ CLOUD_PLATFORM = "cloud.platform" """ The cloud platform in use. Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. - """ + """ AWS_ECS_CONTAINER_ARN = "aws.ecs.container.arn" """ The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). - """ + """ AWS_ECS_CLUSTER_ARN = "aws.ecs.cluster.arn" """ The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). - """ + """ AWS_ECS_LAUNCHTYPE = "aws.ecs.launchtype" """ The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. - """ + """ AWS_ECS_TASK_ARN = "aws.ecs.task.arn" """ The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). - """ + """ AWS_ECS_TASK_FAMILY = "aws.ecs.task.family" """ The task definition family this task definition is a member of. - """ + """ AWS_ECS_TASK_REVISION = "aws.ecs.task.revision" """ The revision for this task definition. - """ + """ AWS_EKS_CLUSTER_ARN = "aws.eks.cluster.arn" """ The ARN of an EKS cluster. - """ + """ AWS_LOG_GROUP_NAMES = "aws.log.group.names" """ The name(s) of the AWS log group(s) an application is writing to. Note: Multiple log groups must be supported for cases like multi-container applications, where a single application has sidecar containers, and each write to their own log group. - """ + """ AWS_LOG_GROUP_ARNS = "aws.log.group.arns" """ The Amazon Resource Name(s) (ARN) of the AWS log group(s). Note: See the [log group ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). - """ + """ AWS_LOG_STREAM_NAMES = "aws.log.stream.names" """ The name(s) of the AWS log stream(s) an application is writing to. - """ + """ AWS_LOG_STREAM_ARNS = "aws.log.stream.arns" """ The ARN(s) of the AWS log stream(s). Note: See the [log stream ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain several log streams, so these ARNs necessarily identify both a log group and a log stream. + """ + + 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. - """ + """ CONTAINER_ID = "container.id" """ Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated. - """ + """ CONTAINER_RUNTIME = "container.runtime" """ The container runtime managing this container. - """ + """ CONTAINER_IMAGE_NAME = "container.image.name" """ Name of the image the container was built on. - """ + """ CONTAINER_IMAGE_TAG = "container.image.tag" """ Container image tag. - """ + """ DEPLOYMENT_ENVIRONMENT = "deployment.environment" """ Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka deployment tier). - """ + """ DEVICE_ID = "device.id" """ A unique identifier representing the device. Note: The device identifier MUST only be defined using the values outlined below. This value is not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation ID or a globally unique UUID which is persisted across sessions in your application. More information can be found [here](https://developer.android.com/training/articles/user-data-ids) on best practices and exact implementation details. Caution should be taken when storing personal data or anything which can identify a user. GDPR and data protection laws may apply, ensure you do your own due diligence. - """ + """ DEVICE_MODEL_IDENTIFIER = "device.model.identifier" """ The model identifier for the device. Note: It's recommended this value represents a machine readable version of the model identifier rather than the market or consumer-friendly name of the device. - """ + """ DEVICE_MODEL_NAME = "device.model.name" """ The marketing name for the device model. Note: It's recommended this value represents a human readable version of the device model rather than a machine readable alternative. - """ + """ DEVICE_MANUFACTURER = "device.manufacturer" """ The name of the device manufacturer. Note: The Android OS provides this field via [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). iOS apps SHOULD hardcode the value `Apple`. - """ + """ 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). - """ - - 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). - -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. - """ + 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). + +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: + +* **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" """ @@ -193,284 +256,315 @@ class ResourceAttributes: * **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" """ The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version. Note: * **AWS Lambda:** Use the (full) log stream name. - """ + """ FAAS_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" """ Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user. - """ + """ HOST_TYPE = "host.type" """ Type of host. For Cloud, this must be the machine type. - """ + """ HOST_ARCH = "host.arch" """ The CPU architecture the host system is running on. - """ + """ HOST_IMAGE_NAME = "host.image.name" """ Name of the VM image or OS install the host was instantiated from. - """ + """ HOST_IMAGE_ID = "host.image.id" """ VM 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). - """ + """ K8S_CLUSTER_NAME = "k8s.cluster.name" """ The name of the cluster. - """ + """ K8S_NODE_NAME = "k8s.node.name" """ The name of the Node. - """ + """ K8S_NODE_UID = "k8s.node.uid" """ The UID of the Node. - """ + """ K8S_NAMESPACE_NAME = "k8s.namespace.name" """ The name of the namespace that the pod is running in. - """ + """ K8S_POD_UID = "k8s.pod.uid" """ The UID of the Pod. - """ + """ K8S_POD_NAME = "k8s.pod.name" """ The name of the Pod. - """ + """ K8S_CONTAINER_NAME = "k8s.container.name" """ The name of the Container from Pod specification, must be unique within a Pod. Container runtime usually uses different globally unique name (`container.name`). - """ + """ K8S_CONTAINER_RESTART_COUNT = "k8s.container.restart_count" """ Number of times the container was restarted. This attribute can be used to identify a particular container (running or stopped) within a container spec. - """ + """ K8S_REPLICASET_UID = "k8s.replicaset.uid" """ The UID of the ReplicaSet. - """ + """ K8S_REPLICASET_NAME = "k8s.replicaset.name" """ The name of the ReplicaSet. - """ + """ K8S_DEPLOYMENT_UID = "k8s.deployment.uid" """ The UID of the Deployment. - """ + """ K8S_DEPLOYMENT_NAME = "k8s.deployment.name" """ The name of the Deployment. - """ + """ K8S_STATEFULSET_UID = "k8s.statefulset.uid" """ The UID of the StatefulSet. - """ + """ K8S_STATEFULSET_NAME = "k8s.statefulset.name" """ The name of the StatefulSet. - """ + """ K8S_DAEMONSET_UID = "k8s.daemonset.uid" """ The UID of the DaemonSet. - """ + """ K8S_DAEMONSET_NAME = "k8s.daemonset.name" """ The name of the DaemonSet. - """ + """ K8S_JOB_UID = "k8s.job.uid" """ The UID of the Job. - """ + """ K8S_JOB_NAME = "k8s.job.name" """ The name of the Job. - """ + """ K8S_CRONJOB_UID = "k8s.cronjob.uid" """ The UID of the CronJob. - """ + """ K8S_CRONJOB_NAME = "k8s.cronjob.name" """ The name of the CronJob. - """ + """ OS_TYPE = "os.type" """ The operating system type. - """ + """ OS_DESCRIPTION = "os.description" """ Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands. - """ + """ OS_NAME = "os.name" """ Human readable operating system name. - """ + """ OS_VERSION = "os.version" """ The version string of the operating system as defined in [Version Attributes](../../resource/semantic_conventions/README.md#version-attributes). - """ + """ PROCESS_PID = "process.pid" """ 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`. - """ + """ PROCESS_EXECUTABLE_PATH = "process.executable.path" """ The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. - """ + """ PROCESS_COMMAND = "process.command" """ The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`. - """ + """ PROCESS_COMMAND_LINE = "process.command_line" """ The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to assemble it just for monitoring; use `process.command_args` instead. - """ + """ PROCESS_COMMAND_ARGS = "process.command_args" """ All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`. - """ + """ PROCESS_OWNER = "process.owner" """ The username of the user that owns the process. - """ + """ PROCESS_RUNTIME_NAME = "process.runtime.name" """ The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of the compiler. - """ + """ PROCESS_RUNTIME_VERSION = "process.runtime.version" """ The version of the runtime of this process, as returned by the runtime without modification. - """ + """ PROCESS_RUNTIME_DESCRIPTION = "process.runtime.description" """ An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment. - """ + """ SERVICE_NAME = "service.name" """ Logical name of the service. Note: MUST be the same for all instances of horizontally scaled services. If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value MUST be set to `unknown_service`. - """ + """ SERVICE_NAMESPACE = "service.namespace" """ A namespace for `service.name`. Note: A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace. - """ + """ SERVICE_INSTANCE_ID = "service.instance.id" """ The string ID of the service instance. Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words `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. - """ + """ TELEMETRY_SDK_LANGUAGE = "telemetry.sdk.language" """ The language of the telemetry SDK. - """ + """ TELEMETRY_SDK_VERSION = "telemetry.sdk.version" """ The version string of the telemetry SDK. - """ + """ TELEMETRY_AUTO_VERSION = "telemetry.auto.version" """ The version string of the auto instrumentation agent, if used. - """ + """ WEBENGINE_NAME = "webengine.name" """ The name of the web engine. - """ + """ WEBENGINE_VERSION = "webengine.version" """ The version of the web engine. - """ + """ WEBENGINE_DESCRIPTION = "webengine.description" """ 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" """Alibaba Cloud.""" @@ -484,6 +578,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 +595,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 +616,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 +634,9 @@ class CloudPlatformValues(Enum): AZURE_APP_SERVICE = "azure_app_service" """Azure App Service.""" + AZURE_OPENSHIFT = "azure_openshift" + """Azure Red Hat OpenShift.""" + GCP_COMPUTE_ENGINE = "gcp_compute_engine" """Google Cloud Compute Engine (GCE).""" @@ -543,6 +652,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).""" @@ -655,3 +770,4 @@ class TelemetrySdkLanguageValues(Enum): SWIFT = "swift" """swift.""" + diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index 36bab3d1a13..1c3a8d3e6e2 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -12,207 +12,300 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=too-many-lines - from enum import Enum - class SpanAttributes: + EXCEPTION_TYPE = "exception.type" + """ + The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. + """ + + EXCEPTION_MESSAGE = "exception.message" + """ + The exception message. + """ + + EXCEPTION_STACKTRACE = "exception.stacktrace" + """ + A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. + """ + + HTTP_METHOD = "http.method" + """ + HTTP request method. + """ + + HTTP_STATUS_CODE = "http.status_code" + """ + [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + """ + + HTTP_FLAVOR = "http.flavor" + """ + Kind of HTTP protocol used. + """ + + NET_PEER_NAME = "net.peer.name" + """ + 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. + """ + + NET_PEER_PORT = "net.peer.port" + """ + 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, `net.peer.name` MUST match URI port identifier, otherwise it MUST match `Host` header port identifier. + """ + + HTTP_SCHEME = "http.scheme" + """ + The URI scheme identifying the used protocol. + """ + + HTTP_ROUTE = "http.route" + """ + 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](/specification/trace/semantic_conventions/http.md#http-server-definitions) if there is one. + """ + + NET_HOST_NAME = "net.host.name" + """ + Name of the local HTTP server that received the request. + Note: Determined by using the first of the following that applies + +- The [primary server name](/specification/trace/semantic_conventions/http.md#http-server-definitions) of the matched virtual host. MUST only + include host identifier. +- 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 only IP address is available and capturing name would require a reverse DNS lookup. + """ + + NET_HOST_PORT = "net.host.port" + """ + Port of the local HTTP server that received the request. + Note: Determined by using the first of the following that applies + +- Port identifier of the [primary server host](/specification/trace/semantic_conventions/http.md#http-server-definitions) of the matched virtual host. +- Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) + if it's sent in absolute-form. +- Port identifier of the `Host` header. + """ + + EVENT_NAME = "event.name" + """ + The name identifies the event. + """ + + EVENT_DOMAIN = "event.domain" + """ + The domain identifies the business context for the events. + Note: Events across different domains may have same `event.name`, yet be +unrelated events. + """ + + FEATURE_FLAG_KEY = "feature_flag.key" + """ + The unique identifier of the feature flag. + """ + + FEATURE_FLAG_PROVIDER_NAME = "feature_flag.provider_name" + """ + The name of the service provider that performs the flag evaluation. + """ + + FEATURE_FLAG_VARIANT = "feature_flag.variant" + """ + SHOULD be a semantic identifier for a value. If one is unavailable, a stringified version of the value can be used. + Note: A semantic identifier, commonly referred to as a variant, provides a means +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. + """ + AWS_LAMBDA_INVOKED_ARN = "aws.lambda.invoked_arn" """ The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable). - Note: This may be different from `faas.id` if an alias is involved. - """ + Note: This may be different from `cloud.resource_id` if an alias is involved. + """ CLOUDEVENTS_EVENT_ID = "cloudevents.event_id" """ The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) uniquely identifies the event. - """ + """ CLOUDEVENTS_EVENT_SOURCE = "cloudevents.event_source" """ The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) identifies the context in which an event happened. - """ + """ CLOUDEVENTS_EVENT_SPEC_VERSION = "cloudevents.event_spec_version" """ The [version of the CloudEvents specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. - """ + """ CLOUDEVENTS_EVENT_TYPE = "cloudevents.event_type" """ The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) contains a value describing the type of event related to the originating occurrence. - """ + """ CLOUDEVENTS_EVENT_SUBJECT = "cloudevents.event_subject" """ The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) of the event in the context of the event producer (identified by source). - """ + """ OPENTRACING_REF_TYPE = "opentracing.ref_type" """ Parent-child Reference type. Note: The causal relationship between a child Span and a parent Span. - """ + """ DB_SYSTEM = "db.system" """ An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. - """ + """ DB_CONNECTION_STRING = "db.connection_string" """ The connection string used to connect to the database. It is recommended to remove embedded credentials. - """ + """ DB_USER = "db.user" """ Username for accessing the database. - """ + """ DB_JDBC_DRIVER_CLASSNAME = "db.jdbc.driver_classname" """ 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. - """ + """ DB_NAME = "db.name" """ This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails). Note: In some SQL databases, the database name to be used is called "schema name". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name). - """ + """ DB_STATEMENT = "db.statement" """ The database statement being executed. Note: The value may be sanitized to exclude sensitive information. - """ + """ DB_OPERATION = "db.operation" """ The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword. Note: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted. - """ + """ - NET_PEER_NAME = "net.peer.name" - """ - Remote hostname or similar, see note below. - Note: `net.peer.name` SHOULD NOT be set if capturing it would require an extra DNS lookup. + NET_SOCK_PEER_ADDR = "net.sock.peer.addr" """ + Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local communication, [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). + """ - NET_PEER_IP = "net.peer.ip" - """ - Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6). + NET_SOCK_PEER_PORT = "net.sock.peer.port" """ + Remote socket peer port. + """ - NET_PEER_PORT = "net.peer.port" + NET_SOCK_FAMILY = "net.sock.family" """ - Remote port number. + Protocol [address family](https://man7.org/linux/man-pages/man7/address_families.7.html) which is used for communication. + """ + + NET_SOCK_PEER_NAME = "net.sock.peer.name" """ + Remote socket peer name. + """ NET_TRANSPORT = "net.transport" """ Transport protocol used. See note below. - """ + """ DB_MSSQL_INSTANCE_NAME = "db.mssql.instance_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). - """ + """ DB_CASSANDRA_PAGE_SIZE = "db.cassandra.page_size" """ The fetch size used for paging, i.e. how many rows will be returned at once. - """ + """ DB_CASSANDRA_CONSISTENCY_LEVEL = "db.cassandra.consistency_level" """ The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). - """ + """ DB_CASSANDRA_TABLE = "db.cassandra.table" """ 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. - """ + """ DB_CASSANDRA_IDEMPOTENCE = "db.cassandra.idempotence" """ Whether or not the query is idempotent. - """ + """ - DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( - "db.cassandra.speculative_execution_count" - ) + DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = "db.cassandra.speculative_execution_count" """ The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. - """ + """ DB_CASSANDRA_COORDINATOR_ID = "db.cassandra.coordinator.id" """ The ID of the coordinating node for a query. - """ + """ DB_CASSANDRA_COORDINATOR_DC = "db.cassandra.coordinator.dc" """ The data center of the coordinating node for a query. - """ + """ DB_REDIS_DATABASE_INDEX = "db.redis.database_index" """ The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. - """ + """ DB_MONGODB_COLLECTION = "db.mongodb.collection" """ The collection being accessed within the database stated in `db.name`. - """ + """ DB_SQL_TABLE = "db.sql.table" """ The name of the primary table that the operation is acting upon, including the database name (if applicable). Note: It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. - """ - - EXCEPTION_TYPE = "exception.type" - """ - The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. - """ + """ - EXCEPTION_MESSAGE = "exception.message" - """ - The exception message. + OTEL_STATUS_CODE = "otel.status_code" """ + Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. + """ - EXCEPTION_STACKTRACE = "exception.stacktrace" - """ - A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. - """ - - EXCEPTION_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. + 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 execution. + Type of the trigger which caused this function invocation. Note: For the server/consumer span on the incoming side, `faas.trigger` MUST be set. @@ -222,581 +315,777 @@ class SpanAttributes: trigger that corresponding incoming would have (i.e., this has nothing to do with the underlying transport used to make the API call to invoke the lambda, which is often HTTP). - """ + """ - FAAS_EXECUTION = "faas.execution" + FAAS_INVOCATION_ID = "faas.invocation_id" """ - The execution ID of the current function execution. + 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. - """ - - HTTP_METHOD = "http.method" - """ - HTTP request method. - """ - - HTTP_URL = "http.url" - """ - 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/`. - """ + """ HTTP_TARGET = "http.target" """ The full request target as passed in a HTTP request line or equivalent. - """ - - HTTP_HOST = "http.host" - """ - The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header should also be reported, see note. - Note: When the header is present but empty the attribute SHOULD be set to the empty string. Note that this is a valid situation that is expected in certain cases, according the aforementioned [section of RFC 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not set the attribute MUST NOT be set. - """ + """ - HTTP_SCHEME = "http.scheme" - """ - The URI scheme identifying the used protocol. - """ - - HTTP_STATUS_CODE = "http.status_code" - """ - [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). - """ - - HTTP_FLAVOR = "http.flavor" - """ - 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. - """ - - HTTP_USER_AGENT = "http.user_agent" - """ - Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. + HTTP_CLIENT_IP = "http.client_ip" """ + The IP address of the original client behind all proxies, if known (e.g. from [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). + Note: This is not necessarily the same as `net.sock.peer.addr`, which would +identify the network-level peer, which may be a proxy. - HTTP_REQUEST_CONTENT_LENGTH = "http.request_content_length" - """ - 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. - """ +This attribute should be set when a source of information different +from the one used for `net.sock.peer.addr`, is available even if that other +source just confirms the same value as `net.sock.peer.addr`. +Rationale: For `net.sock.peer.addr`, 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.sock.peer.addr` means that +one is at least somewhat confident that the address is not that of +the closest proxy. + """ - HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED = ( - "http.request_content_length_uncompressed" - ) - """ - The size of the uncompressed request payload body after transport decoding. Not set if transport encoding not used. + NET_SOCK_HOST_ADDR = "net.sock.host.addr" """ + Local socket address. Useful in case of a multi-IP host. + """ - HTTP_RESPONSE_CONTENT_LENGTH = "http.response_content_length" - """ - 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. + NET_SOCK_HOST_PORT = "net.sock.host.port" """ + Local socket port number. + """ - HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = ( - "http.response_content_length_uncompressed" - ) - """ - The size of the uncompressed response payload body after transport decoding. Not set if transport encoding not used. + MESSAGING_SYSTEM = "messaging.system" """ + A string identifying the messaging system. + """ - HTTP_RETRY_COUNT = "http.retry_count" - """ - The ordinal number of request re-sending attempt. + 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. + """ - HTTP_SERVER_NAME = "http.server_name" - """ - 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. + 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. + """ - HTTP_ROUTE = "http.route" - """ - The matched route (path template). + MESSAGING_MESSAGE_ID = "messaging.message.id" """ + A value used by the messaging system as an identifier for the message, represented as a string. + """ - HTTP_CLIENT_IP = "http.client_ip" + MESSAGING_MESSAGE_CONVERSATION_ID = "messaging.message.conversation_id" """ - 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. + The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". + """ -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. + 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. + """ - NET_HOST_IP = "net.host.ip" - """ - Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. + MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = "messaging.message.payload_compressed_size_bytes" """ + The compressed size of the message payload in bytes. + """ - NET_HOST_PORT = "net.host.port" - """ - Like `net.peer.port` but for the host port. + NET_APP_PROTOCOL_NAME = "net.app.protocol.name" """ + Application layer protocol used. The value SHOULD be normalized to lowercase. + """ - NET_HOST_NAME = "net.host.name" - """ - Local hostname or similar, see note below. + NET_APP_PROTOCOL_VERSION = "net.app.protocol.version" """ + Version of the application layer protocol used. See note below. + Note: `net.app.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`. + """ NET_HOST_CONNECTION_TYPE = "net.host.connection.type" """ The internet connection type currently being used by the host. - """ + """ NET_HOST_CONNECTION_SUBTYPE = "net.host.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. - """ + """ NET_HOST_CARRIER_NAME = "net.host.carrier.name" """ The name of the mobile carrier. - """ + """ NET_HOST_CARRIER_MCC = "net.host.carrier.mcc" """ The mobile carrier country code. - """ + """ NET_HOST_CARRIER_MNC = "net.host.carrier.mnc" """ The mobile carrier network code. - """ + """ NET_HOST_CARRIER_ICC = "net.host.carrier.icc" """ The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. - """ - - MESSAGING_SYSTEM = "messaging.system" - """ - A string identifying the messaging system. - """ - - MESSAGING_DESTINATION = "messaging.destination" - """ - The message destination name. This might be equal to the span name but is required nevertheless. - """ - - MESSAGING_DESTINATION_KIND = "messaging.destination_kind" - """ - The kind of message destination. - """ - - MESSAGING_TEMP_DESTINATION = "messaging.temp_destination" - """ - A boolean that is true if the message destination is temporary. - """ - - MESSAGING_PROTOCOL = "messaging.protocol" - """ - The name of the transport protocol. - """ - - MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version" - """ - The version of the transport protocol. - """ - - MESSAGING_URL = "messaging.url" - """ - Connection string. - """ - - MESSAGING_MESSAGE_ID = "messaging.message_id" - """ - A value used by the messaging system as an identifier for the message, represented as a string. - """ - - MESSAGING_CONVERSATION_ID = "messaging.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. - """ + """ PEER_SERVICE = "peer.service" """ 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. - """ + """ 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_CONTENT_LENGTH = "http.request_content_length" + """ + 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_CONTENT_LENGTH = "http.response_content_length" """ + 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. + """ + + USER_AGENT_ORIGINAL = "user_agent.original" + """ + Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. + """ + + HTTP_URL = "http.url" + """ + 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/`. + """ + + 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_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 = ( - "aws.dynamodb.item_collection_metrics" - ) + AWS_DYNAMODB_ITEM_COLLECTION_METRICS = "aws.dynamodb.item_collection_metrics" """ The JSON-serialized value of the `ItemCollectionMetrics` response field. - """ + """ - AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = ( - "aws.dynamodb.provisioned_read_capacity" - ) + AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = "aws.dynamodb.provisioned_read_capacity" """ The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. - """ + """ - AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = ( - "aws.dynamodb.provisioned_write_capacity" - ) + AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = "aws.dynamodb.provisioned_write_capacity" """ The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. - """ + """ AWS_DYNAMODB_CONSISTENT_READ = "aws.dynamodb.consistent_read" """ The value of the `ConsistentRead` request parameter. - """ + """ AWS_DYNAMODB_PROJECTION = "aws.dynamodb.projection" """ The value of the `ProjectionExpression` request parameter. - """ + """ AWS_DYNAMODB_LIMIT = "aws.dynamodb.limit" """ The value of the `Limit` request parameter. - """ + """ AWS_DYNAMODB_ATTRIBUTES_TO_GET = "aws.dynamodb.attributes_to_get" """ The value of the `AttributesToGet` request parameter. - """ + """ AWS_DYNAMODB_INDEX_NAME = "aws.dynamodb.index_name" """ The value of the `IndexName` request parameter. - """ + """ AWS_DYNAMODB_SELECT = "aws.dynamodb.select" """ The value of the `Select` request parameter. - """ + """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = ( - "aws.dynamodb.global_secondary_indexes" - ) + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = "aws.dynamodb.global_secondary_indexes" """ The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. - """ + """ - AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = ( - "aws.dynamodb.local_secondary_indexes" - ) + AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = "aws.dynamodb.local_secondary_indexes" """ The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. - """ + """ AWS_DYNAMODB_EXCLUSIVE_START_TABLE = "aws.dynamodb.exclusive_start_table" """ 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_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. + """ + + 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. + """ - AWS_DYNAMODB_COUNT = "aws.dynamodb.count" + GRAPHQL_DOCUMENT = "graphql.document" """ - The value of the `Count` response parameter. + The GraphQL document being executed. + Note: The value may be sanitized to exclude sensitive information. + """ + + 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. + """ - AWS_DYNAMODB_SCANNED_COUNT = "aws.dynamodb.scanned_count" + MESSAGING_SOURCE_NAME = "messaging.source.name" """ - The value of the `ScannedCount` response parameter. + The message source name. + Note: Source name SHOULD uniquely identify a specific queue, topic, or other entity within the broker. If +the broker does not have such notion, the source name SHOULD uniquely identify the broker. + """ + + MESSAGING_DESTINATION_KIND = "messaging.destination.kind" """ + The kind of message destination. + """ - AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS = "aws.dynamodb.attribute_definitions" + MESSAGING_DESTINATION_TEMPLATE = "messaging.destination.template" """ - The JSON-serialized value of each item in the `AttributeDefinitions` request field. + 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. + """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = ( - "aws.dynamodb.global_secondary_index_updates" - ) + MESSAGING_DESTINATION_ANONYMOUS = "messaging.destination.anonymous" """ - The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field. + A boolean that is true if the message destination is anonymous (could be unnamed or have auto-generated name). + """ + + MESSAGING_SOURCE_KIND = "messaging.source.kind" """ + The kind of message source. + """ - MESSAGING_OPERATION = "messaging.operation" + MESSAGING_SOURCE_TEMPLATE = "messaging.source.template" """ - 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. + Low cardinality representation of the messaging source name. + Note: Source names could be constructed from templates. An example would be a source name involving a user name or product id. Although the source 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_SOURCE_TEMPORARY = "messaging.source.temporary" """ + A boolean that is true if the message source is temporary and might not exist anymore after messages are processed. + """ - MESSAGING_CONSUMER_ID = "messaging.consumer_id" + MESSAGING_SOURCE_ANONYMOUS = "messaging.source.anonymous" """ - 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. + A boolean that is true if the message source is anonymous (could be unnamed or have auto-generated name). + """ + + MESSAGING_CONSUMER_ID = "messaging.consumer.id" """ + The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer.group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. + """ - MESSAGING_RABBITMQ_ROUTING_KEY = "messaging.rabbitmq.routing_key" + MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = "messaging.rabbitmq.destination.routing_key" """ RabbitMQ message routing key. - """ + """ - MESSAGING_KAFKA_MESSAGE_KEY = "messaging.kafka.message_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. + 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" + 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_CLIENT_ID = "messaging.kafka.client_id" """ Client Id for the Consumer or Producer that is handling the message. - """ + """ - MESSAGING_KAFKA_PARTITION = "messaging.kafka.partition" + MESSAGING_KAFKA_DESTINATION_PARTITION = "messaging.kafka.destination.partition" """ Partition the message is sent to. + """ + + MESSAGING_KAFKA_SOURCE_PARTITION = "messaging.kafka.source.partition" """ + Partition the message is received from. + """ - MESSAGING_KAFKA_TOMBSTONE = "messaging.kafka.tombstone" + MESSAGING_KAFKA_MESSAGE_OFFSET = "messaging.kafka.message.offset" """ - A boolean that is true if the message is a tombstone. + 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_CLIENT_ID = "messaging.rocketmq.client_id" """ The unique identifier for each client. + """ + + 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_TYPE = "messaging.rocketmq.message_type" + MESSAGING_ROCKETMQ_MESSAGE_DELAY_TIME_LEVEL = "messaging.rocketmq.message.delay_time_level" """ - Type of message. + 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_TAG = "messaging.rocketmq.message_tag" + MESSAGING_ROCKETMQ_MESSAGE_TYPE = "messaging.rocketmq.message.type" """ - The secondary classifier of message besides topic. + 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" + 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" - ) + 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. + """ + + # Manually defined deprecated attributes + + NET_PEER_IP = "net.peer.ip" + """ + Deprecated, use the `net.peer.sock.addr` attribute. + """ + + NET_HOST_IP = "net.host.ip" + """ + Deprecated, use the `net.host.sock.addr` attribute. + """ + + HTTP_SERVER_NAME = "http.server_name" + """ + Deprecated, use the `net.host.name` attribute. + """ + + HTTP_HOST = "http.host" + """ + Deprecated, use the `net.peer.name` attribute. + """ + + 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_content_length` attribute. + """ + + HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = ( + "http.response_content_length_uncompressed" + ) + """ + Deprecated, use the `http.response_content_length` 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 `net.protocol.name` attribute. + """ + + MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version" + """ + Deprecated. Use `net.protocol.version` attribute. + """ + + MESSAGING_URL = "messaging.url" + """ + Deprecated. Use `net.peer.name` attribute. + """ + + 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. + """ + + +class HttpFlavorValues(Enum): + HTTP_1_0 = "1.0" + """HTTP/1.0.""" + + HTTP_1_1 = "1.1" + """HTTP/1.1.""" + + HTTP_2_0 = "2.0" + """HTTP/2.""" + + HTTP_3_0 = "3.0" + """HTTP/3.""" + + SPDY = "SPDY" + """SPDY protocol.""" + + QUIC = "QUIC" + """QUIC protocol.""" + + +class EventDomainValues(Enum): + BROWSER = "browser" + """Events from browser apps.""" + + DEVICE = "device" + """Events from mobile apps.""" + + K8S = "k8s" + """Events from Kubernetes.""" class OpentracingRefTypeValues(Enum): @@ -814,6 +1103,9 @@ class DbSystemValues(Enum): MSSQL = "mssql" """Microsoft SQL Server.""" + MSSQLCOMPACT = "mssqlcompact" + """Microsoft SQL Server Compact.""" + MYSQL = "mysql" """MySQL.""" @@ -949,6 +1241,26 @@ class DbSystemValues(Enum): COCKROACHDB = "cockroachdb" """CockroachDB.""" + OPENSEARCH = "opensearch" + """OpenSearch.""" + + CLICKHOUSE = "clickhouse" + """ClickHouse.""" + + SPANNER = "spanner" + """Cloud Spanner.""" + + +class NetSockFamilyValues(Enum): + INET = "inet" + """IPv4 address.""" + + INET6 = "inet6" + """IPv6 address.""" + + UNIX = "unix" + """Unix domain socket path.""" + class NetTransportValues(Enum): IP_TCP = "ip_tcp" @@ -957,12 +1269,6 @@ class NetTransportValues(Enum): IP_UDP = "ip_udp" """ip_udp.""" - IP = "ip" - """Another IP-based protocol.""" - - UNIX = "unix" - """Unix Domain socket. See below.""" - PIPE = "pipe" """Named or anonymous pipe. See note below.""" @@ -1008,6 +1314,14 @@ class DbCassandraConsistencyLevelValues(Enum): """local_serial.""" +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,24 +1350,15 @@ class FaasDocumentOperationValues(Enum): """When an object is deleted.""" -class HttpFlavorValues(Enum): - HTTP_1_0 = "1.0" - """HTTP/1.0.""" - - HTTP_1_1 = "1.1" - """HTTP/1.1.""" - - HTTP_2_0 = "2.0" - """HTTP/2.""" - - HTTP_3_0 = "3.0" - """HTTP/3.""" +class MessagingOperationValues(Enum): + PUBLISH = "publish" + """publish.""" - SPDY = "SPDY" - """SPDY protocol.""" + RECEIVE = "receive" + """receive.""" - QUIC = "QUIC" - """QUIC protocol.""" + PROCESS = "process" + """process.""" class NetHostConnectionTypeValues(Enum): @@ -1138,14 +1443,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.""" @@ -1176,13 +1473,35 @@ 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 MessagingDestinationKindValues(Enum): + QUEUE = "queue" + """A message sent to a queue.""" + + TOPIC = "topic" + """A message sent to a topic.""" + + +class MessagingSourceKindValues(Enum): + QUEUE = "queue" + """A message received from a queue.""" + + TOPIC = "topic" + """A message received from a topic.""" class MessagingRocketmqMessageTypeValues(Enum): @@ -1266,3 +1585,54 @@ 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..e435620c7e2 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -4,8 +4,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec version to make SemanticAttributes generation reproducible -SPEC_VERSION=v1.11.0 -OTEL_SEMCONV_GEN_IMG_VERSION=0.11.1 +SPEC_VERSION=v1.19.0 +OTEL_SEMCONV_GEN_IMG_VERSION=0.18.0 cd ${SCRIPT_DIR} @@ -20,20 +20,22 @@ git reset --hard FETCH_HEAD cd ${SCRIPT_DIR} docker run --rm \ - -v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/trace:/source \ + -v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions:/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 docker run --rm \ - -v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions/resource:/source \ + -v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions:/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 \ diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index 32d3f18a1ba..d4b4c7e6f61 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -33,10 +33,123 @@ class {{class}}: {%- if attribute.deprecated %} Deprecated: {{attribute.deprecated | to_doc_brief}}. {%- endif %} - """ + """ {# Extra line #} {%- endfor %} + {%- if class == "SpanAttributes" %} + # Manually defined deprecated attributes + + NET_PEER_IP = "net.peer.ip" + """ + Deprecated, use the `net.peer.sock.addr` attribute. + """ + + NET_HOST_IP = "net.host.ip" + """ + Deprecated, use the `net.host.sock.addr` attribute. + """ + + HTTP_SERVER_NAME = "http.server_name" + """ + Deprecated, use the `net.host.name` attribute. + """ + + HTTP_HOST = "http.host" + """ + Deprecated, use the `net.peer.name` attribute. + """ + + 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_content_length` attribute. + """ + + HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = ( + "http.response_content_length_uncompressed" + ) + """ + Deprecated, use the `http.response_content_length` 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 `net.protocol.name` attribute. + """ + + MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version" + """ + Deprecated. Use `net.protocol.version` attribute. + """ + + MESSAGING_URL = "messaging.url" + """ + Deprecated. Use `net.peer.name` attribute. + """ + + 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. + """ + + {% endif %} + + {%- if class == "ResourceAttributes" %} + # Manually defined deprecated attributes + + 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" %} From 9ff0a78504420968e42801fa5c58301dd7b039af Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Fri, 7 Apr 2023 11:40:14 -0700 Subject: [PATCH 02/22] schema_url and lint --- .../semconv/resource/__init__.py | 201 ++++----- .../opentelemetry/semconv/trace/__init__.py | 400 ++++++++++-------- scripts/semconv/generate.sh | 7 +- .../semconv/templates/semantic_attributes.j2 | 12 +- 4 files changed, 332 insertions(+), 288 deletions(-) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index d9a8335f759..44ac2df1992 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -14,53 +14,58 @@ from enum import Enum + class ResourceAttributes: + SCHEMA_URL = "https://opentelemetry.io/schemas/v1.19.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. - """ + """ CLOUD_ACCOUNT_ID = "cloud.account.id" """ The cloud account ID the resource is assigned to. - """ + """ 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://www.tencentcloud.com/document/product/213/6091). - """ + """ CLOUD_RESOURCE_ID = "cloud.resource_id" """ @@ -82,146 +87,146 @@ class ResourceAttributes: `/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" """ Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running. Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. - """ + """ CLOUD_PLATFORM = "cloud.platform" """ The cloud platform in use. Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. - """ + """ AWS_ECS_CONTAINER_ARN = "aws.ecs.container.arn" """ The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). - """ + """ AWS_ECS_CLUSTER_ARN = "aws.ecs.cluster.arn" """ The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). - """ + """ AWS_ECS_LAUNCHTYPE = "aws.ecs.launchtype" """ The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. - """ + """ AWS_ECS_TASK_ARN = "aws.ecs.task.arn" """ The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). - """ + """ AWS_ECS_TASK_FAMILY = "aws.ecs.task.family" """ The task definition family this task definition is a member of. - """ + """ AWS_ECS_TASK_REVISION = "aws.ecs.task.revision" """ The revision for this task definition. - """ + """ AWS_EKS_CLUSTER_ARN = "aws.eks.cluster.arn" """ The ARN of an EKS cluster. - """ + """ AWS_LOG_GROUP_NAMES = "aws.log.group.names" """ The name(s) of the AWS log group(s) an application is writing to. Note: Multiple log groups must be supported for cases like multi-container applications, where a single application has sidecar containers, and each write to their own log group. - """ + """ AWS_LOG_GROUP_ARNS = "aws.log.group.arns" """ The Amazon Resource Name(s) (ARN) of the AWS log group(s). Note: See the [log group ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). - """ + """ AWS_LOG_STREAM_NAMES = "aws.log.stream.names" """ The name(s) of the AWS log stream(s) an application is writing to. - """ + """ AWS_LOG_STREAM_ARNS = "aws.log.stream.arns" """ The ARN(s) of the AWS log stream(s). Note: See the [log stream ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain several log streams, so these ARNs necessarily identify both a log group and a log stream. - """ + """ 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. - """ + """ CONTAINER_ID = "container.id" """ Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated. - """ + """ CONTAINER_RUNTIME = "container.runtime" """ The container runtime managing this container. - """ + """ CONTAINER_IMAGE_NAME = "container.image.name" """ Name of the image the container was built on. - """ + """ CONTAINER_IMAGE_TAG = "container.image.tag" """ Container image tag. - """ + """ DEPLOYMENT_ENVIRONMENT = "deployment.environment" """ Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka deployment tier). - """ + """ DEVICE_ID = "device.id" """ A unique identifier representing the device. Note: The device identifier MUST only be defined using the values outlined below. This value is not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation ID or a globally unique UUID which is persisted across sessions in your application. More information can be found [here](https://developer.android.com/training/articles/user-data-ids) on best practices and exact implementation details. Caution should be taken when storing personal data or anything which can identify a user. GDPR and data protection laws may apply, ensure you do your own due diligence. - """ + """ DEVICE_MODEL_IDENTIFIER = "device.model.identifier" """ The model identifier for the device. Note: It's recommended this value represents a machine readable version of the model identifier rather than the market or consumer-friendly name of the device. - """ + """ DEVICE_MODEL_NAME = "device.model.name" """ The marketing name for the device model. Note: It's recommended this value represents a human readable version of the device model rather than a machine readable alternative. - """ + """ DEVICE_MANUFACTURER = "device.manufacturer" """ The name of the device manufacturer. Note: The Android OS provides this field via [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). iOS apps SHOULD hardcode the value `Apple`. - """ + """ FAAS_NAME = "faas.name" """ @@ -242,7 +247,7 @@ class ResourceAttributes: 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" """ @@ -256,307 +261,307 @@ class ResourceAttributes: * **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" """ The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version. Note: * **AWS Lambda:** Use the (full) log stream name. - """ + """ FAAS_MAX_MEMORY = "faas.max_memory" """ The amount of memory available to the serverless function converted to Bytes. Note: It's recommended to set this attribute since e.g. too little memory can easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must be multiplied by 1,048,576). - """ + """ HOST_ID = "host.id" """ Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the `machine-id`. See the table below for the sources to use to determine the `machine-id` based on operating system. - """ + """ HOST_NAME = "host.name" """ Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user. - """ + """ HOST_TYPE = "host.type" """ Type of host. For Cloud, this must be the machine type. - """ + """ HOST_ARCH = "host.arch" """ The CPU architecture the host system is running on. - """ + """ HOST_IMAGE_NAME = "host.image.name" """ Name of the VM image or OS install the host was instantiated from. - """ + """ HOST_IMAGE_ID = "host.image.id" """ VM 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). - """ + """ K8S_CLUSTER_NAME = "k8s.cluster.name" """ The name of the cluster. - """ + """ K8S_NODE_NAME = "k8s.node.name" """ The name of the Node. - """ + """ K8S_NODE_UID = "k8s.node.uid" """ The UID of the Node. - """ + """ K8S_NAMESPACE_NAME = "k8s.namespace.name" """ The name of the namespace that the pod is running in. - """ + """ K8S_POD_UID = "k8s.pod.uid" """ The UID of the Pod. - """ + """ K8S_POD_NAME = "k8s.pod.name" """ The name of the Pod. - """ + """ K8S_CONTAINER_NAME = "k8s.container.name" """ The name of the Container from Pod specification, must be unique within a Pod. Container runtime usually uses different globally unique name (`container.name`). - """ + """ K8S_CONTAINER_RESTART_COUNT = "k8s.container.restart_count" """ Number of times the container was restarted. This attribute can be used to identify a particular container (running or stopped) within a container spec. - """ + """ K8S_REPLICASET_UID = "k8s.replicaset.uid" """ The UID of the ReplicaSet. - """ + """ K8S_REPLICASET_NAME = "k8s.replicaset.name" """ The name of the ReplicaSet. - """ + """ K8S_DEPLOYMENT_UID = "k8s.deployment.uid" """ The UID of the Deployment. - """ + """ K8S_DEPLOYMENT_NAME = "k8s.deployment.name" """ The name of the Deployment. - """ + """ K8S_STATEFULSET_UID = "k8s.statefulset.uid" """ The UID of the StatefulSet. - """ + """ K8S_STATEFULSET_NAME = "k8s.statefulset.name" """ The name of the StatefulSet. - """ + """ K8S_DAEMONSET_UID = "k8s.daemonset.uid" """ The UID of the DaemonSet. - """ + """ K8S_DAEMONSET_NAME = "k8s.daemonset.name" """ The name of the DaemonSet. - """ + """ K8S_JOB_UID = "k8s.job.uid" """ The UID of the Job. - """ + """ K8S_JOB_NAME = "k8s.job.name" """ The name of the Job. - """ + """ K8S_CRONJOB_UID = "k8s.cronjob.uid" """ The UID of the CronJob. - """ + """ K8S_CRONJOB_NAME = "k8s.cronjob.name" """ The name of the CronJob. - """ + """ OS_TYPE = "os.type" """ The operating system type. - """ + """ OS_DESCRIPTION = "os.description" """ Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands. - """ + """ OS_NAME = "os.name" """ Human readable operating system name. - """ + """ OS_VERSION = "os.version" """ The version string of the operating system as defined in [Version Attributes](../../resource/semantic_conventions/README.md#version-attributes). - """ + """ PROCESS_PID = "process.pid" """ 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`. - """ + """ PROCESS_EXECUTABLE_PATH = "process.executable.path" """ The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. - """ + """ PROCESS_COMMAND = "process.command" """ The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`. - """ + """ PROCESS_COMMAND_LINE = "process.command_line" """ The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to assemble it just for monitoring; use `process.command_args` instead. - """ + """ PROCESS_COMMAND_ARGS = "process.command_args" """ All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`. - """ + """ PROCESS_OWNER = "process.owner" """ The username of the user that owns the process. - """ + """ PROCESS_RUNTIME_NAME = "process.runtime.name" """ The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of the compiler. - """ + """ PROCESS_RUNTIME_VERSION = "process.runtime.version" """ The version of the runtime of this process, as returned by the runtime without modification. - """ + """ PROCESS_RUNTIME_DESCRIPTION = "process.runtime.description" """ An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment. - """ + """ SERVICE_NAME = "service.name" """ Logical name of the service. Note: MUST be the same for all instances of horizontally scaled services. If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value MUST be set to `unknown_service`. - """ + """ SERVICE_NAMESPACE = "service.namespace" """ A namespace for `service.name`. Note: A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace. - """ + """ SERVICE_INSTANCE_ID = "service.instance.id" """ The string ID of the service instance. Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words `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. - """ + """ TELEMETRY_SDK_LANGUAGE = "telemetry.sdk.language" """ The language of the telemetry SDK. - """ + """ TELEMETRY_SDK_VERSION = "telemetry.sdk.version" """ The version string of the telemetry SDK. - """ + """ TELEMETRY_AUTO_VERSION = "telemetry.auto.version" """ The version string of the auto instrumentation agent, if used. - """ + """ WEBENGINE_NAME = "webengine.name" """ The name of the web engine. - """ + """ WEBENGINE_VERSION = "webengine.version" """ The version of the web engine. - """ + """ WEBENGINE_DESCRIPTION = "webengine.description" """ 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 @@ -564,7 +569,8 @@ class ResourceAttributes: """ Deprecated, use the `cloud.resource.id` attribute. """ - + + class CloudProviderValues(Enum): ALIBABA_CLOUD = "alibaba_cloud" """Alibaba Cloud.""" @@ -770,4 +776,3 @@ class TelemetrySdkLanguageValues(Enum): SWIFT = "swift" """swift.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index 1c3a8d3e6e2..f31ed7ff135 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -14,36 +14,41 @@ from enum import Enum + class SpanAttributes: + SCHEMA_URL = "https://opentelemetry.io/schemas/v1.19.0" + """ + The URL of the OpenTelemetry schema for these keys and values. + """ EXCEPTION_TYPE = "exception.type" """ The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. - """ + """ EXCEPTION_MESSAGE = "exception.message" """ The exception message. - """ + """ EXCEPTION_STACKTRACE = "exception.stacktrace" """ A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. - """ + """ HTTP_METHOD = "http.method" """ HTTP request method. - """ + """ HTTP_STATUS_CODE = "http.status_code" """ [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). - """ + """ HTTP_FLAVOR = "http.flavor" """ Kind of HTTP protocol used. - """ + """ NET_PEER_NAME = "net.peer.name" """ @@ -55,25 +60,25 @@ class SpanAttributes: - Host identifier of the `Host` header SHOULD NOT be set if capturing it would require an extra DNS lookup. - """ + """ NET_PEER_PORT = "net.peer.port" """ 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, `net.peer.name` MUST match URI port identifier, otherwise it MUST match `Host` header port identifier. - """ + """ HTTP_SCHEME = "http.scheme" """ The URI scheme identifying the used protocol. - """ + """ HTTP_ROUTE = "http.route" """ 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](/specification/trace/semantic_conventions/http.md#http-server-definitions) if there is one. - """ + """ NET_HOST_NAME = "net.host.name" """ @@ -87,7 +92,7 @@ class SpanAttributes: - Host identifier of the `Host` header SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup. - """ + """ NET_HOST_PORT = "net.host.port" """ @@ -98,29 +103,29 @@ class SpanAttributes: - Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) if it's sent in absolute-form. - Port identifier of the `Host` header. - """ + """ EVENT_NAME = "event.name" """ The name identifies the event. - """ + """ EVENT_DOMAIN = "event.domain" """ The domain identifies the business context for the events. Note: Events across different domains may have same `event.name`, yet be unrelated events. - """ + """ FEATURE_FLAG_KEY = "feature_flag.key" """ The unique identifier of the feature flag. - """ + """ FEATURE_FLAG_PROVIDER_NAME = "feature_flag.provider_name" """ The name of the service provider that performs the flag evaluation. - """ + """ FEATURE_FLAG_VARIANT = "feature_flag.variant" """ @@ -133,175 +138,177 @@ class SpanAttributes: 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. - """ + """ AWS_LAMBDA_INVOKED_ARN = "aws.lambda.invoked_arn" """ The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable). Note: This may be different from `cloud.resource_id` if an alias is involved. - """ + """ CLOUDEVENTS_EVENT_ID = "cloudevents.event_id" """ The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) uniquely identifies the event. - """ + """ CLOUDEVENTS_EVENT_SOURCE = "cloudevents.event_source" """ The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) identifies the context in which an event happened. - """ + """ CLOUDEVENTS_EVENT_SPEC_VERSION = "cloudevents.event_spec_version" """ The [version of the CloudEvents specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses. - """ + """ CLOUDEVENTS_EVENT_TYPE = "cloudevents.event_type" """ The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) contains a value describing the type of event related to the originating occurrence. - """ + """ CLOUDEVENTS_EVENT_SUBJECT = "cloudevents.event_subject" """ The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) of the event in the context of the event producer (identified by source). - """ + """ OPENTRACING_REF_TYPE = "opentracing.ref_type" """ Parent-child Reference type. Note: The causal relationship between a child Span and a parent Span. - """ + """ DB_SYSTEM = "db.system" """ An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. - """ + """ DB_CONNECTION_STRING = "db.connection_string" """ The connection string used to connect to the database. It is recommended to remove embedded credentials. - """ + """ DB_USER = "db.user" """ Username for accessing the database. - """ + """ DB_JDBC_DRIVER_CLASSNAME = "db.jdbc.driver_classname" """ 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. - """ + """ DB_NAME = "db.name" """ This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails). Note: In some SQL databases, the database name to be used is called "schema name". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name). - """ + """ DB_STATEMENT = "db.statement" """ The database statement being executed. Note: The value may be sanitized to exclude sensitive information. - """ + """ DB_OPERATION = "db.operation" """ The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword. Note: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted. - """ + """ NET_SOCK_PEER_ADDR = "net.sock.peer.addr" """ Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local communication, [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). - """ + """ NET_SOCK_PEER_PORT = "net.sock.peer.port" """ Remote socket peer port. - """ + """ NET_SOCK_FAMILY = "net.sock.family" """ Protocol [address family](https://man7.org/linux/man-pages/man7/address_families.7.html) which is used for communication. - """ + """ NET_SOCK_PEER_NAME = "net.sock.peer.name" """ Remote socket peer name. - """ + """ NET_TRANSPORT = "net.transport" """ Transport protocol used. See note below. - """ + """ DB_MSSQL_INSTANCE_NAME = "db.mssql.instance_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). - """ + """ DB_CASSANDRA_PAGE_SIZE = "db.cassandra.page_size" """ The fetch size used for paging, i.e. how many rows will be returned at once. - """ + """ DB_CASSANDRA_CONSISTENCY_LEVEL = "db.cassandra.consistency_level" """ The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). - """ + """ DB_CASSANDRA_TABLE = "db.cassandra.table" """ 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. - """ + """ DB_CASSANDRA_IDEMPOTENCE = "db.cassandra.idempotence" """ Whether or not the query is idempotent. - """ + """ - DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = "db.cassandra.speculative_execution_count" + DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( + "db.cassandra.speculative_execution_count" + ) """ The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. - """ + """ DB_CASSANDRA_COORDINATOR_ID = "db.cassandra.coordinator.id" """ The ID of the coordinating node for a query. - """ + """ DB_CASSANDRA_COORDINATOR_DC = "db.cassandra.coordinator.dc" """ The data center of the coordinating node for a query. - """ + """ DB_REDIS_DATABASE_INDEX = "db.redis.database_index" """ The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. - """ + """ DB_MONGODB_COLLECTION = "db.mongodb.collection" """ The collection being accessed within the database stated in `db.name`. - """ + """ DB_SQL_TABLE = "db.sql.table" """ The name of the primary table that the operation is acting upon, including the database name (if applicable). Note: It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. - """ + """ OTEL_STATUS_CODE = "otel.status_code" """ Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. - """ + """ OTEL_STATUS_DESCRIPTION = "otel.status_description" """ Description of the Status if it has a value, otherwise not set. - """ + """ FAAS_TRIGGER = "faas.trigger" """ @@ -315,12 +322,12 @@ class SpanAttributes: 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" """ @@ -342,32 +349,32 @@ class SpanAttributes: `/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. - """ + """ HTTP_TARGET = "http.target" """ The full request target as passed in a HTTP request line or equivalent. - """ + """ HTTP_CLIENT_IP = "http.client_ip" """ @@ -383,556 +390,582 @@ class SpanAttributes: `http.client_ip` when it's the same as `net.sock.peer.addr` means that one is at least somewhat confident that the address is not that of the closest proxy. - """ + """ NET_SOCK_HOST_ADDR = "net.sock.host.addr" """ Local socket address. Useful in case of a multi-IP host. - """ + """ NET_SOCK_HOST_PORT = "net.sock.host.port" """ Local socket port number. - """ + """ 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_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" + 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" + MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = ( + "messaging.message.payload_compressed_size_bytes" + ) """ The compressed size of the message payload in bytes. - """ + """ NET_APP_PROTOCOL_NAME = "net.app.protocol.name" """ Application layer protocol used. The value SHOULD be normalized to lowercase. - """ + """ NET_APP_PROTOCOL_VERSION = "net.app.protocol.version" """ Version of the application layer protocol used. See note below. Note: `net.app.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`. - """ + """ NET_HOST_CONNECTION_TYPE = "net.host.connection.type" """ The internet connection type currently being used by the host. - """ + """ NET_HOST_CONNECTION_SUBTYPE = "net.host.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. - """ + """ NET_HOST_CARRIER_NAME = "net.host.carrier.name" """ The name of the mobile carrier. - """ + """ NET_HOST_CARRIER_MCC = "net.host.carrier.mcc" """ The mobile carrier country code. - """ + """ NET_HOST_CARRIER_MNC = "net.host.carrier.mnc" """ The mobile carrier network code. - """ + """ NET_HOST_CARRIER_ICC = "net.host.carrier.icc" """ The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. - """ + """ 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. - """ + """ PEER_SERVICE = "peer.service" """ 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. - """ + """ 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_CONTENT_LENGTH = "http.request_content_length" """ 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_CONTENT_LENGTH = "http.response_content_length" """ 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. - """ + """ USER_AGENT_ORIGINAL = "user_agent.original" """ Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. - """ + """ HTTP_URL = "http.url" """ 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/`. - """ + """ 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_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 = "aws.dynamodb.item_collection_metrics" + AWS_DYNAMODB_ITEM_COLLECTION_METRICS = ( + "aws.dynamodb.item_collection_metrics" + ) """ The JSON-serialized value of the `ItemCollectionMetrics` response field. - """ + """ - AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = "aws.dynamodb.provisioned_read_capacity" + AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = ( + "aws.dynamodb.provisioned_read_capacity" + ) """ The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. - """ + """ - AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = "aws.dynamodb.provisioned_write_capacity" + AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = ( + "aws.dynamodb.provisioned_write_capacity" + ) """ The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. - """ + """ AWS_DYNAMODB_CONSISTENT_READ = "aws.dynamodb.consistent_read" """ The value of the `ConsistentRead` request parameter. - """ + """ AWS_DYNAMODB_PROJECTION = "aws.dynamodb.projection" """ The value of the `ProjectionExpression` request parameter. - """ + """ AWS_DYNAMODB_LIMIT = "aws.dynamodb.limit" """ The value of the `Limit` request parameter. - """ + """ AWS_DYNAMODB_ATTRIBUTES_TO_GET = "aws.dynamodb.attributes_to_get" """ The value of the `AttributesToGet` request parameter. - """ + """ AWS_DYNAMODB_INDEX_NAME = "aws.dynamodb.index_name" """ The value of the `IndexName` request parameter. - """ + """ AWS_DYNAMODB_SELECT = "aws.dynamodb.select" """ The value of the `Select` request parameter. - """ + """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = "aws.dynamodb.global_secondary_indexes" + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = ( + "aws.dynamodb.global_secondary_indexes" + ) """ The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. - """ + """ - AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = "aws.dynamodb.local_secondary_indexes" + AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = ( + "aws.dynamodb.local_secondary_indexes" + ) """ The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. - """ + """ AWS_DYNAMODB_EXCLUSIVE_START_TABLE = "aws.dynamodb.exclusive_start_table" """ 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_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" + 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. - """ + """ 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_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_SOURCE_NAME = "messaging.source.name" """ The message source name. Note: Source name SHOULD uniquely identify a specific queue, topic, or other entity within the broker. If the broker does not have such notion, the source name SHOULD uniquely identify the broker. - """ + """ MESSAGING_DESTINATION_KIND = "messaging.destination.kind" """ The kind of message destination. - """ + """ 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_SOURCE_KIND = "messaging.source.kind" """ The kind of message source. - """ + """ MESSAGING_SOURCE_TEMPLATE = "messaging.source.template" """ Low cardinality representation of the messaging source name. Note: Source names could be constructed from templates. An example would be a source name involving a user name or product id. Although the source 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_SOURCE_TEMPORARY = "messaging.source.temporary" """ A boolean that is true if the message source is temporary and might not exist anymore after messages are processed. - """ + """ MESSAGING_SOURCE_ANONYMOUS = "messaging.source.anonymous" """ A boolean that is true if the message source is anonymous (could be unnamed or have auto-generated name). - """ + """ MESSAGING_CONSUMER_ID = "messaging.consumer.id" """ The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer.group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. - """ + """ - MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = "messaging.rabbitmq.destination.routing_key" + 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_CLIENT_ID = "messaging.kafka.client_id" """ Client Id for the Consumer or Producer that is handling the message. - """ + """ - MESSAGING_KAFKA_DESTINATION_PARTITION = "messaging.kafka.destination.partition" + MESSAGING_KAFKA_DESTINATION_PARTITION = ( + "messaging.kafka.destination.partition" + ) """ Partition the message is sent to. - """ + """ MESSAGING_KAFKA_SOURCE_PARTITION = "messaging.kafka.source.partition" """ Partition the message is received from. - """ + """ 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_CLIENT_ID = "messaging.rocketmq.client_id" """ The unique identifier for each client. - """ + """ - MESSAGING_ROCKETMQ_MESSAGE_DELIVERY_TIMESTAMP = "messaging.rocketmq.message.delivery_timestamp" + 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" + 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" + 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" """ @@ -953,7 +986,7 @@ class SpanAttributes: 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. - """ + """ # Manually defined deprecated attributes @@ -1015,17 +1048,17 @@ class SpanAttributes: """ Deprecated. Use `net.protocol.name` attribute. """ - + MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version" """ Deprecated. Use `net.protocol.version` attribute. """ - + MESSAGING_URL = "messaging.url" """ Deprecated. Use `net.peer.name` attribute. """ - + MESSAGING_CONVERSATION_ID = "messaging.conversation_id" """ Deprecated. Use `messaging.message.conversation.id` attribute. @@ -1056,7 +1089,7 @@ class SpanAttributes: Deprecated. Use `messaging.kafka.destination.tombstone` attribute. """ - + class HttpFlavorValues(Enum): HTTP_1_0 = "1.0" """HTTP/1.0.""" @@ -1635,4 +1668,3 @@ class RpcConnectRpcErrorCodeValues(Enum): UNAUTHENTICATED = "unauthenticated" """unauthenticated.""" - diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index e435620c7e2..a7549876288 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -5,6 +5,7 @@ ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec version to make SemanticAttributes generation reproducible SPEC_VERSION=v1.19.0 +SCHEMA_URL=https://opentelemetry.io/schemas/$SPEC_VERSION OTEL_SEMCONV_GEN_IMG_VERSION=0.18.0 cd ${SCRIPT_DIR} @@ -28,7 +29,8 @@ docker run --rm \ -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:/source \ @@ -39,6 +41,7 @@ docker run --rm \ -f /source code \ --template /templates/semantic_attributes.j2 \ --output /output/__init__.py \ - -Dclass=ResourceAttributes + -Dclass=ResourceAttributes \ + -DschemaUrl=$SCHEMA_URL cd "$ROOT_DIR" diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index d4b4c7e6f61..160b3cab1b1 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -21,6 +21,10 @@ from enum import Enum 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}}" """ @@ -33,7 +37,7 @@ class {{class}}: {%- if attribute.deprecated %} Deprecated: {{attribute.deprecated | to_doc_brief}}. {%- endif %} - """ + """ {# Extra line #} {%- endfor %} @@ -98,17 +102,17 @@ class {{class}}: """ Deprecated. Use `net.protocol.name` attribute. """ - + MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version" """ Deprecated. Use `net.protocol.version` attribute. """ - + MESSAGING_URL = "messaging.url" """ Deprecated. Use `net.peer.name` attribute. """ - + MESSAGING_CONVERSATION_ID = "messaging.conversation_id" """ Deprecated. Use `messaging.message.conversation.id` attribute. From adfc7e83681846deff7e2de4cf4c0da6942d5be0 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Fri, 7 Apr 2023 11:53:49 -0700 Subject: [PATCH 03/22] schema_url in get_meter global --- .../src/opentelemetry/metrics/_internal/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py b/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py index 630e9c4053d..aad76b33a72 100644 --- a/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py +++ b/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py @@ -719,6 +719,7 @@ def get_meter( name: str, version: str = "", meter_provider: Optional[MeterProvider] = None, + schema_url: Optional[str] = None, ) -> "Meter": """Returns a `Meter` for use by the given instrumentation library. @@ -729,7 +730,7 @@ def get_meter( """ if meter_provider is None: meter_provider = get_meter_provider() - return meter_provider.get_meter(name, version) + return meter_provider.get_meter(name, version, schema_url) def _set_meter_provider(meter_provider: MeterProvider, log: bool) -> None: From 09f29f41f4a870ed2aec237ef2f55ec83dee8d88 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Mon, 10 Apr 2023 09:51:50 -0700 Subject: [PATCH 04/22] update to 1.20.0 --- .../semconv/resource/__init__.py | 9 +- .../opentelemetry/semconv/trace/__init__.py | 419 +++++++++++------- scripts/semconv/generate.sh | 2 +- .../semconv/templates/semantic_attributes.j2 | 10 + 4 files changed, 281 insertions(+), 159 deletions(-) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index 44ac2df1992..7370b87af4d 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -14,11 +14,10 @@ from enum import Enum - class ResourceAttributes: - SCHEMA_URL = "https://opentelemetry.io/schemas/v1.19.0" + SCHEMA_URL = "https://opentelemetry.io/schemas/v1.20.0" """ - The URL of the OpenTelemetry schema for these keys and values. + The URL of the OpenTelemetry schema for these keys and values. """ BROWSER_BRANDS = "browser.brands" """ @@ -569,8 +568,7 @@ class ResourceAttributes: """ Deprecated, use the `cloud.resource.id` attribute. """ - - + class CloudProviderValues(Enum): ALIBABA_CLOUD = "alibaba_cloud" """Alibaba Cloud.""" @@ -776,3 +774,4 @@ class TelemetrySdkLanguageValues(Enum): SWIFT = "swift" """swift.""" + diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index f31ed7ff135..068dd022826 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -14,11 +14,10 @@ from enum import Enum - class SpanAttributes: - SCHEMA_URL = "https://opentelemetry.io/schemas/v1.19.0" + SCHEMA_URL = "https://opentelemetry.io/schemas/v1.20.0" """ - The URL of the OpenTelemetry schema for these keys and values. + The URL of the OpenTelemetry schema for these keys and values. """ EXCEPTION_TYPE = "exception.type" """ @@ -45,9 +44,15 @@ class SpanAttributes: [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). """ - HTTP_FLAVOR = "http.flavor" + NET_PROTOCOL_NAME = "net.protocol.name" """ - Kind of HTTP protocol used. + Application layer protocol used. The value SHOULD be normalized to lowercase. + """ + + NET_PROTOCOL_VERSION = "net.protocol.version" + """ + Version of the application layer protocol used. See note below. + Note: `net.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`. """ NET_PEER_NAME = "net.peer.name" @@ -117,6 +122,13 @@ class SpanAttributes: unrelated events. """ + LOG_RECORD_UID = "log.record.uid" + """ + A unique identifier for the Log Record. + Note: If an id is provided, other log records with the same id will be considered duplicates and can be removed safely. This means, that two distinguishable log records MUST have different values. +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. + """ + FEATURE_FLAG_KEY = "feature_flag.key" """ The unique identifier of the feature flag. @@ -206,7 +218,6 @@ class SpanAttributes: DB_STATEMENT = "db.statement" """ The database statement being executed. - Note: The value may be sanitized to exclude sensitive information. """ DB_OPERATION = "db.operation" @@ -267,9 +278,7 @@ class SpanAttributes: Whether or not the query is idempotent. """ - DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( - "db.cassandra.speculative_execution_count" - ) + DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = "db.cassandra.speculative_execution_count" """ The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. """ @@ -300,6 +309,54 @@ class SpanAttributes: Note: It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. """ + DB_COSMOSDB_CLIENT_ID = "db.cosmosdb.client_id" + """ + Unique Cosmos client instance id. + """ + + DB_COSMOSDB_OPERATION_TYPE = "db.cosmosdb.operation_type" + """ + CosmosDB Operation Type. + """ + + USER_AGENT_ORIGINAL = "user_agent.original" + """ + 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". + """ + + DB_COSMOSDB_CONNECTION_MODE = "db.cosmosdb.connection_mode" + """ + Cosmos client connection mode. + """ + + DB_COSMOSDB_CONTAINER = "db.cosmosdb.container" + """ + Cosmos DB container name. + """ + + DB_COSMOSDB_REQUEST_CONTENT_LENGTH = "db.cosmosdb.request_content_length" + """ + Request payload size in bytes. + """ + + DB_COSMOSDB_STATUS_CODE = "db.cosmosdb.status_code" + """ + Cosmos DB status code. + """ + + DB_COSMOSDB_SUB_STATUS_CODE = "db.cosmosdb.sub_status_code" + """ + Cosmos DB sub status code. + """ + + DB_COSMOSDB_REQUEST_CHARGE = "db.cosmosdb.request_charge" + """ + RU consumed for that operation. + """ + OTEL_STATUS_CODE = "otel.status_code" """ Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. @@ -429,92 +486,77 @@ class SpanAttributes: 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" - ) + 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" - ) + MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = "messaging.message.payload_compressed_size_bytes" """ The compressed size of the message payload in bytes. """ - NET_APP_PROTOCOL_NAME = "net.app.protocol.name" - """ - Application layer protocol used. The value SHOULD be normalized to lowercase. - """ - - NET_APP_PROTOCOL_VERSION = "net.app.protocol.version" - """ - Version of the application layer protocol used. See note below. - Note: `net.app.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`. - """ - - NET_HOST_CONNECTION_TYPE = "net.host.connection.type" + FAAS_TIME = "faas.time" """ - The internet connection type currently being used by the host. + 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). """ - NET_HOST_CONNECTION_SUBTYPE = "net.host.connection.subtype" + FAAS_CRON = "faas.cron" """ - 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. + A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). """ - NET_HOST_CARRIER_NAME = "net.host.carrier.name" + FAAS_COLDSTART = "faas.coldstart" """ - The name of the mobile carrier. + A boolean that is true if the serverless function is executed for the first time (aka cold-start). """ - NET_HOST_CARRIER_MCC = "net.host.carrier.mcc" + FAAS_INVOKED_NAME = "faas.invoked_name" """ - The mobile carrier country code. + The name of the invoked function. + Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function. """ - NET_HOST_CARRIER_MNC = "net.host.carrier.mnc" + FAAS_INVOKED_PROVIDER = "faas.invoked_provider" """ - The mobile carrier network code. + The cloud provider of the invoked function. + Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. """ - NET_HOST_CARRIER_ICC = "net.host.carrier.icc" + FAAS_INVOKED_REGION = "faas.invoked_region" """ - The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. + The cloud region of the invoked function. + Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function. """ - FAAS_TIME = "faas.time" + NET_HOST_CONNECTION_TYPE = "net.host.connection.type" """ - 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 internet connection type currently being used by the host. """ - FAAS_CRON = "faas.cron" + NET_HOST_CONNECTION_SUBTYPE = "net.host.connection.subtype" """ - A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + 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. """ - FAAS_COLDSTART = "faas.coldstart" + NET_HOST_CARRIER_NAME = "net.host.carrier.name" """ - A boolean that is true if the serverless function is executed for the first time (aka cold-start). + The name of the mobile carrier. """ - FAAS_INVOKED_NAME = "faas.invoked_name" + NET_HOST_CARRIER_MCC = "net.host.carrier.mcc" """ - The name of the invoked function. - Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function. + The mobile carrier country code. """ - FAAS_INVOKED_PROVIDER = "faas.invoked_provider" + NET_HOST_CARRIER_MNC = "net.host.carrier.mnc" """ - The cloud provider of the invoked function. - Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. + The mobile carrier network code. """ - FAAS_INVOKED_REGION = "faas.invoked_region" + NET_HOST_CARRIER_ICC = "net.host.carrier.icc" """ - The cloud region of the invoked function. - Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function. + The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. """ PEER_SERVICE = "peer.service" @@ -582,11 +624,6 @@ class SpanAttributes: 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. """ - USER_AGENT_ORIGINAL = "user_agent.original" - """ - Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. - """ - HTTP_URL = "http.url" """ 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. @@ -616,6 +653,11 @@ class SpanAttributes: 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. @@ -626,23 +668,17 @@ class SpanAttributes: The JSON-serialized value of each item in the `ConsumedCapacity` response field. """ - AWS_DYNAMODB_ITEM_COLLECTION_METRICS = ( - "aws.dynamodb.item_collection_metrics" - ) + AWS_DYNAMODB_ITEM_COLLECTION_METRICS = "aws.dynamodb.item_collection_metrics" """ The JSON-serialized value of the `ItemCollectionMetrics` response field. """ - AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = ( - "aws.dynamodb.provisioned_read_capacity" - ) + AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = "aws.dynamodb.provisioned_read_capacity" """ The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. """ - AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = ( - "aws.dynamodb.provisioned_write_capacity" - ) + AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = "aws.dynamodb.provisioned_write_capacity" """ The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. """ @@ -677,16 +713,12 @@ class SpanAttributes: The value of the `Select` request parameter. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = ( - "aws.dynamodb.global_secondary_indexes" - ) + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = "aws.dynamodb.global_secondary_indexes" """ The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. """ - AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = ( - "aws.dynamodb.local_secondary_indexes" - ) + AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = "aws.dynamodb.local_secondary_indexes" """ The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. """ @@ -731,13 +763,81 @@ class SpanAttributes: The JSON-serialized value of each item in the `AttributeDefinitions` request field. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = ( - "aws.dynamodb.global_secondary_index_updates" - ) + 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. @@ -768,11 +868,6 @@ class SpanAttributes: the broker does not have such notion, the source name SHOULD uniquely identify the broker. """ - MESSAGING_DESTINATION_KIND = "messaging.destination.kind" - """ - The kind of message destination. - """ - MESSAGING_DESTINATION_TEMPLATE = "messaging.destination.template" """ Low cardinality representation of the messaging destination name. @@ -789,11 +884,6 @@ class SpanAttributes: A boolean that is true if the message destination is anonymous (could be unnamed or have auto-generated name). """ - MESSAGING_SOURCE_KIND = "messaging.source.kind" - """ - The kind of message source. - """ - MESSAGING_SOURCE_TEMPLATE = "messaging.source.template" """ Low cardinality representation of the messaging source name. @@ -815,9 +905,7 @@ class SpanAttributes: The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer.group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. """ - MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = ( - "messaging.rabbitmq.destination.routing_key" - ) + MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = "messaging.rabbitmq.destination.routing_key" """ RabbitMQ message routing key. """ @@ -838,9 +926,7 @@ class SpanAttributes: Client Id for the Consumer or Producer that is handling the message. """ - MESSAGING_KAFKA_DESTINATION_PARTITION = ( - "messaging.kafka.destination.partition" - ) + MESSAGING_KAFKA_DESTINATION_PARTITION = "messaging.kafka.destination.partition" """ Partition the message is sent to. """ @@ -875,16 +961,12 @@ class SpanAttributes: The unique identifier for each client. """ - MESSAGING_ROCKETMQ_MESSAGE_DELIVERY_TIMESTAMP = ( - "messaging.rocketmq.message.delivery_timestamp" - ) + 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" - ) + 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. """ @@ -909,9 +991,7 @@ class SpanAttributes: Key(s) of message, another way to mark message besides message id. """ - MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = ( - "messaging.rocketmq.consumption_model" - ) + MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = "messaging.rocketmq.consumption_model" """ Model of message consumption. This only applies to consumer spans. """ @@ -1089,27 +1169,17 @@ class SpanAttributes: Deprecated. Use `messaging.kafka.destination.tombstone` attribute. """ + NET_APP_PROTOCOL_NAME = "net.app.protocol.name" + """ + Deprecated. Use `net.protocol.name` attribute. + """ -class HttpFlavorValues(Enum): - HTTP_1_0 = "1.0" - """HTTP/1.0.""" - - HTTP_1_1 = "1.1" - """HTTP/1.1.""" - - HTTP_2_0 = "2.0" - """HTTP/2.""" - - HTTP_3_0 = "3.0" - """HTTP/3.""" - - SPDY = "SPDY" - """SPDY protocol.""" - - QUIC = "QUIC" - """QUIC protocol.""" - + NET_APP_PROTOCOL_VERSION = "net.app.protocol.version" + """ + Deprecated. Use `net.protocol.version` attribute. + """ + class EventDomainValues(Enum): BROWSER = "browser" """Events from browser apps.""" @@ -1283,6 +1353,9 @@ class DbSystemValues(Enum): SPANNER = "spanner" """Cloud Spanner.""" + TRINO = "trino" + """Trino.""" + class NetSockFamilyValues(Enum): INET = "inet" @@ -1347,6 +1420,61 @@ 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.""" @@ -1394,6 +1522,23 @@ class MessagingOperationValues(Enum): """process.""" +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 NetHostConnectionTypeValues(Enum): WIFI = "wifi" """wifi.""" @@ -1476,23 +1621,6 @@ class NetHostConnectionSubtypeValues(Enum): """LTE CA.""" -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.""" @@ -1521,22 +1649,6 @@ class GraphqlOperationTypeValues(Enum): """GraphQL subscription.""" -class MessagingDestinationKindValues(Enum): - QUEUE = "queue" - """A message sent to a queue.""" - - TOPIC = "topic" - """A message sent to a topic.""" - - -class MessagingSourceKindValues(Enum): - QUEUE = "queue" - """A message received from a queue.""" - - TOPIC = "topic" - """A message received from a topic.""" - - class MessagingRocketmqMessageTypeValues(Enum): NORMAL = "normal" """Normal message.""" @@ -1668,3 +1780,4 @@ class RpcConnectRpcErrorCodeValues(Enum): UNAUTHENTICATED = "unauthenticated" """unauthenticated.""" + diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index a7549876288..bebae967070 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -4,7 +4,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec version to make SemanticAttributes generation reproducible -SPEC_VERSION=v1.19.0 +SPEC_VERSION=v1.20.0 SCHEMA_URL=https://opentelemetry.io/schemas/$SPEC_VERSION OTEL_SEMCONV_GEN_IMG_VERSION=0.18.0 diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index 160b3cab1b1..0d5f2b4c8a7 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -143,6 +143,16 @@ class {{class}}: Deprecated. Use `messaging.kafka.destination.tombstone` attribute. """ + NET_APP_PROTOCOL_NAME = "net.app.protocol.name" + """ + Deprecated. Use `net.protocol.name` attribute. + """ + + NET_APP_PROTOCOL_VERSION = "net.app.protocol.version" + """ + Deprecated. Use `net.protocol.version` attribute. + """ + {% endif %} {%- if class == "ResourceAttributes" %} From ac1d22d7f65a7d4ab52af7f10e9472f8891ac796 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Mon, 10 Apr 2023 23:31:11 -0700 Subject: [PATCH 05/22] add deprecated enums --- .../semconv/resource/__init__.py | 1 + .../opentelemetry/semconv/trace/__init__.py | 29 +++++++++++++++++++ .../semconv/templates/semantic_attributes.j2 | 29 +++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index 7370b87af4d..824b672963e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -13,6 +13,7 @@ # limitations under the License. from enum import Enum +from deprecated import deprecated class ResourceAttributes: SCHEMA_URL = "https://opentelemetry.io/schemas/v1.20.0" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index 068dd022826..8baa89a8ee1 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -13,6 +13,7 @@ # limitations under the License. from enum import Enum +from deprecated import deprecated class SpanAttributes: SCHEMA_URL = "https://opentelemetry.io/schemas/v1.20.0" @@ -1179,6 +1180,34 @@ class SpanAttributes: Deprecated. Use `net.protocol.version` attribute. """ + @deprecated( + version="1.18.0", + reason="Removed from the specification in favor of `net.protocol.name` and `net.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.""" + class EventDomainValues(Enum): BROWSER = "browser" diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index 0d5f2b4c8a7..536b57ccb6f 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -19,6 +19,7 @@ {%- endmacro %} from enum import Enum +from deprecated import deprecated class {{class}}: SCHEMA_URL = "{{schemaUrl}}" @@ -153,6 +154,34 @@ class {{class}}: Deprecated. Use `net.protocol.version` attribute. """ + @deprecated( + version="1.18.0", + reason="Removed from the specification in favor of `net.protocol.name` and `net.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.""" + {% endif %} {%- if class == "ResourceAttributes" %} From 5217d8a3cd7d58ea4c3ac7a3343bf9a0a027f2b8 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Mon, 10 Apr 2023 23:49:35 -0700 Subject: [PATCH 06/22] lint --- .../semconv/resource/__init__.py | 6 +- .../opentelemetry/semconv/trace/__init__.py | 105 ++++++++++++------ .../semconv/templates/semantic_attributes.j2 | 48 ++++---- 3 files changed, 97 insertions(+), 62 deletions(-) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index 824b672963e..103ae9fecbe 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -13,7 +13,7 @@ # limitations under the License. from enum import Enum -from deprecated import deprecated + class ResourceAttributes: SCHEMA_URL = "https://opentelemetry.io/schemas/v1.20.0" @@ -569,7 +569,8 @@ class ResourceAttributes: """ Deprecated, use the `cloud.resource.id` attribute. """ - + + class CloudProviderValues(Enum): ALIBABA_CLOUD = "alibaba_cloud" """Alibaba Cloud.""" @@ -775,4 +776,3 @@ class TelemetrySdkLanguageValues(Enum): SWIFT = "swift" """swift.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index 8baa89a8ee1..d4610f394d7 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -13,8 +13,10 @@ # limitations under the License. from enum import Enum + from deprecated import deprecated + class SpanAttributes: SCHEMA_URL = "https://opentelemetry.io/schemas/v1.20.0" """ @@ -279,7 +281,9 @@ class SpanAttributes: Whether or not the query is idempotent. """ - DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = "db.cassandra.speculative_execution_count" + DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( + "db.cassandra.speculative_execution_count" + ) """ The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. """ @@ -487,12 +491,16 @@ class SpanAttributes: 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" + 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" + MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = ( + "messaging.message.payload_compressed_size_bytes" + ) """ The compressed size of the message payload in bytes. """ @@ -669,17 +677,23 @@ class SpanAttributes: The JSON-serialized value of each item in the `ConsumedCapacity` response field. """ - AWS_DYNAMODB_ITEM_COLLECTION_METRICS = "aws.dynamodb.item_collection_metrics" + AWS_DYNAMODB_ITEM_COLLECTION_METRICS = ( + "aws.dynamodb.item_collection_metrics" + ) """ The JSON-serialized value of the `ItemCollectionMetrics` response field. """ - AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = "aws.dynamodb.provisioned_read_capacity" + AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = ( + "aws.dynamodb.provisioned_read_capacity" + ) """ The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. """ - AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = "aws.dynamodb.provisioned_write_capacity" + AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = ( + "aws.dynamodb.provisioned_write_capacity" + ) """ The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. """ @@ -714,12 +728,16 @@ class SpanAttributes: The value of the `Select` request parameter. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = "aws.dynamodb.global_secondary_indexes" + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = ( + "aws.dynamodb.global_secondary_indexes" + ) """ The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. """ - AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = "aws.dynamodb.local_secondary_indexes" + AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = ( + "aws.dynamodb.local_secondary_indexes" + ) """ The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. """ @@ -764,7 +782,9 @@ class SpanAttributes: The JSON-serialized value of each item in the `AttributeDefinitions` request field. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = "aws.dynamodb.global_secondary_index_updates" + 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. """ @@ -906,7 +926,9 @@ class SpanAttributes: The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer.group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. """ - MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = "messaging.rabbitmq.destination.routing_key" + MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = ( + "messaging.rabbitmq.destination.routing_key" + ) """ RabbitMQ message routing key. """ @@ -927,7 +949,9 @@ class SpanAttributes: Client Id for the Consumer or Producer that is handling the message. """ - MESSAGING_KAFKA_DESTINATION_PARTITION = "messaging.kafka.destination.partition" + MESSAGING_KAFKA_DESTINATION_PARTITION = ( + "messaging.kafka.destination.partition" + ) """ Partition the message is sent to. """ @@ -962,12 +986,16 @@ class SpanAttributes: The unique identifier for each client. """ - MESSAGING_ROCKETMQ_MESSAGE_DELIVERY_TIMESTAMP = "messaging.rocketmq.message.delivery_timestamp" + 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" + 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. """ @@ -992,7 +1020,9 @@ class SpanAttributes: Key(s) of message, another way to mark message besides message id. """ - MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = "messaging.rocketmq.consumption_model" + MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = ( + "messaging.rocketmq.consumption_model" + ) """ Model of message consumption. This only applies to consumer spans. """ @@ -1177,38 +1207,40 @@ class SpanAttributes: NET_APP_PROTOCOL_VERSION = "net.app.protocol.version" """ - Deprecated. Use `net.protocol.version` attribute. + Deprecated. Use `net.protocol.version` attribute. """ - @deprecated( - version="1.18.0", - reason="Removed from the specification in favor of `net.protocol.name` and `net.protocol.version` attributes", - ) - class HttpFlavorValues(Enum): - HTTP_1_0 = "1.0" - HTTP_1_1 = "1.1" +@deprecated( + version="1.18.0", + reason="Removed from the specification in favor of `net.protocol.name` and `net.protocol.version` attributes", +) +class HttpFlavorValues(Enum): + HTTP_1_0 = "1.0" - HTTP_2_0 = "2.0" + HTTP_1_1 = "1.1" - HTTP_3_0 = "3.0" + HTTP_2_0 = "2.0" - SPDY = "SPDY" + HTTP_3_0 = "3.0" - QUIC = "QUIC" + SPDY = "SPDY" - @deprecated( - version="1.18.0", - reason="Removed from the specification", - ) - class MessagingDestinationKindValues(Enum): - QUEUE = "queue" - """A message sent to a queue.""" + 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.""" - TOPIC = "topic" - """A message sent to a topic.""" - class EventDomainValues(Enum): BROWSER = "browser" """Events from browser apps.""" @@ -1809,4 +1841,3 @@ class RpcConnectRpcErrorCodeValues(Enum): UNAUTHENTICATED = "unauthenticated" """unauthenticated.""" - diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index 536b57ccb6f..61ae2eb5990 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -19,8 +19,13 @@ {%- endmacro %} from enum import Enum +{%- if class == "SpanAttributes" %} + from deprecated import deprecated +{%- endif %} + + class {{class}}: SCHEMA_URL = "{{schemaUrl}}" """ @@ -151,37 +156,36 @@ class {{class}}: NET_APP_PROTOCOL_VERSION = "net.app.protocol.version" """ - Deprecated. Use `net.protocol.version` attribute. + Deprecated. Use `net.protocol.version` attribute. """ - @deprecated( - version="1.18.0", - reason="Removed from the specification in favor of `net.protocol.name` and `net.protocol.version` attributes", - ) - class HttpFlavorValues(Enum): - HTTP_1_0 = "1.0" - - HTTP_1_1 = "1.1" +@deprecated( + version="1.18.0", + reason="Removed from the specification in favor of `net.protocol.name` and `net.protocol.version` attributes", +) +class HttpFlavorValues(Enum): + HTTP_1_0 = "1.0" - HTTP_2_0 = "2.0" + HTTP_1_1 = "1.1" - HTTP_3_0 = "3.0" + HTTP_2_0 = "2.0" - SPDY = "SPDY" + HTTP_3_0 = "3.0" - QUIC = "QUIC" + SPDY = "SPDY" - @deprecated( - version="1.18.0", - reason="Removed from the specification", - ) - class MessagingDestinationKindValues(Enum): - QUEUE = "queue" - """A message sent to a queue.""" + QUIC = "QUIC" - TOPIC = "topic" - """A message sent to a topic.""" +@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.""" {% endif %} {%- if class == "ResourceAttributes" %} From 96e76260e01add347405fc7232647fcd503cc2cd Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Mon, 10 Apr 2023 23:57:51 -0700 Subject: [PATCH 07/22] changelog --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a8b0656e55..0ac43c07e39 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)) @@ -66,7 +68,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add benchmark tests for metrics ([#3267](https://github.com/open-telemetry/opentelemetry-python/pull/3267)) - ## Version 1.17.0/0.38b0 (2023-03-22) - Implement LowMemory temporality From eb4ee403afcf88e7def36bb5f81a5c9b7912a8c5 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 28 Jun 2023 12:32:41 -0700 Subject: [PATCH 08/22] indent comments --- .../semconv/resource/__init__.py | 74 ++--- .../opentelemetry/semconv/trace/__init__.py | 266 ++++++++---------- .../semconv/templates/semantic_attributes.j2 | 2 +- 3 files changed, 156 insertions(+), 186 deletions(-) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index 103ae9fecbe..d0dc5a8368e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -30,7 +30,7 @@ class ResourceAttributes: """ 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. + 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" @@ -71,22 +71,22 @@ class ResourceAttributes: """ 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. + 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: + 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. + * **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" @@ -232,21 +232,21 @@ class ResourceAttributes: """ 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). + 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). -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: + 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: -* **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). + * **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" @@ -254,13 +254,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:** 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" @@ -569,8 +569,7 @@ class ResourceAttributes: """ Deprecated, use the `cloud.resource.id` attribute. """ - - + class CloudProviderValues(Enum): ALIBABA_CLOUD = "alibaba_cloud" """Alibaba Cloud.""" @@ -776,3 +775,4 @@ class TelemetrySdkLanguageValues(Enum): SWIFT = "swift" """swift.""" + diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index d4610f394d7..16a45309920 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -63,11 +63,11 @@ class SpanAttributes: 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 + - 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. + SHOULD NOT be set if capturing it would require an extra DNS lookup. """ NET_PEER_PORT = "net.peer.port" @@ -85,7 +85,7 @@ class SpanAttributes: """ 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](/specification/trace/semantic_conventions/http.md#http-server-definitions) if there is one. + SHOULD include the [application root](/specification/trace/semantic_conventions/http.md#http-server-definitions) if there is one. """ NET_HOST_NAME = "net.host.name" @@ -93,13 +93,13 @@ class SpanAttributes: Name of the local HTTP server that received the request. Note: Determined by using the first of the following that applies -- The [primary server name](/specification/trace/semantic_conventions/http.md#http-server-definitions) of the matched virtual host. MUST only - include host identifier. -- 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 + - The [primary server name](/specification/trace/semantic_conventions/http.md#http-server-definitions) of the matched virtual host. MUST only + include host identifier. + - 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 only IP address is available and capturing name would require a reverse DNS lookup. + SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup. """ NET_HOST_PORT = "net.host.port" @@ -107,10 +107,10 @@ class SpanAttributes: Port of the local HTTP server that received the request. Note: Determined by using the first of the following that applies -- Port identifier of the [primary server host](/specification/trace/semantic_conventions/http.md#http-server-definitions) of the matched virtual host. -- Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) - if it's sent in absolute-form. -- Port identifier of the `Host` header. + - Port identifier of the [primary server host](/specification/trace/semantic_conventions/http.md#http-server-definitions) of the matched virtual host. + - Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) + if it's sent in absolute-form. + - Port identifier of the `Host` header. """ EVENT_NAME = "event.name" @@ -122,14 +122,14 @@ class SpanAttributes: """ The domain identifies the business context for the events. Note: Events across different domains may have same `event.name`, yet be -unrelated events. + unrelated events. """ LOG_RECORD_UID = "log.record.uid" """ A unique identifier for the Log Record. Note: If an id is provided, other log records with the same id will be considered duplicates and can be removed safely. This means, that two distinguishable log records MUST have different values. -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. + 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. """ FEATURE_FLAG_KEY = "feature_flag.key" @@ -146,13 +146,13 @@ class SpanAttributes: """ 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`. + 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. + 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. """ AWS_LAMBDA_INVOKED_ARN = "aws.lambda.invoked_arn" @@ -281,9 +281,7 @@ class SpanAttributes: Whether or not the query is idempotent. """ - DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( - "db.cassandra.speculative_execution_count" - ) + DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = "db.cassandra.speculative_execution_count" """ The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. """ @@ -328,8 +326,8 @@ class SpanAttributes: """ 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". + Format Reg-{D (Disabled discovery)}-S(application region)|L(List of preferred regions)|N(None, user did not configure it). + Default value is "NS". """ DB_COSMOSDB_CONNECTION_MODE = "db.cosmosdb.connection_mode" @@ -376,14 +374,14 @@ class SpanAttributes: """ Type of the trigger which caused this function invocation. Note: For the server/consumer span on the incoming side, -`faas.trigger` MUST be set. + `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). + 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" @@ -395,22 +393,22 @@ class SpanAttributes: """ 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. + 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: + 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. + * **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" @@ -442,16 +440,16 @@ class SpanAttributes: """ 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.sock.peer.addr`, which would -identify the network-level peer, which may be a proxy. + 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.sock.peer.addr`, is available even if that other -source just confirms the same value as `net.sock.peer.addr`. -Rationale: For `net.sock.peer.addr`, 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.sock.peer.addr` means that -one is at least somewhat confident that the address is not that of -the closest proxy. + This attribute should be set when a source of information different + from the one used for `net.sock.peer.addr`, is available even if that other + source just confirms the same value as `net.sock.peer.addr`. + Rationale: For `net.sock.peer.addr`, 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.sock.peer.addr` means that + one is at least somewhat confident that the address is not that of + the closest proxy. """ NET_SOCK_HOST_ADDR = "net.sock.host.addr" @@ -491,16 +489,12 @@ class SpanAttributes: 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" - ) + 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" - ) + MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = "messaging.message.payload_compressed_size_bytes" """ The compressed size of the message payload in bytes. """ @@ -677,23 +671,17 @@ class SpanAttributes: The JSON-serialized value of each item in the `ConsumedCapacity` response field. """ - AWS_DYNAMODB_ITEM_COLLECTION_METRICS = ( - "aws.dynamodb.item_collection_metrics" - ) + AWS_DYNAMODB_ITEM_COLLECTION_METRICS = "aws.dynamodb.item_collection_metrics" """ The JSON-serialized value of the `ItemCollectionMetrics` response field. """ - AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = ( - "aws.dynamodb.provisioned_read_capacity" - ) + AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = "aws.dynamodb.provisioned_read_capacity" """ The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. """ - AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = ( - "aws.dynamodb.provisioned_write_capacity" - ) + AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = "aws.dynamodb.provisioned_write_capacity" """ The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. """ @@ -728,16 +716,12 @@ class SpanAttributes: The value of the `Select` request parameter. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = ( - "aws.dynamodb.global_secondary_indexes" - ) + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = "aws.dynamodb.global_secondary_indexes" """ The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. """ - AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = ( - "aws.dynamodb.local_secondary_indexes" - ) + AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = "aws.dynamodb.local_secondary_indexes" """ The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. """ @@ -782,9 +766,7 @@ class SpanAttributes: The JSON-serialized value of each item in the `AttributeDefinitions` request field. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = ( - "aws.dynamodb.global_secondary_index_updates" - ) + 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. """ @@ -793,70 +775,70 @@ class SpanAttributes: """ 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`. + 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). + 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: + 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). + - [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: + 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). + - [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). + 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). + 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" @@ -879,14 +861,14 @@ class SpanAttributes: """ 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. + the broker does not have such notion, the destination name SHOULD uniquely identify the broker. """ MESSAGING_SOURCE_NAME = "messaging.source.name" """ The message source name. Note: Source name SHOULD uniquely identify a specific queue, topic, or other entity within the broker. If -the broker does not have such notion, the source name SHOULD uniquely identify the broker. + the broker does not have such notion, the source name SHOULD uniquely identify the broker. """ MESSAGING_DESTINATION_TEMPLATE = "messaging.destination.template" @@ -926,9 +908,7 @@ class SpanAttributes: The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer.group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. """ - MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = ( - "messaging.rabbitmq.destination.routing_key" - ) + MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = "messaging.rabbitmq.destination.routing_key" """ RabbitMQ message routing key. """ @@ -949,9 +929,7 @@ class SpanAttributes: Client Id for the Consumer or Producer that is handling the message. """ - MESSAGING_KAFKA_DESTINATION_PARTITION = ( - "messaging.kafka.destination.partition" - ) + MESSAGING_KAFKA_DESTINATION_PARTITION = "messaging.kafka.destination.partition" """ Partition the message is sent to. """ @@ -986,16 +964,12 @@ class SpanAttributes: The unique identifier for each client. """ - MESSAGING_ROCKETMQ_MESSAGE_DELIVERY_TIMESTAMP = ( - "messaging.rocketmq.message.delivery_timestamp" - ) + 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" - ) + 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. """ @@ -1020,9 +994,7 @@ class SpanAttributes: Key(s) of message, another way to mark message besides message id. """ - MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = ( - "messaging.rocketmq.consumption_model" - ) + MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = "messaging.rocketmq.consumption_model" """ Model of message consumption. This only applies to consumer spans. """ @@ -1082,21 +1054,21 @@ class SpanAttributes: """ 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. + 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 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. + 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. """ # Manually defined deprecated attributes @@ -1210,7 +1182,6 @@ class SpanAttributes: Deprecated. Use `net.protocol.version` attribute. """ - @deprecated( version="1.18.0", reason="Removed from the specification in favor of `net.protocol.name` and `net.protocol.version` attributes", @@ -1228,7 +1199,6 @@ class HttpFlavorValues(Enum): QUIC = "QUIC" - @deprecated( version="1.18.0", reason="Removed from the specification", @@ -1239,8 +1209,7 @@ class MessagingDestinationKindValues(Enum): TOPIC = "topic" """A message sent to a topic.""" - - + class EventDomainValues(Enum): BROWSER = "browser" """Events from browser apps.""" @@ -1841,3 +1810,4 @@ class RpcConnectRpcErrorCodeValues(Enum): UNAUTHENTICATED = "unauthenticated" """unauthenticated.""" + diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index 61ae2eb5990..c3297c6263d 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -37,7 +37,7 @@ class {{class}}: {{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 %} From 1dd0c5499d7f5ceeb7b4710330830cc87bc22f0f Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 28 Jun 2023 12:53:27 -0700 Subject: [PATCH 09/22] lint --- .../semconv/resource/__init__.py | 4 +- .../opentelemetry/semconv/trace/__init__.py | 62 ++++++++++++++----- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index d0dc5a8368e..9e9e181e2ec 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -569,7 +569,8 @@ class ResourceAttributes: """ Deprecated, use the `cloud.resource.id` attribute. """ - + + class CloudProviderValues(Enum): ALIBABA_CLOUD = "alibaba_cloud" """Alibaba Cloud.""" @@ -775,4 +776,3 @@ class TelemetrySdkLanguageValues(Enum): SWIFT = "swift" """swift.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index 16a45309920..80511134da9 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -281,7 +281,9 @@ class SpanAttributes: Whether or not the query is idempotent. """ - DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = "db.cassandra.speculative_execution_count" + DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( + "db.cassandra.speculative_execution_count" + ) """ The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. """ @@ -489,12 +491,16 @@ class SpanAttributes: 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" + 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" + MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = ( + "messaging.message.payload_compressed_size_bytes" + ) """ The compressed size of the message payload in bytes. """ @@ -671,17 +677,23 @@ class SpanAttributes: The JSON-serialized value of each item in the `ConsumedCapacity` response field. """ - AWS_DYNAMODB_ITEM_COLLECTION_METRICS = "aws.dynamodb.item_collection_metrics" + AWS_DYNAMODB_ITEM_COLLECTION_METRICS = ( + "aws.dynamodb.item_collection_metrics" + ) """ The JSON-serialized value of the `ItemCollectionMetrics` response field. """ - AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = "aws.dynamodb.provisioned_read_capacity" + AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = ( + "aws.dynamodb.provisioned_read_capacity" + ) """ The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. """ - AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = "aws.dynamodb.provisioned_write_capacity" + AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = ( + "aws.dynamodb.provisioned_write_capacity" + ) """ The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. """ @@ -716,12 +728,16 @@ class SpanAttributes: The value of the `Select` request parameter. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = "aws.dynamodb.global_secondary_indexes" + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = ( + "aws.dynamodb.global_secondary_indexes" + ) """ The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. """ - AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = "aws.dynamodb.local_secondary_indexes" + AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = ( + "aws.dynamodb.local_secondary_indexes" + ) """ The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. """ @@ -766,7 +782,9 @@ class SpanAttributes: The JSON-serialized value of each item in the `AttributeDefinitions` request field. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = "aws.dynamodb.global_secondary_index_updates" + 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. """ @@ -908,7 +926,9 @@ class SpanAttributes: The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer.group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. """ - MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = "messaging.rabbitmq.destination.routing_key" + MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = ( + "messaging.rabbitmq.destination.routing_key" + ) """ RabbitMQ message routing key. """ @@ -929,7 +949,9 @@ class SpanAttributes: Client Id for the Consumer or Producer that is handling the message. """ - MESSAGING_KAFKA_DESTINATION_PARTITION = "messaging.kafka.destination.partition" + MESSAGING_KAFKA_DESTINATION_PARTITION = ( + "messaging.kafka.destination.partition" + ) """ Partition the message is sent to. """ @@ -964,12 +986,16 @@ class SpanAttributes: The unique identifier for each client. """ - MESSAGING_ROCKETMQ_MESSAGE_DELIVERY_TIMESTAMP = "messaging.rocketmq.message.delivery_timestamp" + 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" + 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. """ @@ -994,7 +1020,9 @@ class SpanAttributes: Key(s) of message, another way to mark message besides message id. """ - MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = "messaging.rocketmq.consumption_model" + MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = ( + "messaging.rocketmq.consumption_model" + ) """ Model of message consumption. This only applies to consumer spans. """ @@ -1182,6 +1210,7 @@ class SpanAttributes: Deprecated. Use `net.protocol.version` attribute. """ + @deprecated( version="1.18.0", reason="Removed from the specification in favor of `net.protocol.name` and `net.protocol.version` attributes", @@ -1199,6 +1228,7 @@ class HttpFlavorValues(Enum): QUIC = "QUIC" + @deprecated( version="1.18.0", reason="Removed from the specification", @@ -1209,7 +1239,8 @@ class MessagingDestinationKindValues(Enum): TOPIC = "topic" """A message sent to a topic.""" - + + class EventDomainValues(Enum): BROWSER = "browser" """Events from browser apps.""" @@ -1810,4 +1841,3 @@ class RpcConnectRpcErrorCodeValues(Enum): UNAUTHENTICATED = "unauthenticated" """unauthenticated.""" - From 408539dea451555c4b490e321a72476663f9f620 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Thu, 29 Jun 2023 11:57:32 -0700 Subject: [PATCH 10/22] update contrib repo commit sha --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd600c03af2..bb5f809777b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ env: # Otherwise, set variable to the commit of your branch on # opentelemetry-python-contrib which is compatible with these Core repo # changes. - CONTRIB_REPO_SHA: 481972cf87c1506e789f586843ba82d93633eac7 + CONTRIB_REPO_SHA: a1d73c5903770e182ac060ab1db026ceb0378414 # This is needed because we do not clone the core repo in contrib builds anymore. # When running contrib builds as part of core builds, we use actions/checkout@v2 which # does not set an environment variable (simply just runs tox), which is different when @@ -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 From 86da7cb9a448ed49c197291e3b057c758cb6f561 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Tue, 4 Jul 2023 09:56:53 -0700 Subject: [PATCH 11/22] new contrib sha --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bb5f809777b..11c3c62570f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ env: # Otherwise, set variable to the commit of your branch on # opentelemetry-python-contrib which is compatible with these Core repo # changes. - CONTRIB_REPO_SHA: a1d73c5903770e182ac060ab1db026ceb0378414 + CONTRIB_REPO_SHA: 054d4a4fc1827c4fa3bbd9a1ec13155ba51374df # This is needed because we do not clone the core repo in contrib builds anymore. # When running contrib builds as part of core builds, we use actions/checkout@v2 which # does not set an environment variable (simply just runs tox), which is different when From 43a7c065a3830b78b113778cd0402d822253f18c Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Wed, 5 Jul 2023 16:47:51 +0200 Subject: [PATCH 12/22] Update SHA --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 11c3c62570f..d41f9341ea7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ env: # Otherwise, set variable to the commit of your branch on # opentelemetry-python-contrib which is compatible with these Core repo # changes. - CONTRIB_REPO_SHA: 054d4a4fc1827c4fa3bbd9a1ec13155ba51374df + CONTRIB_REPO_SHA: 3c0a700faafa5b24de9198bf76a0424e1c0673a5 # This is needed because we do not clone the core repo in contrib builds anymore. # When running contrib builds as part of core builds, we use actions/checkout@v2 which # does not set an environment variable (simply just runs tox), which is different when From d40cfe1d598f71166a9731eff2adba4f3582b726 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 5 Jul 2023 14:28:59 -0700 Subject: [PATCH 13/22] sha and flask --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d41f9341ea7..972405d5ff0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ env: # Otherwise, set variable to the commit of your branch on # opentelemetry-python-contrib which is compatible with these Core repo # changes. - CONTRIB_REPO_SHA: 3c0a700faafa5b24de9198bf76a0424e1c0673a5 + CONTRIB_REPO_SHA: e8700fcb4ca53e819203889d372570a3a1846292 # This is needed because we do not clone the core repo in contrib builds anymore. # When running contrib builds as part of core builds, we use actions/checkout@v2 which # does not set an environment variable (simply just runs tox), which is different when From 313a7da853fc6bba25a48eb41b355fc8fe5cbdee Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 5 Jul 2023 15:54:25 -0700 Subject: [PATCH 14/22] disable too-many-lines in generated files --- .../src/opentelemetry/semconv/resource/__init__.py | 2 ++ .../src/opentelemetry/semconv/trace/__init__.py | 2 ++ scripts/semconv/templates/semantic_attributes.j2 | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index 9e9e181e2ec..ff84f405ae3 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# pylint: disable=too-many-lines + from enum import Enum diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index 80511134da9..822e2cdebc8 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# pylint: disable=too-many-lines + from enum import Enum from deprecated import deprecated diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index c3297c6263d..8f9b465caf2 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -12,7 +12,7 @@ # 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"}} From 76709978363a8b841fb227a184d968620e315179 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 5 Jul 2023 16:21:24 -0700 Subject: [PATCH 15/22] do not run spellcheck on auto-generated semantic convention files --- .codespellrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From becef2e14997b73e520f9e947ea6839259247404 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 27 Sep 2023 13:57:49 -0700 Subject: [PATCH 16/22] Update semconvgen and change repo to semantic-conventions --- .../semconv/resource/__init__.py | 109 +++- .../opentelemetry/semconv/trace/__init__.py | 578 ++++++++++++------ scripts/semconv/generate.sh | 18 +- 3 files changed, 497 insertions(+), 208 deletions(-) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index ff84f405ae3..590135934c8 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -18,7 +18,7 @@ class ResourceAttributes: - SCHEMA_URL = "https://opentelemetry.io/schemas/v1.20.0" + SCHEMA_URL = "https://opentelemetry.io/schemas/v1.21.0" """ The URL of the OpenTelemetry schema for these keys and values. """ @@ -161,6 +161,26 @@ 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. @@ -201,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). @@ -236,7 +280,7 @@ class ResourceAttributes: 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) + [`code.namespace`/`code.function`](/docs/general/general-attributes.md#source-code-attributes) span attributes). For some cloud providers, the above definition is ambiguous. The following @@ -258,7 +302,7 @@ class ResourceAttributes: * **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) + * **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). @@ -304,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" @@ -317,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. @@ -429,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" @@ -493,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`. @@ -505,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" @@ -645,6 +722,9 @@ class CloudPlatformValues(Enum): 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).""" @@ -773,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 822e2cdebc8..a63438c88a4 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -20,10 +20,148 @@ class SpanAttributes: - SCHEMA_URL = "https://opentelemetry.io/schemas/v1.20.0" + SCHEMA_URL = "https://opentelemetry.io/schemas/v1.21.0" """ The URL of the OpenTelemetry schema for these keys and values. """ + CLIENT_ADDRESS = "client.address" + """ + 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. + """ + + CLIENT_PORT = "client.port" + """ + 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. + """ + + CLIENT_SOCKET_ADDRESS = "client.socket.address" + """ + Immediate client peer address - unix domain socket name, IPv4 or IPv6 address. + """ + + CLIENT_SOCKET_PORT = "client.socket.port" + """ + Immediate client peer port number. + """ + + HTTP_METHOD = "http.method" + """ + Deprecated, use `http.request.method` instead. + """ + + HTTP_STATUS_CODE = "http.status_code" + """ + Deprecated, use `http.response.status_code` instead. + """ + + HTTP_SCHEME = "http.scheme" + """ + Deprecated, use `url.scheme` instead. + """ + + HTTP_URL = "http.url" + """ + Deprecated, use `url.full` instead. + """ + + HTTP_TARGET = "http.target" + """ + Deprecated, use `url.path` and `url.query` instead. + """ + + HTTP_REQUEST_CONTENT_LENGTH = "http.request_content_length" + """ + Deprecated, use `http.request.body.size` instead. + """ + + HTTP_RESPONSE_CONTENT_LENGTH = "http.response_content_length" + """ + Deprecated, use `http.response.body.size` instead. + """ + + NET_SOCK_PEER_NAME = "net.sock.peer.name" + """ + Deprecated, use `server.socket.domain` on client spans. + """ + + NET_SOCK_PEER_ADDR = "net.sock.peer.addr" + """ + Deprecated, use `server.socket.address` on client spans and `client.socket.address` on server spans. + """ + + NET_SOCK_PEER_PORT = "net.sock.peer.port" + """ + Deprecated, use `server.socket.port` on client spans and `client.socket.port` on server spans. + """ + + NET_PEER_NAME = "net.peer.name" + """ + Deprecated, use `server.address` on client spans and `client.address` on server spans. + """ + + NET_PEER_PORT = "net.peer.port" + """ + Deprecated, use `server.port` on client spans and `client.port` on server spans. + """ + + NET_HOST_NAME = "net.host.name" + """ + Deprecated, use `server.address`. + """ + + NET_HOST_PORT = "net.host.port" + """ + Deprecated, use `server.port`. + """ + + NET_SOCK_HOST_ADDR = "net.sock.host.addr" + """ + Deprecated, use `server.socket.address`. + """ + + NET_SOCK_HOST_PORT = "net.sock.host.port" + """ + Deprecated, use `server.socket.port`. + """ + + NET_TRANSPORT = "net.transport" + """ + Deprecated, use `network.transport`. + """ + + NET_PROTOCOL_NAME = "net.protocol.name" + """ + Deprecated, use `network.protocol.name`. + """ + + NET_PROTOCOL_VERSION = "net.protocol.version" + """ + Deprecated, use `network.protocol.version`. + """ + + NET_SOCK_FAMILY = "net.sock.family" + """ + Deprecated, use `network.transport` and `network.type`. + """ + + DESTINATION_DOMAIN = "destination.domain" + """ + 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. + """ + + DESTINATION_ADDRESS = "destination.address" + """ + Peer address, for example IP address or UNIX socket name. + """ + + DESTINATION_PORT = "destination.port" + """ + Peer port number. + """ + EXCEPTION_TYPE = "exception.type" """ The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. @@ -39,28 +177,43 @@ 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. """ - HTTP_METHOD = "http.method" + HTTP_REQUEST_METHOD = "http.request.method" """ 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). + + 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. + + 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). + + 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. """ - HTTP_STATUS_CODE = "http.status_code" + HTTP_RESPONSE_STATUS_CODE = "http.response.status_code" """ [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). """ - NET_PROTOCOL_NAME = "net.protocol.name" + NETWORK_PROTOCOL_NAME = "network.protocol.name" """ - Application layer protocol used. The value SHOULD be normalized to lowercase. + [OSI Application Layer](https://osi-model.com/application-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. """ - NET_PROTOCOL_VERSION = "net.protocol.version" + NETWORK_PROTOCOL_VERSION = "network.protocol.version" """ Version of the application layer protocol used. See note below. - Note: `net.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`. + 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`. """ - NET_PEER_NAME = "net.peer.name" + SERVER_ADDRESS = "server.address" """ 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 @@ -72,47 +225,22 @@ class SpanAttributes: SHOULD NOT be set if capturing it would require an extra DNS lookup. """ - NET_PEER_PORT = "net.peer.port" + SERVER_PORT = "server.port" """ 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, `net.peer.name` MUST match URI port identifier, otherwise it MUST match `Host` header port identifier. - """ - - HTTP_SCHEME = "http.scheme" - """ - The URI scheme identifying the used protocol. + 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. """ HTTP_ROUTE = "http.route" """ 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](/specification/trace/semantic_conventions/http.md#http-server-definitions) if there is one. + SHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one. """ - NET_HOST_NAME = "net.host.name" + URL_SCHEME = "url.scheme" """ - Name of the local HTTP server that received the request. - Note: Determined by using the first of the following that applies - - - The [primary server name](/specification/trace/semantic_conventions/http.md#http-server-definitions) of the matched virtual host. MUST only - include host identifier. - - 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 only IP address is available and capturing name would require a reverse DNS lookup. - """ - - NET_HOST_PORT = "net.host.port" - """ - Port of the local HTTP server that received the request. - Note: Determined by using the first of the following that applies - - - Port identifier of the [primary server host](/specification/trace/semantic_conventions/http.md#http-server-definitions) of the matched virtual host. - - Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) - if it's sent in absolute-form. - - Port identifier of the `Host` header. + The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. """ EVENT_NAME = "event.name" @@ -157,6 +285,74 @@ class SpanAttributes: should be determined by the implementer. """ + LOG_IOSTREAM = "log.iostream" + """ + The stream associated with the log. See below for a list of well-known values. + """ + + LOG_FILE_NAME = "log.file.name" + """ + The basename of the file. + """ + + LOG_FILE_PATH = "log.file.path" + """ + The full path to the file. + """ + + LOG_FILE_NAME_RESOLVED = "log.file.name_resolved" + """ + The basename of the file, with symlinks resolved. + """ + + LOG_FILE_PATH_RESOLVED = "log.file.path_resolved" + """ + The full path to the file, with symlinks resolved. + """ + + SERVER_SOCKET_ADDRESS = "server.socket.address" + """ + 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). + """ + + POOL = "pool" + """ + 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()). + """ + + TYPE = "type" + """ + The type of memory. + """ + + 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. + """ + + SERVER_SOCKET_PORT = "server.socket.port" + """ + Physical server port. + """ + + SOURCE_DOMAIN = "source.domain" + """ + 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. + """ + + SOURCE_ADDRESS = "source.address" + """ + Source address, for example IP address or Unix socket name. + """ + + SOURCE_PORT = "source.port" + """ + Source port number. + """ + AWS_LAMBDA_INVOKED_ARN = "aws.lambda.invoked_arn" """ The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable). @@ -231,35 +427,20 @@ class SpanAttributes: 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. """ - NET_SOCK_PEER_ADDR = "net.sock.peer.addr" - """ - Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local communication, [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). - """ - - NET_SOCK_PEER_PORT = "net.sock.peer.port" - """ - Remote socket peer port. - """ - - NET_SOCK_FAMILY = "net.sock.family" + NETWORK_TRANSPORT = "network.transport" """ - Protocol [address family](https://man7.org/linux/man-pages/man7/address_families.7.html) which is used for communication. + [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. """ - NET_SOCK_PEER_NAME = "net.sock.peer.name" + NETWORK_TYPE = "network.type" """ - Remote socket peer name. - """ - - NET_TRANSPORT = "net.transport" - """ - Transport protocol used. See note below. + [OSI Network Layer](https://osi-model.com/network-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. """ DB_MSSQL_INSTANCE_NAME = "db.mssql.instance_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). + Note: If setting a `db.mssql.instance_name`, `server.port` is no longer required (but still recommended if non-standard). """ DB_CASSANDRA_PAGE_SIZE = "db.cassandra.page_size" @@ -310,6 +491,14 @@ class SpanAttributes: The collection being accessed within the database stated in `db.name`. """ + URL_FULL = "url.full" + """ + Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986). + Note: For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. + `url.full` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case username and password should be redacted and attribute's value should be `https://REDACTED:REDACTED@www.example.com/`. + `url.full` SHOULD capture the absolute URL when it is available (or can be reconstructed) and SHOULD NOT be validated or modified except for sanitizing purposes. + """ + DB_SQL_TABLE = "db.sql.table" """ The name of the primary table that the operation is acting upon, including the database name (if applicable). @@ -435,35 +624,16 @@ class SpanAttributes: 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. """ - HTTP_TARGET = "http.target" - """ - The full request target as passed in a HTTP request line or equivalent. - """ - - HTTP_CLIENT_IP = "http.client_ip" + URL_PATH = "url.path" """ - 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.sock.peer.addr`, 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.sock.peer.addr`, is available even if that other - source just confirms the same value as `net.sock.peer.addr`. - Rationale: For `net.sock.peer.addr`, 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.sock.peer.addr` means that - one is at least somewhat confident that the address is not that of - the closest proxy. + The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component. + Note: When missing, the value is assumed to be `/`. """ - NET_SOCK_HOST_ADDR = "net.sock.host.addr" + URL_QUERY = "url.query" """ - Local socket address. Useful in case of a multi-IP host. - """ - - NET_SOCK_HOST_PORT = "net.sock.host.port" - """ - Local socket port number. + 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" @@ -483,6 +653,34 @@ class SpanAttributes: 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. @@ -540,39 +738,39 @@ class SpanAttributes: Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function. """ - NET_HOST_CONNECTION_TYPE = "net.host.connection.type" + NETWORK_CONNECTION_TYPE = "network.connection.type" """ - The internet connection type currently being used by the host. + The internet connection type. """ - NET_HOST_CONNECTION_SUBTYPE = "net.host.connection.subtype" + 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. """ - NET_HOST_CARRIER_NAME = "net.host.carrier.name" + NETWORK_CARRIER_NAME = "network.carrier.name" """ The name of the mobile carrier. """ - NET_HOST_CARRIER_MCC = "net.host.carrier.mcc" + NETWORK_CARRIER_MCC = "network.carrier.mcc" """ The mobile carrier country code. """ - NET_HOST_CARRIER_MNC = "net.host.carrier.mnc" + NETWORK_CARRIER_MNC = "network.carrier.mnc" """ The mobile carrier network code. """ - NET_HOST_CARRIER_ICC = "net.host.carrier.icc" + 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`](../../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 [`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" @@ -625,20 +823,19 @@ class SpanAttributes: The column number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. """ - HTTP_REQUEST_CONTENT_LENGTH = "http.request_content_length" + HTTP_REQUEST_METHOD_ORIGINAL = "http.request.method_original" """ - 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. + Original HTTP method sent by the client in the request line. """ - HTTP_RESPONSE_CONTENT_LENGTH = "http.response_content_length" + HTTP_REQUEST_BODY_SIZE = "http.request.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. + 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_URL = "http.url" + HTTP_RESPONSE_BODY_SIZE = "http.response.body.size" """ - 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 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" @@ -877,57 +1074,6 @@ class SpanAttributes: Note: The value may be sanitized to exclude sensitive information. """ - 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_SOURCE_NAME = "messaging.source.name" - """ - The message source name. - Note: Source name SHOULD uniquely identify a specific queue, topic, or other entity within the broker. If - the broker does not have such notion, the source 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_SOURCE_TEMPLATE = "messaging.source.template" - """ - Low cardinality representation of the messaging source name. - Note: Source names could be constructed from templates. An example would be a source name involving a user name or product id. Although the source 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_SOURCE_TEMPORARY = "messaging.source.temporary" - """ - A boolean that is true if the message source is temporary and might not exist anymore after messages are processed. - """ - - MESSAGING_SOURCE_ANONYMOUS = "messaging.source.anonymous" - """ - A boolean that is true if the message source is anonymous (could be unnamed or have auto-generated name). - """ - - MESSAGING_CONSUMER_ID = "messaging.consumer.id" - """ - The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer.group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. - """ - MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = ( "messaging.rabbitmq.destination.routing_key" ) @@ -946,11 +1092,6 @@ class SpanAttributes: Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. """ - MESSAGING_KAFKA_CLIENT_ID = "messaging.kafka.client_id" - """ - Client Id for the Consumer or Producer that is handling the message. - """ - MESSAGING_KAFKA_DESTINATION_PARTITION = ( "messaging.kafka.destination.partition" ) @@ -958,11 +1099,6 @@ class SpanAttributes: Partition the message is sent to. """ - MESSAGING_KAFKA_SOURCE_PARTITION = "messaging.kafka.source.partition" - """ - Partition the message is received from. - """ - MESSAGING_KAFKA_MESSAGE_OFFSET = "messaging.kafka.message.offset" """ The offset of a record in the corresponding Kafka partition. @@ -983,11 +1119,6 @@ class SpanAttributes: Name of the RocketMQ producer/consumer group that is handling the message. The client type is identified by the SpanKind. """ - MESSAGING_ROCKETMQ_CLIENT_ID = "messaging.rocketmq.client_id" - """ - The unique identifier for each client. - """ - MESSAGING_ROCKETMQ_MESSAGE_DELIVERY_TIMESTAMP = ( "messaging.rocketmq.message.delivery_timestamp" ) @@ -1101,6 +1232,11 @@ class SpanAttributes: 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" @@ -1243,6 +1379,66 @@ class MessagingDestinationKindValues(Enum): """A message sent to a topic.""" +class NetTransportValues(Enum): + IP_TCP = "ip_tcp" + """ip_tcp.""" + + IP_UDP = "ip_udp" + """ip_udp.""" + + PIPE = "pipe" + """Named or anonymous pipe.""" + + INPROC = "inproc" + """In-process communication.""" + + OTHER = "other" + """Something else (non IP-based).""" + + +class NetSockFamilyValues(Enum): + INET = "inet" + """IPv4 address.""" + + INET6 = "inet6" + """IPv6 address.""" + + UNIX = "unix" + """Unix domain socket path.""" + + +class HttpRequestMethodValues(Enum): + CONNECT = "CONNECT" + """CONNECT method.""" + + DELETE = "DELETE" + """DELETE method.""" + + GET = "GET" + """GET method.""" + + HEAD = "HEAD" + """HEAD method.""" + + OPTIONS = "OPTIONS" + """OPTIONS method.""" + + PATCH = "PATCH" + """PATCH method.""" + + POST = "POST" + """POST method.""" + + PUT = "PUT" + """PUT method.""" + + TRACE = "TRACE" + """TRACE method.""" + + OTHER = "_OTHER" + """Any HTTP method that the instrumentation has no prior knowledge of.""" + + class EventDomainValues(Enum): BROWSER = "browser" """Events from browser apps.""" @@ -1254,6 +1450,22 @@ class EventDomainValues(Enum): """Events from Kubernetes.""" +class LogIostreamValues(Enum): + STDOUT = "stdout" + """Logs from stdout stream.""" + + STDERR = "stderr" + """Events from stderr stream.""" + + +class TypeValues(Enum): + HEAP = "heap" + """Heap memory.""" + + NON_HEAP = "non_heap" + """Non-heap memory.""" + + class OpentracingRefTypeValues(Enum): CHILD_OF = "child_of" """The parent Span depends on the child Span in some capacity.""" @@ -1420,32 +1632,26 @@ class DbSystemValues(Enum): """Trino.""" -class NetSockFamilyValues(Enum): - INET = "inet" - """IPv4 address.""" - - INET6 = "inet6" - """IPv6 address.""" - - UNIX = "unix" - """Unix domain socket path.""" - +class NetworkTransportValues(Enum): + TCP = "tcp" + """TCP.""" -class NetTransportValues(Enum): - IP_TCP = "ip_tcp" - """ip_tcp.""" - - IP_UDP = "ip_udp" - """ip_udp.""" + 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): @@ -1602,7 +1808,7 @@ class FaasInvokedProviderValues(Enum): """Tencent Cloud.""" -class NetHostConnectionTypeValues(Enum): +class NetworkConnectionTypeValues(Enum): WIFI = "wifi" """wifi.""" @@ -1619,7 +1825,7 @@ class NetHostConnectionTypeValues(Enum): """unknown.""" -class NetHostConnectionSubtypeValues(Enum): +class NetworkConnectionSubtypeValues(Enum): GPRS = "gprs" """GPRS.""" diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index bebae967070..3b804572fdf 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -4,24 +4,24 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec version to make SemanticAttributes generation reproducible -SPEC_VERSION=v1.20.0 +SPEC_VERSION=v1.21.0 SCHEMA_URL=https://opentelemetry.io/schemas/$SPEC_VERSION -OTEL_SEMCONV_GEN_IMG_VERSION=0.18.0 +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-c || 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:/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 \ @@ -33,7 +33,7 @@ docker run --rm \ -DschemaUrl=$SCHEMA_URL docker run --rm \ - -v ${SCRIPT_DIR}/opentelemetry-specification/semantic_conventions:/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 \ @@ -42,6 +42,6 @@ docker run --rm \ --template /templates/semantic_attributes.j2 \ --output /output/__init__.py \ -Dclass=ResourceAttributes \ - -DschemaUrl=$SCHEMA_URL + -DschemaUrl=$SCHEMA_URL cd "$ROOT_DIR" From 34a5545f71529554e3e8546f32f0bf5dc762aca9 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 27 Sep 2023 15:17:13 -0700 Subject: [PATCH 17/22] Add removed attributes and update metrics --- .github/workflows/test.yml | 2 +- .gitignore | 3 + CHANGELOG.md | 1 + docs/examples/django/README.rst | 16 +- opentelemetry-sdk/tests/trace/test_trace.py | 12 +- .../opentelemetry/semconv/metrics/__init__.py | 34 +++- .../opentelemetry/semconv/trace/__init__.py | 155 +++++++++++++++-- .../semconv/templates/semantic_attributes.j2 | 156 ++++++++++++++++-- 8 files changed, 342 insertions(+), 37 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 972405d5ff0..88c1675c470 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ env: # Otherwise, set variable to the commit of your branch on # opentelemetry-python-contrib which is compatible with these Core repo # changes. - CONTRIB_REPO_SHA: e8700fcb4ca53e819203889d372570a3a1846292 + CONTRIB_REPO_SHA: 481972cf87c1506e789f586843ba82d93633eac7 # This is needed because we do not clone the core repo in contrib builds anymore. # When running contrib builds as part of core builds, we use actions/checkout@v2 which # does not set an environment variable (simply just runs tox), which is different when 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 0ac43c07e39..e5e0dd09f51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add benchmark tests for metrics ([#3267](https://github.com/open-telemetry/opentelemetry-python/pull/3267)) + ## Version 1.17.0/0.38b0 (2023-03-22) - Implement LowMemory temporality diff --git a/docs/examples/django/README.rst b/docs/examples/django/README.rst index 37dca9cc624..1dd8999c036 100644 --- a/docs/examples/django/README.rst +++ b/docs/examples/django/README.rst @@ -84,14 +84,14 @@ output similar to this one: "status_code": "OK" }, "attributes": { - "http.method": "GET", - "net.peer.name": "localhost", - "http.scheme": "http", - "net.peer.port": 8000, - "http.url": "http://localhost:8000/?param=hello", - "net.sock.peer.addr": "127.0.0.1", - "net.protocol.version": "1.1", - "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..3ed02aec986 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) @@ -663,10 +663,10 @@ def test_attributes(self): self.assertEqual(len(root.attributes), 9) self.assertEqual(root.attributes["http.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..9fcf5ab05ce 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py @@ -18,17 +18,47 @@ class MetricInstruments: HTTP_SERVER_DURATION = "http.server.duration" + """ + Deprecated. Use `http.server.request.duration` metric. + """ HTTP_SERVER_REQUEST_SIZE = "http.server.request.size" + """ + Deprecated. Use `http.server.request.body.size` metric. + """ HTTP_SERVER_RESPONSE_SIZE = "http.server.response.size" - - HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests" + """ + Deprecated. Use `http.server.response.body.size` metric. + """ HTTP_CLIENT_DURATION = "http.client.duration" + """ + Deprecated. Use `http.client.request.duration` metric. + """ HTTP_CLIENT_REQUEST_SIZE = "http.client.request.size" + """ + Deprecated. Use `http.client.response.body.size` metric. + """ HTTP_CLIENT_RESPONSE_SIZE = "http.client.response.size" + """ + Deprecated. Use `http.client.response.body.size` metric. + """ + + HTTP_SERVER_REQUEST_DURATION = "http.server.request.duration" + + HTTP_SERVER_REQUEST_BODY_SIZE = "http.server.request.body.size" + + HTTP_SERVER_RESPONSE_BODY_SIZE = "http.server.response.body.size" + + HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests" + + HTTP_CLIENT_REQUEST_DURATION = "http.client.request.duration" + + HTTP_CLIENT_REQUEST_BODY_SIZE = "http.client.request.body.size" + + HTTP_CLIENT_RESPONSE_BODY_SIZE = "http.client.response.body.size" DB_CLIENT_CONNECTIONS_USAGE = "db.client.connections.usage" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index a63438c88a4..e9cd8dd517a 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -1241,22 +1241,22 @@ class SpanAttributes: NET_PEER_IP = "net.peer.ip" """ - Deprecated, use the `net.peer.sock.addr` attribute. + Deprecated, use the `client.socket.address` attribute. """ NET_HOST_IP = "net.host.ip" """ - Deprecated, use the `net.host.sock.addr` attribute. + Deprecated, use the `server.socket.address` attribute. """ HTTP_SERVER_NAME = "http.server_name" """ - Deprecated, use the `net.host.name` attribute. + Deprecated, use the `server.address` attribute. """ HTTP_HOST = "http.host" """ - Deprecated, use the `net.peer.name` attribute. + Deprecated, use the `server.address` and `server.port` attributes. """ HTTP_RETRY_COUNT = "http.retry_count" @@ -1295,17 +1295,17 @@ class SpanAttributes: MESSAGING_PROTOCOL = "messaging.protocol" """ - Deprecated. Use `net.protocol.name` attribute. + Deprecated. Use `network.protocol.name` attribute. """ MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version" """ - Deprecated. Use `net.protocol.version` attribute. + Deprecated. Use `network.protocol.version` attribute. """ MESSAGING_URL = "messaging.url" """ - Deprecated. Use `net.peer.name` attribute. + Deprecated. Use `server.address` and `server.port` attributes. """ MESSAGING_CONVERSATION_ID = "messaging.conversation_id" @@ -1340,18 +1340,63 @@ class SpanAttributes: NET_APP_PROTOCOL_NAME = "net.app.protocol.name" """ - Deprecated. Use `net.protocol.name` attribute. + Deprecated. Use `network.protocol.name` attribute. """ NET_APP_PROTOCOL_VERSION = "net.app.protocol.version" """ - Deprecated. Use `net.protocol.version` attribute. + Deprecated. Use `network.protocol.version` attribute. + """ + + HTTP_CLIENT_IP = "http.client_ip" + """ + Deprecated. Use `client.address` attribute. + """ + + 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 `net.protocol.name` and `net.protocol.version` attributes", + reason="Removed from the specification in favor of `network.protocol.name` and `network.protocol.version` attributes", ) class HttpFlavorValues(Enum): HTTP_1_0 = "1.0" @@ -1379,6 +1424,96 @@ class MessagingDestinationKindValues(Enum): """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.""" + + class NetTransportValues(Enum): IP_TCP = "ip_tcp" """ip_tcp.""" diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index 8f9b465caf2..9aa48f40a84 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -52,22 +52,22 @@ class {{class}}: NET_PEER_IP = "net.peer.ip" """ - Deprecated, use the `net.peer.sock.addr` attribute. + Deprecated, use the `client.socket.address` attribute. """ NET_HOST_IP = "net.host.ip" """ - Deprecated, use the `net.host.sock.addr` attribute. + Deprecated, use the `server.socket.address` attribute. """ HTTP_SERVER_NAME = "http.server_name" """ - Deprecated, use the `net.host.name` attribute. + Deprecated, use the `server.address` attribute. """ HTTP_HOST = "http.host" """ - Deprecated, use the `net.peer.name` attribute. + Deprecated, use the `server.address` and `server.port` attributes. """ HTTP_RETRY_COUNT = "http.retry_count" @@ -106,17 +106,17 @@ class {{class}}: MESSAGING_PROTOCOL = "messaging.protocol" """ - Deprecated. Use `net.protocol.name` attribute. + Deprecated. Use `network.protocol.name` attribute. """ MESSAGING_PROTOCOL_VERSION = "messaging.protocol_version" """ - Deprecated. Use `net.protocol.version` attribute. + Deprecated. Use `network.protocol.version` attribute. """ MESSAGING_URL = "messaging.url" """ - Deprecated. Use `net.peer.name` attribute. + Deprecated. Use `server.address` and `server.port` attributes. """ MESSAGING_CONVERSATION_ID = "messaging.conversation_id" @@ -151,17 +151,62 @@ class {{class}}: NET_APP_PROTOCOL_NAME = "net.app.protocol.name" """ - Deprecated. Use `net.protocol.name` attribute. + Deprecated. Use `network.protocol.name` attribute. """ NET_APP_PROTOCOL_VERSION = "net.app.protocol.version" """ - Deprecated. Use `net.protocol.version` attribute. + Deprecated. Use `network.protocol.version` attribute. + """ + + HTTP_CLIENT_IP = "http.client_ip" + """ + Deprecated. Use `client.address` attribute. + """ + + 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 `net.protocol.name` and `net.protocol.version` attributes", + reason="Removed from the specification in favor of `network.protocol.name` and `network.protocol.version` attributes", ) class HttpFlavorValues(Enum): HTTP_1_0 = "1.0" @@ -186,6 +231,97 @@ class MessagingDestinationKindValues(Enum): 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" %} From 6e61be6a2c38df9b4d1ccb5d6dc6ce64faf5d6d8 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 27 Sep 2023 15:33:23 -0700 Subject: [PATCH 18/22] nits --- opentelemetry-sdk/tests/trace/test_trace.py | 2 +- .../src/opentelemetry/semconv/trace/__init__.py | 5 +++++ scripts/semconv/generate.sh | 2 +- scripts/semconv/templates/semantic_attributes.j2 | 9 +++++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/opentelemetry-sdk/tests/trace/test_trace.py b/opentelemetry-sdk/tests/trace/test_trace.py index 3ed02aec986..b08afce4a6d 100644 --- a/opentelemetry-sdk/tests/trace/test_trace.py +++ b/opentelemetry-sdk/tests/trace/test_trace.py @@ -661,7 +661,7 @@ 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["url.full"], "https://example.com:779/path/12/?q=d#123", diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index e9cd8dd517a..c100510ec18 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -1353,6 +1353,11 @@ class SpanAttributes: 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. diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index 3b804572fdf..c3351070fbb 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -10,7 +10,7 @@ OTEL_SEMCONV_GEN_IMG_VERSION=0.21.0 cd ${SCRIPT_DIR} -rm -rf semantic-c || true +rm -rf semantic-conventions || true mkdir semantic-conventions cd semantic-conventions diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index 9aa48f40a84..a96ac692d6c 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -79,14 +79,14 @@ class {{class}}: "http.request_content_length_uncompressed" ) """ - Deprecated, use the `http.request_content_length` attribute. + Deprecated, use the `http.request.body.size` attribute. """ HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = ( "http.response_content_length_uncompressed" ) """ - Deprecated, use the `http.response_content_length` attribute. + Deprecated, use the `http.response.body.size` attribute. """ MESSAGING_DESTINATION = "messaging.destination" @@ -164,6 +164,11 @@ class {{class}}: 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. From c3a8f38cc4d75398462cd2eefe74c422448da9f8 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 27 Sep 2023 20:50:01 -0700 Subject: [PATCH 19/22] Add metric names auto-generation --- .../opentelemetry/semconv/metrics/__init__.py | 157 ++++++++++++++++-- .../semconv/resource/__init__.py | 4 +- .../opentelemetry/semconv/trace/__init__.py | 65 ++------ scripts/semconv/generate.sh | 12 ++ scripts/semconv/templates/semantic_metrics.j2 | 34 ++++ 5 files changed, 207 insertions(+), 65 deletions(-) create mode 100644 scripts/semconv/templates/semantic_metrics.j2 diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py index 9fcf5ab05ce..e4221c77b12 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py @@ -14,51 +14,176 @@ # 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" """ - Deprecated. Use `http.server.request.duration` metric. + 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" """ - Deprecated. Use `http.server.request.body.size` metric. + Measures the size of HTTP request messages (compressed) + Instrument: histogram + Unit: By """ HTTP_SERVER_RESPONSE_SIZE = "http.server.response.size" """ - Deprecated. Use `http.server.response.body.size` metric. + Measures the size of HTTP response messages (compressed) + Instrument: histogram + Unit: By """ HTTP_CLIENT_DURATION = "http.client.duration" """ - Deprecated. Use `http.client.request.duration` metric. + Measures the duration of outbound HTTP requests + Instrument: histogram + Unit: s """ HTTP_CLIENT_REQUEST_SIZE = "http.client.request.size" """ - Deprecated. Use `http.client.response.body.size` metric. + Measures the size of HTTP request messages (compressed) + Instrument: histogram + Unit: By """ HTTP_CLIENT_RESPONSE_SIZE = "http.client.response.size" """ - Deprecated. Use `http.client.response.body.size` metric. + 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 """ - HTTP_SERVER_REQUEST_DURATION = "http.server.request.duration" + 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 + """ - HTTP_SERVER_REQUEST_BODY_SIZE = "http.server.request.body.size" + PROCESS_RUNTIME_JVM_BUFFER_USAGE = "process.runtime.jvm.buffer.usage" + """ + Measure of memory used by buffers + Instrument: updowncounter + Unit: By + """ - HTTP_SERVER_RESPONSE_BODY_SIZE = "http.server.response.body.size" + PROCESS_RUNTIME_JVM_BUFFER_LIMIT = "process.runtime.jvm.buffer.limit" + """ + Measure of total memory capacity of buffers + Instrument: updowncounter + Unit: By + """ - HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests" + 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 + """ - HTTP_CLIENT_REQUEST_DURATION = "http.client.request.duration" + 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} + """ - HTTP_CLIENT_REQUEST_BODY_SIZE = "http.client.request.body.size" + PROCESS_RUNTIME_JVM_CLASSES_LOADED = "process.runtime.jvm.classes.loaded" + """ + Number of classes loaded since JVM start + Instrument: counter + Unit: {class} + """ - HTTP_CLIENT_RESPONSE_BODY_SIZE = "http.client.response.body.size" + PROCESS_RUNTIME_JVM_CLASSES_UNLOADED = "process.runtime.jvm.classes.unloaded" + """ + Number of classes unloaded since JVM start + Instrument: counter + Unit: {class} + """ - DB_CLIENT_CONNECTIONS_USAGE = "db.client.connections.usage" + 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 + """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index 590135934c8..87d2d61a93c 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -648,8 +648,7 @@ class ResourceAttributes: """ Deprecated, use the `cloud.resource.id` attribute. """ - - + class CloudProviderValues(Enum): ALIBABA_CLOUD = "alibaba_cloud" """Alibaba Cloud.""" @@ -861,3 +860,4 @@ class TelemetrySdkLanguageValues(Enum): 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 c100510ec18..a805a595842 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -464,9 +464,7 @@ class SpanAttributes: Whether or not the query is idempotent. """ - DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( - "db.cassandra.speculative_execution_count" - ) + DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = "db.cassandra.speculative_execution_count" """ The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. """ @@ -691,16 +689,12 @@ class SpanAttributes: 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" - ) + 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" - ) + MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = "messaging.message.payload_compressed_size_bytes" """ The compressed size of the message payload in bytes. """ @@ -876,23 +870,17 @@ class SpanAttributes: The JSON-serialized value of each item in the `ConsumedCapacity` response field. """ - AWS_DYNAMODB_ITEM_COLLECTION_METRICS = ( - "aws.dynamodb.item_collection_metrics" - ) + AWS_DYNAMODB_ITEM_COLLECTION_METRICS = "aws.dynamodb.item_collection_metrics" """ The JSON-serialized value of the `ItemCollectionMetrics` response field. """ - AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = ( - "aws.dynamodb.provisioned_read_capacity" - ) + AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = "aws.dynamodb.provisioned_read_capacity" """ The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. """ - AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = ( - "aws.dynamodb.provisioned_write_capacity" - ) + AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = "aws.dynamodb.provisioned_write_capacity" """ The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. """ @@ -927,16 +915,12 @@ class SpanAttributes: The value of the `Select` request parameter. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = ( - "aws.dynamodb.global_secondary_indexes" - ) + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = "aws.dynamodb.global_secondary_indexes" """ The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. """ - AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = ( - "aws.dynamodb.local_secondary_indexes" - ) + AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = "aws.dynamodb.local_secondary_indexes" """ The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. """ @@ -981,9 +965,7 @@ class SpanAttributes: The JSON-serialized value of each item in the `AttributeDefinitions` request field. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = ( - "aws.dynamodb.global_secondary_index_updates" - ) + 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. """ @@ -1074,9 +1056,7 @@ class SpanAttributes: Note: The value may be sanitized to exclude sensitive information. """ - MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = ( - "messaging.rabbitmq.destination.routing_key" - ) + MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = "messaging.rabbitmq.destination.routing_key" """ RabbitMQ message routing key. """ @@ -1092,9 +1072,7 @@ class SpanAttributes: Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. """ - MESSAGING_KAFKA_DESTINATION_PARTITION = ( - "messaging.kafka.destination.partition" - ) + MESSAGING_KAFKA_DESTINATION_PARTITION = "messaging.kafka.destination.partition" """ Partition the message is sent to. """ @@ -1119,16 +1097,12 @@ class SpanAttributes: 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" - ) + 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" - ) + 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. """ @@ -1153,9 +1127,7 @@ class SpanAttributes: Key(s) of message, another way to mark message besides message id. """ - MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = ( - "messaging.rocketmq.consumption_model" - ) + MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = "messaging.rocketmq.consumption_model" """ Model of message consumption. This only applies to consumer spans. """ @@ -1268,14 +1240,14 @@ class SpanAttributes: "http.request_content_length_uncompressed" ) """ - Deprecated, use the `http.request_content_length` attribute. + Deprecated, use the `http.request.body.size` attribute. """ HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = ( "http.response_content_length_uncompressed" ) """ - Deprecated, use the `http.response_content_length` attribute. + Deprecated, use the `http.response.body.size` attribute. """ MESSAGING_DESTINATION = "messaging.destination" @@ -1398,7 +1370,6 @@ class SpanAttributes: 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", @@ -1416,7 +1387,6 @@ class HttpFlavorValues(Enum): QUIC = "QUIC" - @deprecated( version="1.18.0", reason="Removed from the specification", @@ -1518,7 +1488,7 @@ class NetHostConnectionSubtypeValues(Enum): LTE_CA = "lte_ca" """LTE CA.""" - + class NetTransportValues(Enum): IP_TCP = "ip_tcp" """ip_tcp.""" @@ -2189,3 +2159,4 @@ class RpcConnectRpcErrorCodeValues(Enum): UNAUTHENTICATED = "unauthenticated" """unauthenticated.""" + diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index c3351070fbb..3a453db025d 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -44,4 +44,16 @@ docker run --rm \ -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_metrics.j2 b/scripts/semconv/templates/semantic_metrics.j2 new file mode 100644 index 00000000000..e6450b8f230 --- /dev/null +++ b/scripts/semconv/templates/semantic_metrics.j2 @@ -0,0 +1,34 @@ +# 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. + +# pylint: disable=too-many-lines + +{%- macro print_value(type, value) -%} + {{ "\"" if type == "string"}}{{value}}{{ "\"" if type == "string"}} +{%- endmacro %} + +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 %} From 37bf9baceeb441c9310a5228d226ff3dd5d82c40 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Wed, 27 Sep 2023 20:51:12 -0700 Subject: [PATCH 20/22] black --- .../opentelemetry/semconv/metrics/__init__.py | 31 +++++++--- .../semconv/resource/__init__.py | 4 +- .../opentelemetry/semconv/trace/__init__.py | 61 ++++++++++++++----- 3 files changed, 70 insertions(+), 26 deletions(-) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py index e4221c77b12..306ac6ed5e6 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py @@ -14,12 +14,13 @@ # 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 @@ -76,14 +77,18 @@ class MetricInstruments: Unit: By """ - PROCESS_RUNTIME_JVM_SYSTEM_CPU_UTILIZATION = "process.runtime.jvm.system.cpu.utilization" + 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" + 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 @@ -118,7 +123,9 @@ class MetricInstruments: Unit: By """ - PROCESS_RUNTIME_JVM_MEMORY_COMMITTED = "process.runtime.jvm.memory.committed" + PROCESS_RUNTIME_JVM_MEMORY_COMMITTED = ( + "process.runtime.jvm.memory.committed" + ) """ Measure of memory committed Instrument: updowncounter @@ -132,7 +139,9 @@ class MetricInstruments: Unit: By """ - PROCESS_RUNTIME_JVM_MEMORY_USAGE_AFTER_LAST_GC = "process.runtime.jvm.memory.usage_after_last_gc" + 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 @@ -160,14 +169,18 @@ class MetricInstruments: Unit: {class} """ - PROCESS_RUNTIME_JVM_CLASSES_UNLOADED = "process.runtime.jvm.classes.unloaded" + 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" + PROCESS_RUNTIME_JVM_CLASSES_CURRENT_LOADED = ( + "process.runtime.jvm.classes.current_loaded" + ) """ Number of classes currently loaded Instrument: updowncounter @@ -181,7 +194,9 @@ class MetricInstruments: Unit: s """ - PROCESS_RUNTIME_JVM_CPU_RECENT_UTILIZATION = "process.runtime.jvm.cpu.recent_utilization" + 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 diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index 87d2d61a93c..590135934c8 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -648,7 +648,8 @@ class ResourceAttributes: """ Deprecated, use the `cloud.resource.id` attribute. """ - + + class CloudProviderValues(Enum): ALIBABA_CLOUD = "alibaba_cloud" """Alibaba Cloud.""" @@ -860,4 +861,3 @@ class TelemetrySdkLanguageValues(Enum): 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 a805a595842..48df586dc18 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -464,7 +464,9 @@ class SpanAttributes: Whether or not the query is idempotent. """ - DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = "db.cassandra.speculative_execution_count" + DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = ( + "db.cassandra.speculative_execution_count" + ) """ The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. """ @@ -689,12 +691,16 @@ class SpanAttributes: 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" + 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" + MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = ( + "messaging.message.payload_compressed_size_bytes" + ) """ The compressed size of the message payload in bytes. """ @@ -870,17 +876,23 @@ class SpanAttributes: The JSON-serialized value of each item in the `ConsumedCapacity` response field. """ - AWS_DYNAMODB_ITEM_COLLECTION_METRICS = "aws.dynamodb.item_collection_metrics" + AWS_DYNAMODB_ITEM_COLLECTION_METRICS = ( + "aws.dynamodb.item_collection_metrics" + ) """ The JSON-serialized value of the `ItemCollectionMetrics` response field. """ - AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = "aws.dynamodb.provisioned_read_capacity" + AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = ( + "aws.dynamodb.provisioned_read_capacity" + ) """ The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. """ - AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = "aws.dynamodb.provisioned_write_capacity" + AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = ( + "aws.dynamodb.provisioned_write_capacity" + ) """ The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. """ @@ -915,12 +927,16 @@ class SpanAttributes: The value of the `Select` request parameter. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = "aws.dynamodb.global_secondary_indexes" + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = ( + "aws.dynamodb.global_secondary_indexes" + ) """ The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. """ - AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = "aws.dynamodb.local_secondary_indexes" + AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = ( + "aws.dynamodb.local_secondary_indexes" + ) """ The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. """ @@ -965,7 +981,9 @@ class SpanAttributes: The JSON-serialized value of each item in the `AttributeDefinitions` request field. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = "aws.dynamodb.global_secondary_index_updates" + 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. """ @@ -1056,7 +1074,9 @@ class SpanAttributes: Note: The value may be sanitized to exclude sensitive information. """ - MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = "messaging.rabbitmq.destination.routing_key" + MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY = ( + "messaging.rabbitmq.destination.routing_key" + ) """ RabbitMQ message routing key. """ @@ -1072,7 +1092,9 @@ class SpanAttributes: Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. """ - MESSAGING_KAFKA_DESTINATION_PARTITION = "messaging.kafka.destination.partition" + MESSAGING_KAFKA_DESTINATION_PARTITION = ( + "messaging.kafka.destination.partition" + ) """ Partition the message is sent to. """ @@ -1097,12 +1119,16 @@ class SpanAttributes: 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" + 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" + 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. """ @@ -1127,7 +1153,9 @@ class SpanAttributes: Key(s) of message, another way to mark message besides message id. """ - MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = "messaging.rocketmq.consumption_model" + MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = ( + "messaging.rocketmq.consumption_model" + ) """ Model of message consumption. This only applies to consumer spans. """ @@ -1370,6 +1398,7 @@ class SpanAttributes: 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", @@ -1387,6 +1416,7 @@ class HttpFlavorValues(Enum): QUIC = "QUIC" + @deprecated( version="1.18.0", reason="Removed from the specification", @@ -1488,7 +1518,7 @@ class NetHostConnectionSubtypeValues(Enum): LTE_CA = "lte_ca" """LTE CA.""" - + class NetTransportValues(Enum): IP_TCP = "ip_tcp" """ip_tcp.""" @@ -2159,4 +2189,3 @@ class RpcConnectRpcErrorCodeValues(Enum): UNAUTHENTICATED = "unauthenticated" """unauthenticated.""" - From 7ef494cdb78b2c27e7781e3ad8d67168c135c7d0 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Thu, 28 Sep 2023 09:25:31 -0700 Subject: [PATCH 21/22] jinja cleanup and remove schema_url from meter provider for now --- .../metrics/_internal/__init__.py | 3 +-- .../opentelemetry/semconv/metrics/__init__.py | 2 -- .../semconv/templates/semantic_attributes.j2 | 18 ++++++++++++++++++ scripts/semconv/templates/semantic_metrics.j2 | 10 ++-------- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py b/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py index aad76b33a72..630e9c4053d 100644 --- a/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py +++ b/opentelemetry-api/src/opentelemetry/metrics/_internal/__init__.py @@ -719,7 +719,6 @@ def get_meter( name: str, version: str = "", meter_provider: Optional[MeterProvider] = None, - schema_url: Optional[str] = None, ) -> "Meter": """Returns a `Meter` for use by the given instrumentation library. @@ -730,7 +729,7 @@ def get_meter( """ if meter_provider is None: meter_provider = get_meter_provider() - return meter_provider.get_meter(name, version, schema_url) + return meter_provider.get_meter(name, version) def _set_meter_provider(meter_provider: MeterProvider, log: bool) -> None: diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py index 306ac6ed5e6..e3805a7980c 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py @@ -12,8 +12,6 @@ # 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" diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index a96ac692d6c..7e48d747683 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -49,6 +49,15 @@ class {{class}}: {%- 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" """ @@ -331,6 +340,15 @@ class NetHostConnectionSubtypeValues(Enum): {%- 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" """ diff --git a/scripts/semconv/templates/semantic_metrics.j2 b/scripts/semconv/templates/semantic_metrics.j2 index e6450b8f230..ebe142408d8 100644 --- a/scripts/semconv/templates/semantic_metrics.j2 +++ b/scripts/semconv/templates/semantic_metrics.j2 @@ -12,12 +12,6 @@ # 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 %} - class {{class}}: SCHEMA_URL = "{{schemaUrl}}" """ @@ -27,8 +21,8 @@ class {{class}}: {{metric.metric_name | to_const_name}} = "{{metric.metric_name}}" """ {{metric.brief | to_doc_brief}} - Instrument: {{metric.instrument }} - Unit: {{metric.unit }} + Instrument: {{ metric.instrument }} + Unit: {{ metric.unit }} """ {# Extra line #} {%- endif %}{% endfor %} From 30713b4823587daee76bf5808e1261224e5a6850 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Thu, 28 Sep 2023 09:37:12 -0700 Subject: [PATCH 22/22] add db metric manually --- .../src/opentelemetry/semconv/metrics/__init__.py | 9 +++++++++ scripts/semconv/templates/semantic_metrics.j2 | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py index e3805a7980c..9cd7cee94f9 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py @@ -200,3 +200,12 @@ class MetricInstruments: 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/scripts/semconv/templates/semantic_metrics.j2 b/scripts/semconv/templates/semantic_metrics.j2 index ebe142408d8..4fa1260cb56 100644 --- a/scripts/semconv/templates/semantic_metrics.j2 +++ b/scripts/semconv/templates/semantic_metrics.j2 @@ -26,3 +26,15 @@ class {{class}}: """ {# 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