Skip to content

Bump semantic conventions to 1.32.0 #4530

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 9, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#4498](https://github.com/open-telemetry/opentelemetry-python/pull/4498))
- Patch logging.basicConfig so OTel logs don't cause console logs to disappear
([#4436](https://github.com/open-telemetry/opentelemetry-python/pull/4436))
- Bump semantic conventions to 1.32.0
([#4530](https://github.com/open-telemetry/opentelemetry-python/pull/4530))
- Fix ExplicitBucketHistogramAggregation to handle multiple explicit bucket boundaries advisories
([#4521](https://github.com/open-telemetry/opentelemetry-python/pull/4521))

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Final

APP_INSTALLATION_ID: Final = "app.installation.id"
"""
A unique identifier representing the installation of an application on a specific device.
Note: Its value SHOULD persist across launches of the same application installation, including through application upgrades.
It SHOULD change if the application is uninstalled or if all applications of the vendor are uninstalled.
Additionally, users might be able to reset this value (e.g. by clearing application data).
If an app is installed multiple times on the same device (e.g. in different accounts on Android), each `app.installation.id` SHOULD have a different value.
If multiple OpenTelemetry SDKs are used within the same application, they SHOULD use the same value for `app.installation.id`.
Hardware IDs (e.g. serial number, IMEI, MAC address) MUST NOT be used as the `app.installation.id`.

For iOS, this value SHOULD be equal to the [vendor identifier](https://developer.apple.com/documentation/uikit/uidevice/identifierforvendor).

For Android, examples of `app.installation.id` implementations include:

- [Firebase Installation ID](https://firebase.google.com/docs/projects/manage-installations).
- A globally unique UUID which is persisted across sessions in your application.
- [App set ID](https://developer.android.com/identity/app-set-id).
- [`Settings.getString(Settings.Secure.ANDROID_ID)`](https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID).

More information about Android identifier best practices can be found [here](https://developer.android.com/training/articles/user-data-ids).
"""
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* Java method: `com.example.MyHttpService.serveRequest`
* Java anonymous class method: `com.mycompany.Main$1.myMethod`
* Java lambda method: `com.mycompany.Main$$Lambda/0x0000748ae4149c00.myMethod`
* PHP function: `GuzzleHttp\\Client::transfer
* PHP function: `GuzzleHttp\\Client::transfer`
* Go function: `github.com/my/repo/pkg.foo.func5`
* Elixir: `OpenTelemetry.Ctx.new`
* Erlang: `opentelemetry_ctx:new`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from enum import Enum
from typing import Final

CPYTHON_GC_GENERATION: Final = "cpython.gc.generation"
"""
Value of the garbage collector collection generation.
"""


class CpythonGcGenerationValues(Enum):
GENERATION_0 = 0
"""Generation 0."""
GENERATION_1 = 1
"""Generation 1."""
GENERATION_2 = 2
"""Generation 2."""
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@
The operation name SHOULD NOT be extracted from `db.query.text`,
when the database system supports cross-table queries in non-batch operations.

If spaces can occur in the operation name, multiple consecutive spaces
SHOULD be normalized to a single space.

For batch operations, if the individual operations are known to have the same operation name
then that operation name SHOULD be used prepended by `BATCH `,
otherwise `db.operation.name` SHOULD be `BATCH` or some other database
Expand All @@ -223,6 +226,7 @@
A database operation parameter, with `<key>` being the parameter name, and the attribute value being a string representation of the parameter value.
Note: If a parameter has no name and instead is referenced only by index, then `<key>` SHOULD be the 0-based index.
If `db.query.text` is also captured, then `db.operation.parameter.<key>` SHOULD match up with the parameterized placeholders present in `db.query.text`.
`db.operation.parameter.<key>` SHOULD NOT be captured on batch operations.
"""

DB_QUERY_PARAMETER_TEMPLATE: Final = "db.query.parameter"
Expand Down Expand Up @@ -264,14 +268,24 @@

DB_SQL_TABLE: Final = "db.sql.table"
"""
Deprecated: Replaced by `db.collection.name`.
Deprecated: Replaced by `db.collection.name`, but only if not extracting the value from `db.query.text`.
"""

DB_STATEMENT: Final = "db.statement"
"""
Deprecated: Replaced by `db.query.text`.
"""

DB_STORED_PROCEDURE_NAME: Final = "db.stored_procedure.name"
"""
The name of a stored procedure within the database.
Note: It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.

For batch operations, if the individual operations are known to have the same
stored procedure name then that stored procedure name SHOULD be used.
"""

DB_SYSTEM: Final = "db.system"
"""
Deprecated: Replaced by `db.system.name`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,22 @@
DEVICE_ID: Final = "device.id"
"""
A unique identifier representing the device.
Note: The device identifier MUST only be defined using the values outlined below. This value is not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation ID or a globally unique UUID which is persisted across sessions in your application. More information can be found [here](https://developer.android.com/training/articles/user-data-ids) on best practices and exact implementation details. Caution should be taken when storing personal data or anything which can identify a user. GDPR and data protection laws may apply, ensure you do your own due diligence.
Note: Its value SHOULD be identical for all apps on a device and it SHOULD NOT change if an app is uninstalled and re-installed.
However, it might be resettable by the user for all apps on a device.
Hardware IDs (e.g. vendor-specific serial number, IMEI or MAC address) MAY be used as values.

More information about Android identifier best practices can be found [here](https://developer.android.com/training/articles/user-data-ids).

> [!WARNING]
>
> This attribute may contain sensitive (PII) information. 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.
>
> Due to these reasons, this identifier is not recommended for consumer applications and will likely result in rejection from both Google Play and App Store.
> However, it may be appropriate for specific enterprise scenarios, such as kiosk devices or enterprise-managed devices, with appropriate compliance clearance.
> Any instrumentation providing this identifier MUST implement it as an opt-in feature.
>
> See [`app.installation.id`](/docs/attributes-registry/app.md#app-installation-id) for a more privacy-preserving alternative.
"""

DEVICE_MANUFACTURER: Final = "device.manufacturer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@

from deprecated import deprecated

ERROR_MESSAGE: Final = "error.message"
"""
A message providing more detail about an error in human-readable form.
Note: `error.message` should provide additional context and detail about an error.
It is NOT RECOMMENDED to duplicate the value of `error.type` in `error.message`.
It is also NOT RECOMMENDED to duplicate the value of `exception.message` in `error.message`.

`error.message` is NOT RECOMMENDED for metrics or spans due to its unbounded cardinality and overlap with span status.
"""

ERROR_TYPE: Final = "error.type"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.error_attributes.ERROR_TYPE`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from enum import Enum
from typing import Final

from deprecated import deprecated

FEATURE_FLAG_CONTEXT_ID: Final = "feature_flag.context.id"
"""
The unique identifier for the flag evaluation context. For example, the targeting key.
Expand All @@ -29,7 +31,7 @@

FEATURE_FLAG_EVALUATION_REASON: Final = "feature_flag.evaluation.reason"
"""
The reason code which shows how a feature flag value was determined.
Deprecated: Replaced by `feature_flag.result.reason`.
"""

FEATURE_FLAG_KEY: Final = "feature_flag.key"
Expand All @@ -42,12 +44,12 @@
Identifies the feature flag provider.
"""

FEATURE_FLAG_SET_ID: Final = "feature_flag.set.id"
FEATURE_FLAG_RESULT_REASON: Final = "feature_flag.result.reason"
"""
The identifier of the [flag set](https://openfeature.dev/specification/glossary/#flag-set) to which the feature flag belongs.
The reason code which shows how a feature flag value was determined.
"""

FEATURE_FLAG_VARIANT: Final = "feature_flag.variant"
FEATURE_FLAG_RESULT_VARIANT: Final = "feature_flag.result.variant"
"""
A semantic identifier for an evaluated flag value.
Note: A semantic identifier, commonly referred to as a variant, provides a means
Expand All @@ -56,12 +58,25 @@
For example, the variant `red` maybe be used for the value `#c05543`.
"""

FEATURE_FLAG_SET_ID: Final = "feature_flag.set.id"
"""
The identifier of the [flag set](https://openfeature.dev/specification/glossary/#flag-set) to which the feature flag belongs.
"""

FEATURE_FLAG_VARIANT: Final = "feature_flag.variant"
"""
Deprecated: Replaced by `feature_flag.result.variant`.
"""

FEATURE_FLAG_VERSION: Final = "feature_flag.version"
"""
The version of the ruleset used during the evaluation. This may be any stable value which uniquely identifies the ruleset.
"""


@deprecated(
reason="The attribute feature_flag.evaluation.reason is deprecated - Replaced by `feature_flag.result.reason`"
) # type: ignore
class FeatureFlagEvaluationReasonValues(Enum):
STATIC = "static"
"""The resolved value is static (no dynamic evaluation)."""
Expand All @@ -81,3 +96,24 @@ class FeatureFlagEvaluationReasonValues(Enum):
"""The resolved value is non-authoritative or possibly out of date."""
ERROR = "error"
"""The resolved value was the result of an error."""


class FeatureFlagResultReasonValues(Enum):
STATIC = "static"
"""The resolved value is static (no dynamic evaluation)."""
DEFAULT = "default"
"""The resolved value fell back to a pre-configured value (no dynamic evaluation occurred or dynamic evaluation yielded no result)."""
TARGETING_MATCH = "targeting_match"
"""The resolved value was the result of a dynamic evaluation, such as a rule or specific user-targeting."""
SPLIT = "split"
"""The resolved value was the result of pseudorandom assignment."""
CACHED = "cached"
"""The resolved value was retrieved from cache."""
DISABLED = "disabled"
"""The resolved value was the result of the flag being disabled in the management system."""
UNKNOWN = "unknown"
"""The reason for the resolved value could not be determined."""
STALE = "stale"
"""The resolved value is non-authoritative or possibly out of date."""
ERROR = "error"
"""The resolved value was the result of an error."""
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,66 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from enum import Enum
from typing import Final

GCP_APPHUB_APPLICATION_CONTAINER: Final = "gcp.apphub.application.container"
"""
The container within GCP where the AppHub application is defined.
"""

GCP_APPHUB_APPLICATION_ID: Final = "gcp.apphub.application.id"
"""
The name of the application as configured in AppHub.
"""

GCP_APPHUB_APPLICATION_LOCATION: Final = "gcp.apphub.application.location"
"""
The GCP zone or region where the application is defined.
"""

GCP_APPHUB_SERVICE_CRITICALITY_TYPE: Final = (
"gcp.apphub.service.criticality_type"
)
"""
Criticality of a service indicates its importance to the business.
Note: [See AppHub type enum](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type).
"""

GCP_APPHUB_SERVICE_ENVIRONMENT_TYPE: Final = (
"gcp.apphub.service.environment_type"
)
"""
Environment of a service is the stage of a software lifecycle.
Note: [See AppHub environment type](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1).
"""

GCP_APPHUB_SERVICE_ID: Final = "gcp.apphub.service.id"
"""
The name of the service as configured in AppHub.
"""

GCP_APPHUB_WORKLOAD_CRITICALITY_TYPE: Final = (
"gcp.apphub.workload.criticality_type"
)
"""
Criticality of a workload indicates its importance to the business.
Note: [See AppHub type enum](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type).
"""

GCP_APPHUB_WORKLOAD_ENVIRONMENT_TYPE: Final = (
"gcp.apphub.workload.environment_type"
)
"""
Environment of a workload is the stage of a software lifecycle.
Note: [See AppHub environment type](https://cloud.google.com/app-hub/docs/reference/rest/v1/Attributes#type_1).
"""

GCP_APPHUB_WORKLOAD_ID: Final = "gcp.apphub.workload.id"
"""
The name of the workload as configured in AppHub.
"""

GCP_CLIENT_SERVICE: Final = "gcp.client.service"
"""
Identifies the Google Cloud service for which the official client library is intended.
Expand All @@ -39,3 +97,47 @@
"""
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).
"""


class GcpApphubServiceCriticalityTypeValues(Enum):
MISSION_CRITICAL = "MISSION_CRITICAL"
"""Mission critical service."""
HIGH = "HIGH"
"""High impact."""
MEDIUM = "MEDIUM"
"""Medium impact."""
LOW = "LOW"
"""Low impact."""


class GcpApphubServiceEnvironmentTypeValues(Enum):
PRODUCTION = "PRODUCTION"
"""Production environment."""
STAGING = "STAGING"
"""Staging environment."""
TEST = "TEST"
"""Test environment."""
DEVELOPMENT = "DEVELOPMENT"
"""Development environment."""


class GcpApphubWorkloadCriticalityTypeValues(Enum):
MISSION_CRITICAL = "MISSION_CRITICAL"
"""Mission critical service."""
HIGH = "HIGH"
"""High impact."""
MEDIUM = "MEDIUM"
"""Medium impact."""
LOW = "LOW"
"""Low impact."""


class GcpApphubWorkloadEnvironmentTypeValues(Enum):
PRODUCTION = "PRODUCTION"
"""Production environment."""
STAGING = "STAGING"
"""Staging environment."""
TEST = "TEST"
"""Test environment."""
DEVELOPMENT = "DEVELOPMENT"
"""Development environment."""
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,22 @@ class OtelComponentTypeValues(Enum):
"""The builtin SDK Batching Span Processor."""
SIMPLE_SPAN_PROCESSOR = "simple_span_processor"
"""The builtin SDK Simple Span Processor."""
BATCHING_LOG_PROCESSOR = "batching_log_processor"
"""The builtin SDK Batching LogRecord Processor."""
SIMPLE_LOG_PROCESSOR = "simple_log_processor"
"""The builtin SDK Simple LogRecord Processor."""
OTLP_GRPC_SPAN_EXPORTER = "otlp_grpc_span_exporter"
"""OTLP span exporter over gRPC with protobuf serialization."""
OTLP_HTTP_SPAN_EXPORTER = "otlp_http_span_exporter"
"""OTLP span exporter over HTTP with protobuf serialization."""
OTLP_HTTP_JSON_SPAN_EXPORTER = "otlp_http_json_span_exporter"
"""OTLP span exporter over HTTP with JSON serialization."""
OTLP_GRPC_LOG_EXPORTER = "otlp_grpc_log_exporter"
"""OTLP LogRecord exporter over gRPC with protobuf serialization."""
OTLP_HTTP_LOG_EXPORTER = "otlp_http_log_exporter"
"""OTLP LogRecord exporter over HTTP with protobuf serialization."""
OTLP_HTTP_JSON_LOG_EXPORTER = "otlp_http_json_log_exporter"
"""OTLP LogRecord exporter over HTTP with JSON serialization."""


class OtelSpanSamplingResultValues(Enum):
Expand Down
Loading