chore: 添加虚拟环境到仓库

- 添加 backend_service/venv 虚拟环境
- 包含所有Python依赖包
- 注意:虚拟环境约393MB,包含12655个文件
This commit is contained in:
2025-12-03 10:19:25 +08:00
parent a6c2027caa
commit c4f851d387
12655 changed files with 3009376 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
# 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_BUILD_ID: Final = "app.build_id"
"""
Unique identifier for a particular build or compilation of the application.
"""
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 in the [Android user data IDs guide](https://developer.android.com/training/articles/user-data-ids).
"""
APP_JANK_FRAME_COUNT: Final = "app.jank.frame_count"
"""
A number of frame renders that experienced jank.
Note: Depending on platform limitations, the value provided MAY be approximation.
"""
APP_JANK_PERIOD: Final = "app.jank.period"
"""
The time period, in seconds, for which this jank is being reported.
"""
APP_JANK_THRESHOLD: Final = "app.jank.threshold"
"""
The minimum rendering threshold for this jank, in seconds.
"""
APP_SCREEN_COORDINATE_X: Final = "app.screen.coordinate.x"
"""
The x (horizontal) coordinate of a screen coordinate, in screen pixels.
"""
APP_SCREEN_COORDINATE_Y: Final = "app.screen.coordinate.y"
"""
The y (vertical) component of a screen coordinate, in screen pixels.
"""
APP_WIDGET_ID: Final = "app.widget.id"
"""
An identifier that uniquely differentiates this widget from other widgets in the same application.
Note: A widget is an application component, typically an on-screen visual GUI element.
"""
APP_WIDGET_NAME: Final = "app.widget.name"
"""
The name of an application widget.
Note: A widget is an application component, typically an on-screen visual GUI element.
"""

View File

@@ -0,0 +1,62 @@
# 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
ARTIFACT_ATTESTATION_FILENAME: Final = "artifact.attestation.filename"
"""
The provenance filename of the built attestation which directly relates to the build artifact filename. This filename SHOULD accompany the artifact at publish time. See the [SLSA Relationship](https://slsa.dev/spec/v1.0/distributing-provenance#relationship-between-artifacts-and-attestations) specification for more information.
"""
ARTIFACT_ATTESTATION_HASH: Final = "artifact.attestation.hash"
"""
The full [hash value (see glossary)](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf), of the built attestation. Some envelopes in the [software attestation space](https://github.com/in-toto/attestation/tree/main/spec) also refer to this as the **digest**.
"""
ARTIFACT_ATTESTATION_ID: Final = "artifact.attestation.id"
"""
The id of the build [software attestation](https://slsa.dev/attestation-model).
"""
ARTIFACT_FILENAME: Final = "artifact.filename"
"""
The human readable file name of the artifact, typically generated during build and release processes. Often includes the package name and version in the file name.
Note: This file name can also act as the [Package Name](https://slsa.dev/spec/v1.0/terminology#package-model)
in cases where the package ecosystem maps accordingly.
Additionally, the artifact [can be published](https://slsa.dev/spec/v1.0/terminology#software-supply-chain)
for others, but that is not a guarantee.
"""
ARTIFACT_HASH: Final = "artifact.hash"
"""
The full [hash value (see glossary)](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf), often found in checksum.txt on a release of the artifact and used to verify package integrity.
Note: The specific algorithm used to create the cryptographic hash value is
not defined. In situations where an artifact has multiple
cryptographic hashes, it is up to the implementer to choose which
hash value to set here; this should be the most secure hash algorithm
that is suitable for the situation and consistent with the
corresponding attestation. The implementer can then provide the other
hash values through an additional set of attribute extensions as they
deem necessary.
"""
ARTIFACT_PURL: Final = "artifact.purl"
"""
The [Package URL](https://github.com/package-url/purl-spec) of the [package artifact](https://slsa.dev/spec/v1.0/terminology#package-model) provides a standard way to identify and locate the packaged artifact.
"""
ARTIFACT_VERSION: Final = "artifact.version"
"""
The version of the artifact.
"""

View File

@@ -0,0 +1,345 @@
# 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
AWS_BEDROCK_GUARDRAIL_ID: Final = "aws.bedrock.guardrail.id"
"""
The unique identifier of the AWS Bedrock Guardrail. A [guardrail](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html) helps safeguard and prevent unwanted behavior from model responses or user messages.
"""
AWS_BEDROCK_KNOWLEDGE_BASE_ID: Final = "aws.bedrock.knowledge_base.id"
"""
The unique identifier of the AWS Bedrock Knowledge base. A [knowledge base](https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html) is a bank of information that can be queried by models to generate more relevant responses and augment prompts.
"""
AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS: Final = (
"aws.dynamodb.attribute_definitions"
)
"""
The JSON-serialized value of each item in the `AttributeDefinitions` request field.
"""
AWS_DYNAMODB_ATTRIBUTES_TO_GET: Final = "aws.dynamodb.attributes_to_get"
"""
The value of the `AttributesToGet` request parameter.
"""
AWS_DYNAMODB_CONSISTENT_READ: Final = "aws.dynamodb.consistent_read"
"""
The value of the `ConsistentRead` request parameter.
"""
AWS_DYNAMODB_CONSUMED_CAPACITY: Final = "aws.dynamodb.consumed_capacity"
"""
The JSON-serialized value of each item in the `ConsumedCapacity` response field.
"""
AWS_DYNAMODB_COUNT: Final = "aws.dynamodb.count"
"""
The value of the `Count` response parameter.
"""
AWS_DYNAMODB_EXCLUSIVE_START_TABLE: Final = (
"aws.dynamodb.exclusive_start_table"
)
"""
The value of the `ExclusiveStartTableName` request parameter.
"""
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES: Final = (
"aws.dynamodb.global_secondary_index_updates"
)
"""
The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` request field.
"""
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES: Final = (
"aws.dynamodb.global_secondary_indexes"
)
"""
The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field.
"""
AWS_DYNAMODB_INDEX_NAME: Final = "aws.dynamodb.index_name"
"""
The value of the `IndexName` request parameter.
"""
AWS_DYNAMODB_ITEM_COLLECTION_METRICS: Final = (
"aws.dynamodb.item_collection_metrics"
)
"""
The JSON-serialized value of the `ItemCollectionMetrics` response field.
"""
AWS_DYNAMODB_LIMIT: Final = "aws.dynamodb.limit"
"""
The value of the `Limit` request parameter.
"""
AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES: Final = (
"aws.dynamodb.local_secondary_indexes"
)
"""
The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field.
"""
AWS_DYNAMODB_PROJECTION: Final = "aws.dynamodb.projection"
"""
The value of the `ProjectionExpression` request parameter.
"""
AWS_DYNAMODB_PROVISIONED_READ_CAPACITY: Final = (
"aws.dynamodb.provisioned_read_capacity"
)
"""
The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter.
"""
AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY: Final = (
"aws.dynamodb.provisioned_write_capacity"
)
"""
The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter.
"""
AWS_DYNAMODB_SCAN_FORWARD: Final = "aws.dynamodb.scan_forward"
"""
The value of the `ScanIndexForward` request parameter.
"""
AWS_DYNAMODB_SCANNED_COUNT: Final = "aws.dynamodb.scanned_count"
"""
The value of the `ScannedCount` response parameter.
"""
AWS_DYNAMODB_SEGMENT: Final = "aws.dynamodb.segment"
"""
The value of the `Segment` request parameter.
"""
AWS_DYNAMODB_SELECT: Final = "aws.dynamodb.select"
"""
The value of the `Select` request parameter.
"""
AWS_DYNAMODB_TABLE_COUNT: Final = "aws.dynamodb.table_count"
"""
The number of items in the `TableNames` response parameter.
"""
AWS_DYNAMODB_TABLE_NAMES: Final = "aws.dynamodb.table_names"
"""
The keys in the `RequestItems` object field.
"""
AWS_DYNAMODB_TOTAL_SEGMENTS: Final = "aws.dynamodb.total_segments"
"""
The value of the `TotalSegments` request parameter.
"""
AWS_ECS_CLUSTER_ARN: Final = "aws.ecs.cluster.arn"
"""
The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html).
"""
AWS_ECS_CONTAINER_ARN: Final = "aws.ecs.container.arn"
"""
The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html).
"""
AWS_ECS_LAUNCHTYPE: Final = "aws.ecs.launchtype"
"""
The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task.
"""
AWS_ECS_TASK_ARN: Final = "aws.ecs.task.arn"
"""
The ARN of a running [ECS task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids).
"""
AWS_ECS_TASK_FAMILY: Final = "aws.ecs.task.family"
"""
The family name of the [ECS task definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html) used to create the ECS task.
"""
AWS_ECS_TASK_ID: Final = "aws.ecs.task.id"
"""
The ID of a running ECS task. The ID MUST be extracted from `task.arn`.
"""
AWS_ECS_TASK_REVISION: Final = "aws.ecs.task.revision"
"""
The revision for the task definition used to create the ECS task.
"""
AWS_EKS_CLUSTER_ARN: Final = "aws.eks.cluster.arn"
"""
The ARN of an EKS cluster.
"""
AWS_EXTENDED_REQUEST_ID: Final = "aws.extended_request_id"
"""
The AWS extended request ID as returned in the response header `x-amz-id-2`.
"""
AWS_KINESIS_STREAM_NAME: Final = "aws.kinesis.stream_name"
"""
The name of the AWS Kinesis [stream](https://docs.aws.amazon.com/streams/latest/dev/introduction.html) the request refers to. Corresponds to the `--stream-name` parameter of the Kinesis [describe-stream](https://docs.aws.amazon.com/cli/latest/reference/kinesis/describe-stream.html) operation.
"""
AWS_LAMBDA_INVOKED_ARN: Final = "aws.lambda.invoked_arn"
"""
The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable).
Note: This may be different from `cloud.resource_id` if an alias is involved.
"""
AWS_LAMBDA_RESOURCE_MAPPING_ID: Final = "aws.lambda.resource_mapping.id"
"""
The UUID of the [AWS Lambda EvenSource Mapping](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html). An event source is mapped to a lambda function. It's contents are read by Lambda and used to trigger a function. This isn't available in the lambda execution context or the lambda runtime environtment. This is going to be populated by the AWS SDK for each language when that UUID is present. Some of these operations are Create/Delete/Get/List/Update EventSourceMapping.
"""
AWS_LOG_GROUP_ARNS: Final = "aws.log.group.arns"
"""
The Amazon Resource Name(s) (ARN) of the AWS log group(s).
Note: See the [log group ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format).
"""
AWS_LOG_GROUP_NAMES: Final = "aws.log.group.names"
"""
The name(s) of the AWS log group(s) an application is writing to.
Note: Multiple log groups must be supported for cases like multi-container applications, where a single application has sidecar containers, and each write to their own log group.
"""
AWS_LOG_STREAM_ARNS: Final = "aws.log.stream.arns"
"""
The ARN(s) of the AWS log stream(s).
Note: See the [log stream ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain several log streams, so these ARNs necessarily identify both a log group and a log stream.
"""
AWS_LOG_STREAM_NAMES: Final = "aws.log.stream.names"
"""
The name(s) of the AWS log stream(s) an application is writing to.
"""
AWS_REQUEST_ID: Final = "aws.request_id"
"""
The AWS request ID as returned in the response headers `x-amzn-requestid`, `x-amzn-request-id` or `x-amz-request-id`.
"""
AWS_S3_BUCKET: Final = "aws.s3.bucket"
"""
The S3 bucket name the request refers to. Corresponds to the `--bucket` parameter of the [S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) operations.
Note: The `bucket` attribute is applicable to all S3 operations that reference a bucket, i.e. that require the bucket name as a mandatory parameter.
This applies to almost all S3 operations except `list-buckets`.
"""
AWS_S3_COPY_SOURCE: Final = "aws.s3.copy_source"
"""
The source object (in the form `bucket`/`key`) for the copy operation.
Note: The `copy_source` attribute applies to S3 copy operations and corresponds to the `--copy-source` parameter
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_DELETE: Final = "aws.s3.delete"
"""
The delete request container that specifies the objects to be deleted.
Note: The `delete` attribute is only applicable to the [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) operation.
The `delete` attribute corresponds to the `--delete` parameter of the
[delete-objects operation within the S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html).
"""
AWS_S3_KEY: Final = "aws.s3.key"
"""
The S3 object key the request refers to. Corresponds to the `--key` parameter of the [S3 API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) operations.
Note: The `key` attribute is applicable to all object-related S3 operations, i.e. that require the object key as a mandatory parameter.
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_PART_NUMBER: Final = "aws.s3.part_number"
"""
The part number of the part being uploaded in a multipart-upload operation. This is a positive integer between 1 and 10,000.
Note: The `part_number` attribute is only applicable to the [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html)
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).
"""
AWS_S3_UPLOAD_ID: Final = "aws.s3.upload_id"
"""
Upload ID that identifies the multipart upload.
Note: The `upload_id` attribute applies to S3 multipart-upload operations and corresponds to the `--upload-id` parameter
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_SECRETSMANAGER_SECRET_ARN: Final = "aws.secretsmanager.secret.arn"
"""
The ARN of the Secret stored in the Secrets Mangger.
"""
AWS_SNS_TOPIC_ARN: Final = "aws.sns.topic.arn"
"""
The ARN of the AWS SNS Topic. An Amazon SNS [topic](https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html) is a logical access point that acts as a communication channel.
"""
AWS_SQS_QUEUE_URL: Final = "aws.sqs.queue.url"
"""
The URL of the AWS SQS Queue. It's a unique identifier for a queue in Amazon Simple Queue Service (SQS) and is used to access the queue and perform actions on it.
"""
AWS_STEP_FUNCTIONS_ACTIVITY_ARN: Final = "aws.step_functions.activity.arn"
"""
The ARN of the AWS Step Functions Activity.
"""
AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN: Final = (
"aws.step_functions.state_machine.arn"
)
"""
The ARN of the AWS Step Functions State Machine.
"""
class AwsEcsLaunchtypeValues(Enum):
EC2 = "ec2"
"""Amazon EC2."""
FARGATE = "fargate"
"""Amazon Fargate."""

View File

@@ -0,0 +1,25 @@
# 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
AZ_NAMESPACE: Final = "az.namespace"
"""
Deprecated: Replaced by `azure.resource_provider.namespace`.
"""
AZ_SERVICE_REQUEST_ID: Final = "az.service_request_id"
"""
Deprecated: Replaced by `azure.service.request.id`.
"""

View File

@@ -0,0 +1,88 @@
# 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
AZURE_CLIENT_ID: Final = "azure.client.id"
"""
The unique identifier of the client instance.
"""
AZURE_COSMOSDB_CONNECTION_MODE: Final = "azure.cosmosdb.connection.mode"
"""
Cosmos client connection mode.
"""
AZURE_COSMOSDB_CONSISTENCY_LEVEL: Final = "azure.cosmosdb.consistency.level"
"""
Account or request [consistency level](https://learn.microsoft.com/azure/cosmos-db/consistency-levels).
"""
AZURE_COSMOSDB_OPERATION_CONTACTED_REGIONS: Final = (
"azure.cosmosdb.operation.contacted_regions"
)
"""
List of regions contacted during operation in the order that they were contacted. If there is more than one region listed, it indicates that the operation was performed on multiple regions i.e. cross-regional call.
Note: Region name matches the format of `displayName` in [Azure Location API](https://learn.microsoft.com/rest/api/subscription/subscriptions/list-locations?view=rest-subscription-2021-10-01&tabs=HTTP#location).
"""
AZURE_COSMOSDB_OPERATION_REQUEST_CHARGE: Final = (
"azure.cosmosdb.operation.request_charge"
)
"""
The number of request units consumed by the operation.
"""
AZURE_COSMOSDB_REQUEST_BODY_SIZE: Final = "azure.cosmosdb.request.body.size"
"""
Request payload size in bytes.
"""
AZURE_COSMOSDB_RESPONSE_SUB_STATUS_CODE: Final = (
"azure.cosmosdb.response.sub_status_code"
)
"""
Cosmos DB sub status code.
"""
AZURE_RESOURCE_PROVIDER_NAMESPACE: Final = "azure.resource_provider.namespace"
"""
[Azure Resource Provider Namespace](https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers) as recognized by the client.
"""
AZURE_SERVICE_REQUEST_ID: Final = "azure.service.request.id"
"""
The unique identifier of the service request. It's generated by the Azure service and returned with the response.
"""
class AzureCosmosdbConnectionModeValues(Enum):
GATEWAY = "gateway"
"""Gateway (HTTP) connection."""
DIRECT = "direct"
"""Direct connection."""
class AzureCosmosdbConsistencyLevelValues(Enum):
STRONG = "Strong"
"""Strong."""
BOUNDED_STALENESS = "BoundedStaleness"
"""Bounded Staleness."""
SESSION = "Session"
"""Session."""
EVENTUAL = "Eventual"
"""Eventual."""
CONSISTENT_PREFIX = "ConsistentPrefix"
"""Consistent Prefix."""

View File

@@ -0,0 +1,40 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Final
BROWSER_BRANDS: Final = "browser.brands"
"""
Array of brand name and version separated by a space.
Note: This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.brands`).
"""
BROWSER_LANGUAGE: Final = "browser.language"
"""
Preferred language of the user using the browser.
Note: This value is intended to be taken from the Navigator API `navigator.language`.
"""
BROWSER_MOBILE: Final = "browser.mobile"
"""
A boolean that is true if the browser is running on a mobile device.
Note: This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be left unset.
"""
BROWSER_PLATFORM: Final = "browser.platform"
"""
The platform on which the browser is running.
Note: This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.platform`). If unavailable, the legacy `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD be left unset in order for the values to be consistent.
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.
"""

View File

@@ -0,0 +1,73 @@
# 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
CASSANDRA_CONSISTENCY_LEVEL: Final = "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).
"""
CASSANDRA_COORDINATOR_DC: Final = "cassandra.coordinator.dc"
"""
The data center of the coordinating node for a query.
"""
CASSANDRA_COORDINATOR_ID: Final = "cassandra.coordinator.id"
"""
The ID of the coordinating node for a query.
"""
CASSANDRA_PAGE_SIZE: Final = "cassandra.page.size"
"""
The fetch size used for paging, i.e. how many rows will be returned at once.
"""
CASSANDRA_QUERY_IDEMPOTENT: Final = "cassandra.query.idempotent"
"""
Whether or not the query is idempotent.
"""
CASSANDRA_SPECULATIVE_EXECUTION_COUNT: Final = (
"cassandra.speculative_execution.count"
)
"""
The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively.
"""
class CassandraConsistencyLevelValues(Enum):
ALL = "all"
"""All."""
EACH_QUORUM = "each_quorum"
"""Each Quorum."""
QUORUM = "quorum"
"""Quorum."""
LOCAL_QUORUM = "local_quorum"
"""Local Quorum."""
ONE = "one"
"""One."""
TWO = "two"
"""Two."""
THREE = "three"
"""Three."""
LOCAL_ONE = "local_one"
"""Local One."""
ANY = "any"
"""Any."""
SERIAL = "serial"
"""Serial."""
LOCAL_SERIAL = "local_serial"
"""Local Serial."""

View File

@@ -0,0 +1,162 @@
# 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
CICD_PIPELINE_ACTION_NAME: Final = "cicd.pipeline.action.name"
"""
The kind of action a pipeline run is performing.
"""
CICD_PIPELINE_NAME: Final = "cicd.pipeline.name"
"""
The human readable name of the pipeline within a CI/CD system.
"""
CICD_PIPELINE_RESULT: Final = "cicd.pipeline.result"
"""
The result of a pipeline run.
"""
CICD_PIPELINE_RUN_ID: Final = "cicd.pipeline.run.id"
"""
The unique identifier of a pipeline run within a CI/CD system.
"""
CICD_PIPELINE_RUN_STATE: Final = "cicd.pipeline.run.state"
"""
The pipeline run goes through these states during its lifecycle.
"""
CICD_PIPELINE_RUN_URL_FULL: Final = "cicd.pipeline.run.url.full"
"""
The [URL](https://wikipedia.org/wiki/URL) of the pipeline run, providing the complete address in order to locate and identify the pipeline run.
"""
CICD_PIPELINE_TASK_NAME: Final = "cicd.pipeline.task.name"
"""
The human readable name of a task within a pipeline. Task here most closely aligns with a [computing process](https://wikipedia.org/wiki/Pipeline_(computing)) in a pipeline. Other terms for tasks include commands, steps, and procedures.
"""
CICD_PIPELINE_TASK_RUN_ID: Final = "cicd.pipeline.task.run.id"
"""
The unique identifier of a task run within a pipeline.
"""
CICD_PIPELINE_TASK_RUN_RESULT: Final = "cicd.pipeline.task.run.result"
"""
The result of a task run.
"""
CICD_PIPELINE_TASK_RUN_URL_FULL: Final = "cicd.pipeline.task.run.url.full"
"""
The [URL](https://wikipedia.org/wiki/URL) of the pipeline task run, providing the complete address in order to locate and identify the pipeline task run.
"""
CICD_PIPELINE_TASK_TYPE: Final = "cicd.pipeline.task.type"
"""
The type of the task within a pipeline.
"""
CICD_SYSTEM_COMPONENT: Final = "cicd.system.component"
"""
The name of a component of the CICD system.
"""
CICD_WORKER_ID: Final = "cicd.worker.id"
"""
The unique identifier of a worker within a CICD system.
"""
CICD_WORKER_NAME: Final = "cicd.worker.name"
"""
The name of a worker within a CICD system.
"""
CICD_WORKER_STATE: Final = "cicd.worker.state"
"""
The state of a CICD worker / agent.
"""
CICD_WORKER_URL_FULL: Final = "cicd.worker.url.full"
"""
The [URL](https://wikipedia.org/wiki/URL) of the worker, providing the complete address in order to locate and identify the worker.
"""
class CicdPipelineActionNameValues(Enum):
BUILD = "BUILD"
"""The pipeline run is executing a build."""
RUN = "RUN"
"""The pipeline run is executing."""
SYNC = "SYNC"
"""The pipeline run is executing a sync."""
class CicdPipelineResultValues(Enum):
SUCCESS = "success"
"""The pipeline run finished successfully."""
FAILURE = "failure"
"""The pipeline run did not finish successfully, eg. due to a compile error or a failing test. Such failures are usually detected by non-zero exit codes of the tools executed in the pipeline run."""
ERROR = "error"
"""The pipeline run failed due to an error in the CICD system, eg. due to the worker being killed."""
TIMEOUT = "timeout"
"""A timeout caused the pipeline run to be interrupted."""
CANCELLATION = "cancellation"
"""The pipeline run was cancelled, eg. by a user manually cancelling the pipeline run."""
SKIP = "skip"
"""The pipeline run was skipped, eg. due to a precondition not being met."""
class CicdPipelineRunStateValues(Enum):
PENDING = "pending"
"""The run pending state spans from the event triggering the pipeline run until the execution of the run starts (eg. time spent in a queue, provisioning agents, creating run resources)."""
EXECUTING = "executing"
"""The executing state spans the execution of any run tasks (eg. build, test)."""
FINALIZING = "finalizing"
"""The finalizing state spans from when the run has finished executing (eg. cleanup of run resources)."""
class CicdPipelineTaskRunResultValues(Enum):
SUCCESS = "success"
"""The task run finished successfully."""
FAILURE = "failure"
"""The task run did not finish successfully, eg. due to a compile error or a failing test. Such failures are usually detected by non-zero exit codes of the tools executed in the task run."""
ERROR = "error"
"""The task run failed due to an error in the CICD system, eg. due to the worker being killed."""
TIMEOUT = "timeout"
"""A timeout caused the task run to be interrupted."""
CANCELLATION = "cancellation"
"""The task run was cancelled, eg. by a user manually cancelling the task run."""
SKIP = "skip"
"""The task run was skipped, eg. due to a precondition not being met."""
class CicdPipelineTaskTypeValues(Enum):
BUILD = "build"
"""build."""
TEST = "test"
"""test."""
DEPLOY = "deploy"
"""deploy."""
class CicdWorkerStateValues(Enum):
AVAILABLE = "available"
"""The worker is not performing work for the CICD system. It is available to the CICD system to perform work on (online / idle)."""
BUSY = "busy"
"""The worker is performing work for the CICD system."""
OFFLINE = "offline"
"""The worker is not available to the CICD system (disconnected / down)."""

View File

@@ -0,0 +1,25 @@
# 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
CLIENT_ADDRESS: Final = "client.address"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.client_attributes.CLIENT_ADDRESS`.
"""
CLIENT_PORT: Final = "client.port"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.client_attributes.CLIENT_PORT`.
"""

View File

@@ -0,0 +1,148 @@
# 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
CLOUD_ACCOUNT_ID: Final = "cloud.account.id"
"""
The cloud account ID the resource is assigned to.
"""
CLOUD_AVAILABILITY_ZONE: Final = "cloud.availability_zone"
"""
Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.
Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud.
"""
CLOUD_PLATFORM: Final = "cloud.platform"
"""
The cloud platform in use.
Note: The prefix of the service SHOULD match the one specified in `cloud.provider`.
"""
CLOUD_PROVIDER: Final = "cloud.provider"
"""
Name of the cloud provider.
"""
CLOUD_REGION: Final = "cloud.region"
"""
The geographical region within a cloud provider. When associated with a resource, this attribute specifies the region where the resource operates. When calling services or APIs deployed on a cloud, this attribute identifies the region where the called destination is deployed.
Note: Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091).
"""
CLOUD_RESOURCE_ID: Final = "cloud.resource_id"
"""
Cloud provider-specific native identifier of the monitored cloud resource (e.g. an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) on AWS, a [fully qualified resource ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on Azure, a [full resource name](https://google.aip.dev/122#full-resource-names) 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 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://learn.microsoft.com/rest/api/resources/resources/get-by-id) of the invoked function,
*not* the function app, having the form
`/subscriptions/<SUBSCRIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>`.
This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share
a TracerProvider.
"""
class CloudPlatformValues(Enum):
ALIBABA_CLOUD_ECS = "alibaba_cloud_ecs"
"""Alibaba Cloud Elastic Compute Service."""
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."""
AWS_ECS = "aws_ecs"
"""AWS Elastic Container Service."""
AWS_EKS = "aws_eks"
"""AWS Elastic Kubernetes Service."""
AWS_LAMBDA = "aws_lambda"
"""AWS Lambda."""
AWS_ELASTIC_BEANSTALK = "aws_elastic_beanstalk"
"""AWS Elastic Beanstalk."""
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."""
AZURE_CONTAINER_APPS = "azure.container_apps"
"""Azure Container Apps."""
AZURE_CONTAINER_INSTANCES = "azure.container_instances"
"""Azure Container Instances."""
AZURE_AKS = "azure.aks"
"""Azure Kubernetes Service."""
AZURE_FUNCTIONS = "azure.functions"
"""Azure Functions."""
AZURE_APP_SERVICE = "azure.app_service"
"""Azure App Service."""
AZURE_OPENSHIFT = "azure.openshift"
"""Azure Red Hat OpenShift."""
GCP_BARE_METAL_SOLUTION = "gcp_bare_metal_solution"
"""Google Bare Metal Solution (BMS)."""
GCP_COMPUTE_ENGINE = "gcp_compute_engine"
"""Google Cloud Compute Engine (GCE)."""
GCP_CLOUD_RUN = "gcp_cloud_run"
"""Google Cloud Run."""
GCP_KUBERNETES_ENGINE = "gcp_kubernetes_engine"
"""Google Cloud Kubernetes Engine (GKE)."""
GCP_CLOUD_FUNCTIONS = "gcp_cloud_functions"
"""Google Cloud Functions (GCF)."""
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."""
ORACLE_CLOUD_COMPUTE = "oracle_cloud_compute"
"""Compute on Oracle Cloud Infrastructure (OCI)."""
ORACLE_CLOUD_OKE = "oracle_cloud_oke"
"""Kubernetes Engine (OKE) on Oracle Cloud Infrastructure (OCI)."""
TENCENT_CLOUD_CVM = "tencent_cloud_cvm"
"""Tencent Cloud Cloud Virtual Machine (CVM)."""
TENCENT_CLOUD_EKS = "tencent_cloud_eks"
"""Tencent Cloud Elastic Kubernetes Service (EKS)."""
TENCENT_CLOUD_SCF = "tencent_cloud_scf"
"""Tencent Cloud Serverless Cloud Function (SCF)."""
class CloudProviderValues(Enum):
ALIBABA_CLOUD = "alibaba_cloud"
"""Alibaba Cloud."""
AWS = "aws"
"""Amazon Web Services."""
AZURE = "azure"
"""Microsoft Azure."""
GCP = "gcp"
"""Google Cloud Platform."""
HEROKU = "heroku"
"""Heroku Platform as a Service."""
IBM_CLOUD = "ibm_cloud"
"""IBM Cloud."""
ORACLE_CLOUD = "oracle_cloud"
"""Oracle Cloud Infrastructure (OCI)."""
TENCENT_CLOUD = "tencent_cloud"
"""Tencent Cloud."""

View File

@@ -0,0 +1,40 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Final
CLOUDEVENTS_EVENT_ID: Final = "cloudevents.event_id"
"""
The [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) uniquely identifies the event.
"""
CLOUDEVENTS_EVENT_SOURCE: Final = "cloudevents.event_source"
"""
The [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) identifies the context in which an event happened.
"""
CLOUDEVENTS_EVENT_SPEC_VERSION: Final = "cloudevents.event_spec_version"
"""
The [version of the CloudEvents specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) which the event uses.
"""
CLOUDEVENTS_EVENT_SUBJECT: Final = "cloudevents.event_subject"
"""
The [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) of the event in the context of the event producer (identified by source).
"""
CLOUDEVENTS_EVENT_TYPE: Final = "cloudevents.event_type"
"""
The [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) contains a value describing the type of event related to the originating occurrence.
"""

View File

@@ -0,0 +1,118 @@
# 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
CLOUDFOUNDRY_APP_ID: Final = "cloudfoundry.app.id"
"""
The guid of the application.
Note: Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.application_id`. This is the same value as
reported by `cf app <app-name> --guid`.
"""
CLOUDFOUNDRY_APP_INSTANCE_ID: Final = "cloudfoundry.app.instance.id"
"""
The index of the application instance. 0 when just one instance is active.
Note: CloudFoundry defines the `instance_id` in the [Loggregator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope).
It is used for logs and metrics emitted by CloudFoundry. It is
supposed to contain the application instance index for applications
deployed on the runtime.
Application instrumentation should use the value from environment
variable `CF_INSTANCE_INDEX`.
"""
CLOUDFOUNDRY_APP_NAME: Final = "cloudfoundry.app.name"
"""
The name of the application.
Note: Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.application_name`. This is the same value
as reported by `cf apps`.
"""
CLOUDFOUNDRY_ORG_ID: Final = "cloudfoundry.org.id"
"""
The guid of the CloudFoundry org the application is running in.
Note: Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.org_id`. This is the same value as
reported by `cf org <org-name> --guid`.
"""
CLOUDFOUNDRY_ORG_NAME: Final = "cloudfoundry.org.name"
"""
The name of the CloudFoundry organization the app is running in.
Note: Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.org_name`. This is the same value as
reported by `cf orgs`.
"""
CLOUDFOUNDRY_PROCESS_ID: Final = "cloudfoundry.process.id"
"""
The UID identifying the process.
Note: Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.process_id`. It is supposed to be equal to
`VCAP_APPLICATION.app_id` for applications deployed to the runtime.
For system components, this could be the actual PID.
"""
CLOUDFOUNDRY_PROCESS_TYPE: Final = "cloudfoundry.process.type"
"""
The type of process.
Note: CloudFoundry applications can consist of multiple jobs. Usually the
main process will be of type `web`. There can be additional background
tasks or side-cars with different process types.
"""
CLOUDFOUNDRY_SPACE_ID: Final = "cloudfoundry.space.id"
"""
The guid of the CloudFoundry space the application is running in.
Note: Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.space_id`. This is the same value as
reported by `cf space <space-name> --guid`.
"""
CLOUDFOUNDRY_SPACE_NAME: Final = "cloudfoundry.space.name"
"""
The name of the CloudFoundry space the application is running in.
Note: Application instrumentation should use the value from environment
variable `VCAP_APPLICATION.space_name`. This is the same value as
reported by `cf spaces`.
"""
CLOUDFOUNDRY_SYSTEM_ID: Final = "cloudfoundry.system.id"
"""
A guid or another name describing the event source.
Note: CloudFoundry defines the `source_id` in the [Loggregator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope).
It is used for logs and metrics emitted by CloudFoundry. It is
supposed to contain the component name, e.g. "gorouter", for
CloudFoundry components.
When system components are instrumented, values from the
[Bosh spec](https://bosh.io/docs/jobs/#properties-spec)
should be used. The `system.id` should be set to
`spec.deployment/spec.name`.
"""
CLOUDFOUNDRY_SYSTEM_INSTANCE_ID: Final = "cloudfoundry.system.instance.id"
"""
A guid describing the concrete instance of the event source.
Note: CloudFoundry defines the `instance_id` in the [Loggregator v2 envelope](https://github.com/cloudfoundry/loggregator-api#v2-envelope).
It is used for logs and metrics emitted by CloudFoundry. It is
supposed to contain the vm id for CloudFoundry components.
When system components are instrumented, values from the
[Bosh spec](https://bosh.io/docs/jobs/#properties-spec)
should be used. The `system.instance.id` should be set to `spec.id`.
"""

View File

@@ -0,0 +1,65 @@
# 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
CODE_COLUMN: Final = "code.column"
"""
Deprecated: Replaced by `code.column.number`.
"""
CODE_COLUMN_NUMBER: Final = "code.column.number"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.code_attributes.CODE_COLUMN_NUMBER`.
"""
CODE_FILE_PATH: Final = "code.file.path"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.code_attributes.CODE_FILE_PATH`.
"""
CODE_FILEPATH: Final = "code.filepath"
"""
Deprecated: Replaced by `code.file.path`.
"""
CODE_FUNCTION: Final = "code.function"
"""
Deprecated: Value should be included in `code.function.name` which is expected to be a fully-qualified name.
"""
CODE_FUNCTION_NAME: Final = "code.function.name"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.code_attributes.CODE_FUNCTION_NAME`.
"""
CODE_LINE_NUMBER: Final = "code.line.number"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.code_attributes.CODE_LINE_NUMBER`.
"""
CODE_LINENO: Final = "code.lineno"
"""
Deprecated: Replaced by `code.line.number`.
"""
CODE_NAMESPACE: Final = "code.namespace"
"""
Deprecated: Value should be included in `code.function.name` which is expected to be a fully-qualified name.
"""
CODE_STACKTRACE: Final = "code.stacktrace"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.code_attributes.CODE_STACKTRACE`.
"""

View File

@@ -0,0 +1,128 @@
# 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
from typing_extensions import deprecated
CONTAINER_COMMAND: Final = "container.command"
"""
The command used to run the container (i.e. the command name).
Note: If using embedded credentials or sensitive data, it is recommended to remove them to prevent potential leakage.
"""
CONTAINER_COMMAND_ARGS: Final = "container.command_args"
"""
All the command arguments (including the command/executable itself) run by the container.
"""
CONTAINER_COMMAND_LINE: Final = "container.command_line"
"""
The full command run by the container as a single string representing the full command.
"""
CONTAINER_CPU_STATE: Final = "container.cpu.state"
"""
Deprecated: Replaced by `cpu.mode`.
"""
CONTAINER_CSI_PLUGIN_NAME: Final = "container.csi.plugin.name"
"""
The name of the CSI ([Container Storage Interface](https://github.com/container-storage-interface/spec)) plugin used by the volume.
Note: This can sometimes be referred to as a "driver" in CSI implementations. This should represent the `name` field of the GetPluginInfo RPC.
"""
CONTAINER_CSI_VOLUME_ID: Final = "container.csi.volume.id"
"""
The unique volume ID returned by the CSI ([Container Storage Interface](https://github.com/container-storage-interface/spec)) plugin.
Note: This can sometimes be referred to as a "volume handle" in CSI implementations. This should represent the `Volume.volume_id` field in CSI spec.
"""
CONTAINER_ID: Final = "container.id"
"""
Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/containers/run/#container-identification). The UUID might be abbreviated.
"""
CONTAINER_IMAGE_ID: Final = "container.image.id"
"""
Runtime specific image identifier. Usually a hash algorithm followed by a UUID.
Note: Docker defines a sha256 of the image id; `container.image.id` corresponds to the `Image` field from the Docker container inspect [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) endpoint.
K8s defines a link to the container registry repository with digest `"imageID": "registry.azurecr.io /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`.
The ID is assigned by the container runtime and can vary in different environments. Consider using `oci.manifest.digest` if it is important to identify the same image in different environments/runtimes.
"""
CONTAINER_IMAGE_NAME: Final = "container.image.name"
"""
Name of the image the container was built on.
"""
CONTAINER_IMAGE_REPO_DIGESTS: Final = "container.image.repo_digests"
"""
Repo digests of the container image as provided by the container runtime.
Note: [Docker](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect) and [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) report those under the `RepoDigests` field.
"""
CONTAINER_IMAGE_TAGS: Final = "container.image.tags"
"""
Container image tags. An example can be found in [Docker Image Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). Should be only the `<tag>` section of the full name for example from `registry.example.com/my-org/my-image:<tag>`.
"""
CONTAINER_LABEL_TEMPLATE: Final = "container.label"
"""
Container labels, `<key>` being the label name, the value being the label value.
Note: For example, a docker container label `app` with value `nginx` SHOULD be recorded as the `container.label.app` attribute with value `"nginx"`.
"""
CONTAINER_LABELS_TEMPLATE: Final = "container.labels"
"""
Deprecated: Replaced by `container.label`.
"""
CONTAINER_NAME: Final = "container.name"
"""
Container name used by container runtime.
"""
CONTAINER_RUNTIME: Final = "container.runtime"
"""
Deprecated: Replaced by `container.runtime.name`.
"""
CONTAINER_RUNTIME_DESCRIPTION: Final = "container.runtime.description"
"""
A description about the runtime which could include, for example details about the CRI/API version being used or other customisations.
"""
CONTAINER_RUNTIME_NAME: Final = "container.runtime.name"
"""
The container runtime managing this container.
"""
CONTAINER_RUNTIME_VERSION: Final = "container.runtime.version"
"""
The version of the runtime of this process, as returned by the runtime without modification.
"""
@deprecated(
"The attribute container.cpu.state is deprecated - Replaced by `cpu.mode`"
)
class ContainerCpuStateValues(Enum):
USER = "user"
"""When tasks of the cgroup are in user mode (Linux). When all container processes are in user mode (Windows)."""
SYSTEM = "system"
"""When CPU is used by the system (host OS)."""
KERNEL = "kernel"
"""When tasks of the cgroup are in kernel mode (Linux). When all container processes are in kernel mode (Windows)."""

View File

@@ -0,0 +1,45 @@
# 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
CPU_LOGICAL_NUMBER: Final = "cpu.logical_number"
"""
The logical CPU number [0..n-1].
"""
CPU_MODE: Final = "cpu.mode"
"""
The mode of the CPU.
"""
class CpuModeValues(Enum):
USER = "user"
"""User."""
SYSTEM = "system"
"""System."""
NICE = "nice"
"""Nice."""
IDLE = "idle"
"""Idle."""
IOWAIT = "iowait"
"""IO Wait."""
INTERRUPT = "interrupt"
"""Interrupt."""
STEAL = "steal"
"""Steal."""
KERNEL = "kernel"
"""Kernel."""

View File

@@ -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."""

View File

@@ -0,0 +1,591 @@
# 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
from typing_extensions import deprecated
DB_CASSANDRA_CONSISTENCY_LEVEL: Final = "db.cassandra.consistency_level"
"""
Deprecated: Replaced by `cassandra.consistency.level`.
"""
DB_CASSANDRA_COORDINATOR_DC: Final = "db.cassandra.coordinator.dc"
"""
Deprecated: Replaced by `cassandra.coordinator.dc`.
"""
DB_CASSANDRA_COORDINATOR_ID: Final = "db.cassandra.coordinator.id"
"""
Deprecated: Replaced by `cassandra.coordinator.id`.
"""
DB_CASSANDRA_IDEMPOTENCE: Final = "db.cassandra.idempotence"
"""
Deprecated: Replaced by `cassandra.query.idempotent`.
"""
DB_CASSANDRA_PAGE_SIZE: Final = "db.cassandra.page_size"
"""
Deprecated: Replaced by `cassandra.page.size`.
"""
DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT: Final = (
"db.cassandra.speculative_execution_count"
)
"""
Deprecated: Replaced by `cassandra.speculative_execution.count`.
"""
DB_CASSANDRA_TABLE: Final = "db.cassandra.table"
"""
Deprecated: Replaced by `db.collection.name`.
"""
DB_CLIENT_CONNECTION_POOL_NAME: Final = "db.client.connection.pool.name"
"""
The name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn't provide a name, instrumentation SHOULD use a combination of parameters that would make the name unique, for example, combining attributes `server.address`, `server.port`, and `db.namespace`, formatted as `server.address:server.port/db.namespace`. Instrumentations that generate connection pool name following different patterns SHOULD document it.
"""
DB_CLIENT_CONNECTION_STATE: Final = "db.client.connection.state"
"""
The state of a connection in the pool.
"""
DB_CLIENT_CONNECTIONS_POOL_NAME: Final = "db.client.connections.pool.name"
"""
Deprecated: Replaced by `db.client.connection.pool.name`.
"""
DB_CLIENT_CONNECTIONS_STATE: Final = "db.client.connections.state"
"""
Deprecated: Replaced by `db.client.connection.state`.
"""
DB_COLLECTION_NAME: Final = "db.collection.name"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DB_COLLECTION_NAME`.
"""
DB_CONNECTION_STRING: Final = "db.connection_string"
"""
Deprecated: Replaced by `server.address` and `server.port`.
"""
DB_COSMOSDB_CLIENT_ID: Final = "db.cosmosdb.client_id"
"""
Deprecated: Replaced by `azure.client.id`.
"""
DB_COSMOSDB_CONNECTION_MODE: Final = "db.cosmosdb.connection_mode"
"""
Deprecated: Replaced by `azure.cosmosdb.connection.mode`.
"""
DB_COSMOSDB_CONSISTENCY_LEVEL: Final = "db.cosmosdb.consistency_level"
"""
Deprecated: Replaced by `azure.cosmosdb.consistency.level`.
"""
DB_COSMOSDB_CONTAINER: Final = "db.cosmosdb.container"
"""
Deprecated: Replaced by `db.collection.name`.
"""
DB_COSMOSDB_OPERATION_TYPE: Final = "db.cosmosdb.operation_type"
"""
Deprecated: Removed, no replacement at this time.
"""
DB_COSMOSDB_REGIONS_CONTACTED: Final = "db.cosmosdb.regions_contacted"
"""
Deprecated: Replaced by `azure.cosmosdb.operation.contacted_regions`.
"""
DB_COSMOSDB_REQUEST_CHARGE: Final = "db.cosmosdb.request_charge"
"""
Deprecated: Replaced by `azure.cosmosdb.operation.request_charge`.
"""
DB_COSMOSDB_REQUEST_CONTENT_LENGTH: Final = (
"db.cosmosdb.request_content_length"
)
"""
Deprecated: Replaced by `azure.cosmosdb.request.body.size`.
"""
DB_COSMOSDB_STATUS_CODE: Final = "db.cosmosdb.status_code"
"""
Deprecated: Replaced by `db.response.status_code`.
"""
DB_COSMOSDB_SUB_STATUS_CODE: Final = "db.cosmosdb.sub_status_code"
"""
Deprecated: Replaced by `azure.cosmosdb.response.sub_status_code`.
"""
DB_ELASTICSEARCH_CLUSTER_NAME: Final = "db.elasticsearch.cluster.name"
"""
Deprecated: Replaced by `db.namespace`.
"""
DB_ELASTICSEARCH_NODE_NAME: Final = "db.elasticsearch.node.name"
"""
Deprecated: Replaced by `elasticsearch.node.name`.
"""
DB_ELASTICSEARCH_PATH_PARTS_TEMPLATE: Final = "db.elasticsearch.path_parts"
"""
Deprecated: Replaced by `db.operation.parameter`.
"""
DB_INSTANCE_ID: Final = "db.instance.id"
"""
Deprecated: Removed, no general replacement at this time. For Elasticsearch, use `db.elasticsearch.node.name` instead.
"""
DB_JDBC_DRIVER_CLASSNAME: Final = "db.jdbc.driver_classname"
"""
Deprecated: Removed, no replacement at this time.
"""
DB_MONGODB_COLLECTION: Final = "db.mongodb.collection"
"""
Deprecated: Replaced by `db.collection.name`.
"""
DB_MSSQL_INSTANCE_NAME: Final = "db.mssql.instance_name"
"""
Deprecated: Removed, no replacement at this time.
"""
DB_NAME: Final = "db.name"
"""
Deprecated: Replaced by `db.namespace`.
"""
DB_NAMESPACE: Final = "db.namespace"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DB_NAMESPACE`.
"""
DB_OPERATION: Final = "db.operation"
"""
Deprecated: Replaced by `db.operation.name`.
"""
DB_OPERATION_BATCH_SIZE: Final = "db.operation.batch.size"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DB_OPERATION_BATCH_SIZE`.
"""
DB_OPERATION_NAME: Final = "db.operation.name"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DB_OPERATION_NAME`.
"""
DB_OPERATION_PARAMETER_TEMPLATE: Final = "db.operation.parameter"
"""
A database operation parameter, with `<key>` being the parameter name, and the attribute value being a string representation of the parameter value.
Note: For example, a client-side maximum number of rows to read from the database
MAY be recorded as the `db.operation.parameter.max_rows` attribute.
`db.query.text` parameters SHOULD be captured using `db.query.parameter.<key>`
instead of `db.operation.parameter.<key>`.
"""
DB_QUERY_PARAMETER_TEMPLATE: Final = "db.query.parameter"
"""
A database query parameter, with `<key>` being the parameter name, and the attribute value being a string representation of the parameter value.
Note: If a query parameter has no name and instead is referenced only by index,
then `<key>` SHOULD be the 0-based index.
`db.query.parameter.<key>` SHOULD match
up with the parameterized placeholders present in `db.query.text`.
`db.query.parameter.<key>` SHOULD NOT be captured on batch operations.
Examples:
- For a query `SELECT * FROM users where username = %s` with the parameter `"jdoe"`,
the attribute `db.query.parameter.0` SHOULD be set to `"jdoe"`.
- For a query `"SELECT * FROM users WHERE username = %(username)s;` with parameter
`username = "jdoe"`, the attribute `db.query.parameter.username` SHOULD be set to `"jdoe"`.
"""
DB_QUERY_SUMMARY: Final = "db.query.summary"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DB_QUERY_SUMMARY`.
"""
DB_QUERY_TEXT: Final = "db.query.text"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DB_QUERY_TEXT`.
"""
DB_REDIS_DATABASE_INDEX: Final = "db.redis.database_index"
"""
Deprecated: Replaced by `db.namespace`.
"""
DB_RESPONSE_RETURNED_ROWS: Final = "db.response.returned_rows"
"""
Number of rows returned by the operation.
"""
DB_RESPONSE_STATUS_CODE: Final = "db.response.status_code"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DB_RESPONSE_STATUS_CODE`.
"""
DB_SQL_TABLE: Final = "db.sql.table"
"""
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"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DB_STORED_PROCEDURE_NAME`.
"""
DB_SYSTEM: Final = "db.system"
"""
Deprecated: Replaced by `db.system.name`.
"""
DB_SYSTEM_NAME: Final = "db.system.name"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DB_SYSTEM_NAME`.
"""
DB_USER: Final = "db.user"
"""
Deprecated: Removed, no replacement at this time.
"""
@deprecated(
"The attribute db.cassandra.consistency_level is deprecated - Replaced by `cassandra.consistency.level`"
)
class DbCassandraConsistencyLevelValues(Enum):
ALL = "all"
"""all."""
EACH_QUORUM = "each_quorum"
"""each_quorum."""
QUORUM = "quorum"
"""quorum."""
LOCAL_QUORUM = "local_quorum"
"""local_quorum."""
ONE = "one"
"""one."""
TWO = "two"
"""two."""
THREE = "three"
"""three."""
LOCAL_ONE = "local_one"
"""local_one."""
ANY = "any"
"""any."""
SERIAL = "serial"
"""serial."""
LOCAL_SERIAL = "local_serial"
"""local_serial."""
class DbClientConnectionStateValues(Enum):
IDLE = "idle"
"""idle."""
USED = "used"
"""used."""
@deprecated(
"The attribute db.client.connections.state is deprecated - Replaced by `db.client.connection.state`"
)
class DbClientConnectionsStateValues(Enum):
IDLE = "idle"
"""idle."""
USED = "used"
"""used."""
@deprecated(
"The attribute db.cosmosdb.connection_mode is deprecated - Replaced by `azure.cosmosdb.connection.mode`"
)
class DbCosmosdbConnectionModeValues(Enum):
GATEWAY = "gateway"
"""Gateway (HTTP) connection."""
DIRECT = "direct"
"""Direct connection."""
@deprecated(
"The attribute db.cosmosdb.consistency_level is deprecated - Replaced by `azure.cosmosdb.consistency.level`"
)
class DbCosmosdbConsistencyLevelValues(Enum):
STRONG = "Strong"
"""strong."""
BOUNDED_STALENESS = "BoundedStaleness"
"""bounded_staleness."""
SESSION = "Session"
"""session."""
EVENTUAL = "Eventual"
"""eventual."""
CONSISTENT_PREFIX = "ConsistentPrefix"
"""consistent_prefix."""
@deprecated(
"The attribute db.cosmosdb.operation_type is deprecated - Removed, no replacement at this time"
)
class DbCosmosdbOperationTypeValues(Enum):
BATCH = "batch"
"""batch."""
CREATE = "create"
"""create."""
DELETE = "delete"
"""delete."""
EXECUTE = "execute"
"""execute."""
EXECUTE_JAVASCRIPT = "execute_javascript"
"""execute_javascript."""
INVALID = "invalid"
"""invalid."""
HEAD = "head"
"""head."""
HEAD_FEED = "head_feed"
"""head_feed."""
PATCH = "patch"
"""patch."""
QUERY = "query"
"""query."""
QUERY_PLAN = "query_plan"
"""query_plan."""
READ = "read"
"""read."""
READ_FEED = "read_feed"
"""read_feed."""
REPLACE = "replace"
"""replace."""
UPSERT = "upsert"
"""upsert."""
@deprecated(
"The attribute db.system is deprecated - Replaced by `db.system.name`"
)
class DbSystemValues(Enum):
OTHER_SQL = "other_sql"
"""Some other SQL database. Fallback only. See notes."""
ADABAS = "adabas"
"""Adabas (Adaptable Database System)."""
CACHE = "cache"
"""Deprecated: Replaced by `intersystems_cache`."""
INTERSYSTEMS_CACHE = "intersystems_cache"
"""InterSystems Caché."""
CASSANDRA = "cassandra"
"""Apache Cassandra."""
CLICKHOUSE = "clickhouse"
"""ClickHouse."""
CLOUDSCAPE = "cloudscape"
"""Deprecated: Replaced by `other_sql`."""
COCKROACHDB = "cockroachdb"
"""CockroachDB."""
COLDFUSION = "coldfusion"
"""Deprecated: Obsoleted."""
COSMOSDB = "cosmosdb"
"""Microsoft Azure Cosmos DB."""
COUCHBASE = "couchbase"
"""Couchbase."""
COUCHDB = "couchdb"
"""CouchDB."""
DB2 = "db2"
"""IBM Db2."""
DERBY = "derby"
"""Apache Derby."""
DYNAMODB = "dynamodb"
"""Amazon DynamoDB."""
EDB = "edb"
"""EnterpriseDB."""
ELASTICSEARCH = "elasticsearch"
"""Elasticsearch."""
FILEMAKER = "filemaker"
"""FileMaker."""
FIREBIRD = "firebird"
"""Firebird."""
FIRSTSQL = "firstsql"
"""Deprecated: Replaced by `other_sql`."""
GEODE = "geode"
"""Apache Geode."""
H2 = "h2"
"""H2."""
HANADB = "hanadb"
"""SAP HANA."""
HBASE = "hbase"
"""Apache HBase."""
HIVE = "hive"
"""Apache Hive."""
HSQLDB = "hsqldb"
"""HyperSQL DataBase."""
INFLUXDB = "influxdb"
"""InfluxDB."""
INFORMIX = "informix"
"""Informix."""
INGRES = "ingres"
"""Ingres."""
INSTANTDB = "instantdb"
"""InstantDB."""
INTERBASE = "interbase"
"""InterBase."""
MARIADB = "mariadb"
"""MariaDB."""
MAXDB = "maxdb"
"""SAP MaxDB."""
MEMCACHED = "memcached"
"""Memcached."""
MONGODB = "mongodb"
"""MongoDB."""
MSSQL = "mssql"
"""Microsoft SQL Server."""
MSSQLCOMPACT = "mssqlcompact"
"""Deprecated: Replaced by `other_sql`."""
MYSQL = "mysql"
"""MySQL."""
NEO4J = "neo4j"
"""Neo4j."""
NETEZZA = "netezza"
"""Netezza."""
OPENSEARCH = "opensearch"
"""OpenSearch."""
ORACLE = "oracle"
"""Oracle Database."""
PERVASIVE = "pervasive"
"""Pervasive PSQL."""
POINTBASE = "pointbase"
"""PointBase."""
POSTGRESQL = "postgresql"
"""PostgreSQL."""
PROGRESS = "progress"
"""Progress Database."""
REDIS = "redis"
"""Redis."""
REDSHIFT = "redshift"
"""Amazon Redshift."""
SPANNER = "spanner"
"""Cloud Spanner."""
SQLITE = "sqlite"
"""SQLite."""
SYBASE = "sybase"
"""Sybase."""
TERADATA = "teradata"
"""Teradata."""
TRINO = "trino"
"""Trino."""
VERTICA = "vertica"
"""Vertica."""
@deprecated(
"Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DbSystemNameValues`."
)
class DbSystemNameValues(Enum):
OTHER_SQL = "other_sql"
"""Some other SQL database. Fallback only."""
SOFTWAREAG_ADABAS = "softwareag.adabas"
"""[Adabas (Adaptable Database System)](https://documentation.softwareag.com/?pf=adabas)."""
ACTIAN_INGRES = "actian.ingres"
"""[Actian Ingres](https://www.actian.com/databases/ingres/)."""
AWS_DYNAMODB = "aws.dynamodb"
"""[Amazon DynamoDB](https://aws.amazon.com/pm/dynamodb/)."""
AWS_REDSHIFT = "aws.redshift"
"""[Amazon Redshift](https://aws.amazon.com/redshift/)."""
AZURE_COSMOSDB = "azure.cosmosdb"
"""[Azure Cosmos DB](https://learn.microsoft.com/azure/cosmos-db)."""
INTERSYSTEMS_CACHE = "intersystems.cache"
"""[InterSystems Caché](https://www.intersystems.com/products/cache/)."""
CASSANDRA = "cassandra"
"""[Apache Cassandra](https://cassandra.apache.org/)."""
CLICKHOUSE = "clickhouse"
"""[ClickHouse](https://clickhouse.com/)."""
COCKROACHDB = "cockroachdb"
"""[CockroachDB](https://www.cockroachlabs.com/)."""
COUCHBASE = "couchbase"
"""[Couchbase](https://www.couchbase.com/)."""
COUCHDB = "couchdb"
"""[Apache CouchDB](https://couchdb.apache.org/)."""
DERBY = "derby"
"""[Apache Derby](https://db.apache.org/derby/)."""
ELASTICSEARCH = "elasticsearch"
"""[Elasticsearch](https://www.elastic.co/elasticsearch)."""
FIREBIRDSQL = "firebirdsql"
"""[Firebird](https://www.firebirdsql.org/)."""
GCP_SPANNER = "gcp.spanner"
"""[Google Cloud Spanner](https://cloud.google.com/spanner)."""
GEODE = "geode"
"""[Apache Geode](https://geode.apache.org/)."""
H2DATABASE = "h2database"
"""[H2 Database](https://h2database.com/)."""
HBASE = "hbase"
"""[Apache HBase](https://hbase.apache.org/)."""
HIVE = "hive"
"""[Apache Hive](https://hive.apache.org/)."""
HSQLDB = "hsqldb"
"""[HyperSQL Database](https://hsqldb.org/)."""
IBM_DB2 = "ibm.db2"
"""[IBM Db2](https://www.ibm.com/db2)."""
IBM_INFORMIX = "ibm.informix"
"""[IBM Informix](https://www.ibm.com/products/informix)."""
IBM_NETEZZA = "ibm.netezza"
"""[IBM Netezza](https://www.ibm.com/products/netezza)."""
INFLUXDB = "influxdb"
"""[InfluxDB](https://www.influxdata.com/)."""
INSTANTDB = "instantdb"
"""[Instant](https://www.instantdb.com/)."""
MARIADB = "mariadb"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DbSystemNameValues.MARIADB`."""
MEMCACHED = "memcached"
"""[Memcached](https://memcached.org/)."""
MONGODB = "mongodb"
"""[MongoDB](https://www.mongodb.com/)."""
MICROSOFT_SQL_SERVER = "microsoft.sql_server"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DbSystemNameValues.MICROSOFT_SQL_SERVER`."""
MYSQL = "mysql"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DbSystemNameValues.MYSQL`."""
NEO4J = "neo4j"
"""[Neo4j](https://neo4j.com/)."""
OPENSEARCH = "opensearch"
"""[OpenSearch](https://opensearch.org/)."""
ORACLE_DB = "oracle.db"
"""[Oracle Database](https://www.oracle.com/database/)."""
POSTGRESQL = "postgresql"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.db_attributes.DbSystemNameValues.POSTGRESQL`."""
REDIS = "redis"
"""[Redis](https://redis.io/)."""
SAP_HANA = "sap.hana"
"""[SAP HANA](https://www.sap.com/products/technology-platform/hana/what-is-sap-hana.html)."""
SAP_MAXDB = "sap.maxdb"
"""[SAP MaxDB](https://maxdb.sap.com/)."""
SQLITE = "sqlite"
"""[SQLite](https://www.sqlite.org/)."""
TERADATA = "teradata"
"""[Teradata](https://www.teradata.com/)."""
TRINO = "trino"
"""[Trino](https://trino.io/)."""

View File

@@ -0,0 +1,55 @@
# 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
DEPLOYMENT_ENVIRONMENT: Final = "deployment.environment"
"""
Deprecated: Replaced by `deployment.environment.name`.
"""
DEPLOYMENT_ENVIRONMENT_NAME: Final = "deployment.environment.name"
"""
Name of the [deployment environment](https://wikipedia.org/wiki/Deployment_environment) (aka deployment tier).
Note: `deployment.environment.name` does not affect the uniqueness constraints defined through
the `service.namespace`, `service.name` and `service.instance.id` resource attributes.
This implies that resources carrying the following attribute combinations MUST be
considered to be identifying the same service:
- `service.name=frontend`, `deployment.environment.name=production`
- `service.name=frontend`, `deployment.environment.name=staging`.
"""
DEPLOYMENT_ID: Final = "deployment.id"
"""
The id of the deployment.
"""
DEPLOYMENT_NAME: Final = "deployment.name"
"""
The name of the deployment.
"""
DEPLOYMENT_STATUS: Final = "deployment.status"
"""
The status of the deployment.
"""
class DeploymentStatusValues(Enum):
FAILED = "failed"
"""failed."""
SUCCEEDED = "succeeded"
"""succeeded."""

View File

@@ -0,0 +1,26 @@
# 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
DESTINATION_ADDRESS: Final = "destination.address"
"""
Destination address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
Note: When observed from the source side, and when communicating through an intermediary, `destination.address` SHOULD represent the destination address behind any intermediaries, for example proxies, if it's available.
"""
DESTINATION_PORT: Final = "destination.port"
"""
Destination port number.
"""

View File

@@ -0,0 +1,54 @@
# 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
DEVICE_ID: Final = "device.id"
"""
A unique identifier representing the device.
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 in the [Android user data IDs guide](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/registry/attributes/app.md#app-installation-id) for a more privacy-preserving alternative.
"""
DEVICE_MANUFACTURER: Final = "device.manufacturer"
"""
The name of the device manufacturer.
Note: The Android OS provides this field via [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). iOS apps SHOULD hardcode the value `Apple`.
"""
DEVICE_MODEL_IDENTIFIER: Final = "device.model.identifier"
"""
The model identifier for the device.
Note: It's recommended this value represents a machine-readable version of the model identifier rather than the market or consumer-friendly name of the device.
"""
DEVICE_MODEL_NAME: Final = "device.model.name"
"""
The marketing name for the device model.
Note: It's recommended this value represents a human-readable version of the device model rather than a machine-readable alternative.
"""

View File

@@ -0,0 +1,28 @@
# 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
DISK_IO_DIRECTION: Final = "disk.io.direction"
"""
The disk IO operation direction.
"""
class DiskIoDirectionValues(Enum):
READ = "read"
"""read."""
WRITE = "write"
"""write."""

View File

@@ -0,0 +1,26 @@
# 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
DNS_ANSWERS: Final = "dns.answers"
"""
The list of IPv4 or IPv6 addresses resolved during DNS lookup.
"""
DNS_QUESTION_NAME: Final = "dns.question.name"
"""
The name being queried.
Note: If the name field contains non-printable characters (below 32 or above 126), those characters should be represented as escaped base 10 integers (\\DDD). Back slashes and quotes should be escaped. Tabs, carriage returns, and line feeds should be converted to \\t, \\r, and \\n respectively.
"""

View File

@@ -0,0 +1,20 @@
# 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
ELASTICSEARCH_NODE_NAME: Final = "elasticsearch.node.name"
"""
Represents the human-readable identifier of the node/instance to which a request was routed.
"""

View File

@@ -0,0 +1,43 @@
# 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
ENDUSER_ID: Final = "enduser.id"
"""
Unique identifier of an end user in the system. It maybe a username, email address, or other identifier.
Note: Unique identifier of an end user in the system.
> [!Warning]
> This field contains sensitive (PII) information.
"""
ENDUSER_PSEUDO_ID: Final = "enduser.pseudo.id"
"""
Pseudonymous identifier of an end user. This identifier should be a random value that is not directly linked or associated with the end user's actual identity.
Note: Pseudonymous identifier of an end user.
> [!Warning]
> This field contains sensitive (linkable PII) information.
"""
ENDUSER_ROLE: Final = "enduser.role"
"""
Deprecated: Replaced by `user.roles`.
"""
ENDUSER_SCOPE: Final = "enduser.scope"
"""
Deprecated: Removed, no replacement at this time.
"""

View File

@@ -0,0 +1,41 @@
# 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
from typing_extensions 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`.
"""
@deprecated(
"Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.error_attributes.ErrorTypeValues`."
)
class ErrorTypeValues(Enum):
OTHER = "_OTHER"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.error_attributes.ErrorTypeValues.OTHER`."""

View File

@@ -0,0 +1,20 @@
# 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
EVENT_NAME: Final = "event.name"
"""
Deprecated: Replaced by EventName top-level field on the LogRecord.
"""

View File

@@ -0,0 +1,35 @@
# 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
EXCEPTION_ESCAPED: Final = "exception.escaped"
"""
Deprecated: It's no longer recommended to record exceptions that are handled and do not escape the scope of a span.
"""
EXCEPTION_MESSAGE: Final = "exception.message"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.exception_attributes.EXCEPTION_MESSAGE`.
"""
EXCEPTION_STACKTRACE: Final = "exception.stacktrace"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.exception_attributes.EXCEPTION_STACKTRACE`.
"""
EXCEPTION_TYPE: Final = "exception.type"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.exception_attributes.EXCEPTION_TYPE`.
"""

View File

@@ -0,0 +1,161 @@
# 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
FAAS_COLDSTART: Final = "faas.coldstart"
"""
A boolean that is true if the serverless function is executed for the first time (aka cold-start).
"""
FAAS_CRON: Final = "faas.cron"
"""
A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm).
"""
FAAS_DOCUMENT_COLLECTION: Final = "faas.document.collection"
"""
The name of the source on which the triggering operation was performed. For example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name.
"""
FAAS_DOCUMENT_NAME: Final = "faas.document.name"
"""
The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the name of the file, and in Cosmos DB the table name.
"""
FAAS_DOCUMENT_OPERATION: Final = "faas.document.operation"
"""
Describes the type of the operation that was performed on the data.
"""
FAAS_DOCUMENT_TIME: Final = "faas.document.time"
"""
A string containing the time when the data was accessed in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime).
"""
FAAS_INSTANCE: Final = "faas.instance"
"""
The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version.
Note: - **AWS Lambda:** Use the (full) log stream name.
"""
FAAS_INVOCATION_ID: Final = "faas.invocation_id"
"""
The invocation ID of the current function invocation.
"""
FAAS_INVOKED_NAME: Final = "faas.invoked_name"
"""
The name of the invoked function.
Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function.
"""
FAAS_INVOKED_PROVIDER: Final = "faas.invoked_provider"
"""
The cloud provider of the invoked function.
Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function.
"""
FAAS_INVOKED_REGION: Final = "faas.invoked_region"
"""
The cloud region of the invoked function.
Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function.
"""
FAAS_MAX_MEMORY: Final = "faas.max_memory"
"""
The amount of memory available to the serverless function converted to Bytes.
Note: It's recommended to set this attribute since e.g. too little memory can easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must be multiplied by 1,048,576).
"""
FAAS_NAME: Final = "faas.name"
"""
The name of the single function that this runtime instance executes.
Note: This is the name of the function as configured/deployed on the FaaS
platform and is usually different from the name of the callback
function (which may be stored in the
[`code.namespace`/`code.function.name`](/docs/general/attributes.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 `<FUNCAPP>/<FUNC>`, 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_TIME: Final = "faas.time"
"""
A string containing the function invocation time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime).
"""
FAAS_TRIGGER: Final = "faas.trigger"
"""
Type of the trigger which caused this function invocation.
"""
FAAS_VERSION: Final = "faas.version"
"""
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 (Services):** The [revision](https://cloud.google.com/run/docs/managing/revisions)
(i.e., the function name plus the revision suffix).
- **Google Cloud Functions:** The value of the
[`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically).
- **Azure Functions:** Not applicable. Do not set this attribute.
"""
class FaasDocumentOperationValues(Enum):
INSERT = "insert"
"""When a new object is created."""
EDIT = "edit"
"""When an object is modified."""
DELETE = "delete"
"""When an object is deleted."""
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 FaasTriggerValues(Enum):
DATASOURCE = "datasource"
"""A response to some data source operation such as a database or filesystem read/write."""
HTTP = "http"
"""To provide an answer to an inbound HTTP request."""
PUBSUB = "pubsub"
"""A function is set to be executed when messages are sent to a messaging system."""
TIMER = "timer"
"""A function is scheduled to be executed regularly."""
OTHER = "other"
"""If none of the others apply."""

View File

@@ -0,0 +1,129 @@
# 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
from typing_extensions import deprecated
FEATURE_FLAG_CONTEXT_ID: Final = "feature_flag.context.id"
"""
The unique identifier for the flag evaluation context. For example, the targeting key.
"""
FEATURE_FLAG_EVALUATION_ERROR_MESSAGE: Final = (
"feature_flag.evaluation.error.message"
)
"""
Deprecated: Replaced by `error.message`.
"""
FEATURE_FLAG_EVALUATION_REASON: Final = "feature_flag.evaluation.reason"
"""
Deprecated: Replaced by `feature_flag.result.reason`.
"""
FEATURE_FLAG_KEY: Final = "feature_flag.key"
"""
The lookup key of the feature flag.
"""
FEATURE_FLAG_PROVIDER_NAME: Final = "feature_flag.provider.name"
"""
Identifies the feature flag provider.
"""
FEATURE_FLAG_RESULT_REASON: Final = "feature_flag.result.reason"
"""
The reason code which shows how a feature flag value was determined.
"""
FEATURE_FLAG_RESULT_VALUE: Final = "feature_flag.result.value"
"""
The evaluated value of the feature flag.
Note: With some feature flag providers, feature flag results can be quite large or contain private or sensitive details.
Because of this, `feature_flag.result.variant` is often the preferred attribute if it is available.
It may be desirable to redact or otherwise limit the size and scope of `feature_flag.result.value` if possible.
Because the evaluated flag value is unstructured and may be any type, it is left to the instrumentation author to determine how best to achieve this.
"""
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
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`.
"""
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(
"The attribute feature_flag.evaluation.reason is deprecated - Replaced by `feature_flag.result.reason`"
)
class FeatureFlagEvaluationReasonValues(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."""
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."""

View File

@@ -0,0 +1,113 @@
# 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
FILE_ACCESSED: Final = "file.accessed"
"""
Time when the file was last accessed, in ISO 8601 format.
Note: This attribute might not be supported by some file systems — NFS, FAT32, in embedded OS, etc.
"""
FILE_ATTRIBUTES: Final = "file.attributes"
"""
Array of file attributes.
Note: Attributes names depend on the OS or file system. Heres a non-exhaustive list of values expected for this attribute: `archive`, `compressed`, `directory`, `encrypted`, `execute`, `hidden`, `immutable`, `journaled`, `read`, `readonly`, `symbolic link`, `system`, `temporary`, `write`.
"""
FILE_CHANGED: Final = "file.changed"
"""
Time when the file attributes or metadata was last changed, in ISO 8601 format.
Note: `file.changed` captures the time when any of the file's properties or attributes (including the content) are changed, while `file.modified` captures the timestamp when the file content is modified.
"""
FILE_CREATED: Final = "file.created"
"""
Time when the file was created, in ISO 8601 format.
Note: This attribute might not be supported by some file systems — NFS, FAT32, in embedded OS, etc.
"""
FILE_DIRECTORY: Final = "file.directory"
"""
Directory where the file is located. It should include the drive letter, when appropriate.
"""
FILE_EXTENSION: Final = "file.extension"
"""
File extension, excluding the leading dot.
Note: When the file name has multiple extensions (example.tar.gz), only the last one should be captured ("gz", not "tar.gz").
"""
FILE_FORK_NAME: Final = "file.fork_name"
"""
Name of the fork. A fork is additional data associated with a filesystem object.
Note: On Linux, a resource fork is used to store additional data with a filesystem object. A file always has at least one fork for the data portion, and additional forks may exist.
On NTFS, this is analogous to an Alternate Data Stream (ADS), and the default data stream for a file is just called $DATA. Zone.Identifier is commonly used by Windows to track contents downloaded from the Internet. An ADS is typically of the form: C:\\path\\to\\filename.extension:some_fork_name, and some_fork_name is the value that should populate `fork_name`. `filename.extension` should populate `file.name`, and `extension` should populate `file.extension`. The full path, `file.path`, will include the fork name.
"""
FILE_GROUP_ID: Final = "file.group.id"
"""
Primary Group ID (GID) of the file.
"""
FILE_GROUP_NAME: Final = "file.group.name"
"""
Primary group name of the file.
"""
FILE_INODE: Final = "file.inode"
"""
Inode representing the file in the filesystem.
"""
FILE_MODE: Final = "file.mode"
"""
Mode of the file in octal representation.
"""
FILE_MODIFIED: Final = "file.modified"
"""
Time when the file content was last modified, in ISO 8601 format.
"""
FILE_NAME: Final = "file.name"
"""
Name of the file including the extension, without the directory.
"""
FILE_OWNER_ID: Final = "file.owner.id"
"""
The user ID (UID) or security identifier (SID) of the file owner.
"""
FILE_OWNER_NAME: Final = "file.owner.name"
"""
Username of the file owner.
"""
FILE_PATH: Final = "file.path"
"""
Full path to the file, including the file name. It should include the drive letter, when appropriate.
"""
FILE_SIZE: Final = "file.size"
"""
File size in bytes.
"""
FILE_SYMBOLIC_LINK_TARGET_PATH: Final = "file.symbolic_link.target_path"
"""
Path to the target of a symbolic link.
Note: This attribute is only applicable to symbolic links.
"""

View File

@@ -0,0 +1,143 @@
# 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
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.
Note: Intended to be a stable identifier for Google Cloud client libraries that is uniform across implementation languages. The value should be derived from the canonical service domain for the service; for example, 'foo.googleapis.com' should result in a value of 'foo'.
"""
GCP_CLOUD_RUN_JOB_EXECUTION: Final = "gcp.cloud_run.job.execution"
"""
The name of the Cloud Run [execution](https://cloud.google.com/run/docs/managing/job-executions) being run for the Job, as set by the [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) environment variable.
"""
GCP_CLOUD_RUN_JOB_TASK_INDEX: Final = "gcp.cloud_run.job.task_index"
"""
The index for a task within an execution as provided by the [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) environment variable.
"""
GCP_GCE_INSTANCE_HOSTNAME: Final = "gcp.gce.instance.hostname"
"""
The hostname of a GCE instance. This is the full value of the default or [custom hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm).
"""
GCP_GCE_INSTANCE_NAME: Final = "gcp.gce.instance.name"
"""
The instance name of a GCE instance. This is the value provided by `host.name`, the visible name of the instance in the Cloud Console UI, and the prefix for the default hostname of the instance as defined by the [default internal DNS name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names).
"""
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."""

View File

@@ -0,0 +1,454 @@
# 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
from typing_extensions import deprecated
GEN_AI_AGENT_DESCRIPTION: Final = "gen_ai.agent.description"
"""
Free-form description of the GenAI agent provided by the application.
"""
GEN_AI_AGENT_ID: Final = "gen_ai.agent.id"
"""
The unique identifier of the GenAI agent.
"""
GEN_AI_AGENT_NAME: Final = "gen_ai.agent.name"
"""
Human-readable name of the GenAI agent provided by the application.
"""
GEN_AI_COMPLETION: Final = "gen_ai.completion"
"""
Deprecated: Removed, no replacement at this time.
"""
GEN_AI_CONVERSATION_ID: Final = "gen_ai.conversation.id"
"""
The unique identifier for a conversation (session, thread), used to store and correlate messages within this conversation.
"""
GEN_AI_DATA_SOURCE_ID: Final = "gen_ai.data_source.id"
"""
The data source identifier.
Note: Data sources are used by AI agents and RAG applications to store grounding data. A data source may be an external database, object store, document collection, website, or any other storage system used by the GenAI agent or application. The `gen_ai.data_source.id` SHOULD match the identifier used by the GenAI system rather than a name specific to the external storage, such as a database or object store. Semantic conventions referencing `gen_ai.data_source.id` MAY also leverage additional attributes, such as `db.*`, to further identify and describe the data source.
"""
GEN_AI_INPUT_MESSAGES: Final = "gen_ai.input.messages"
"""
The chat history provided to the model as an input.
Note: Instrumentations MUST follow [Input messages JSON schema](/docs/gen-ai/gen-ai-input-messages.json).
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
Messages MUST be provided in the order they were sent to the model.
Instrumentations MAY provide a way for users to filter or truncate
input messages.
> [!Warning]
> This attribute is likely to contain sensitive information including user/PII data.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
"""
GEN_AI_OPENAI_REQUEST_RESPONSE_FORMAT: Final = (
"gen_ai.openai.request.response_format"
)
"""
Deprecated: Replaced by `gen_ai.output.type`.
"""
GEN_AI_OPENAI_REQUEST_SEED: Final = "gen_ai.openai.request.seed"
"""
Deprecated: Replaced by `gen_ai.request.seed`.
"""
GEN_AI_OPENAI_REQUEST_SERVICE_TIER: Final = (
"gen_ai.openai.request.service_tier"
)
"""
Deprecated: Replaced by `openai.request.service_tier`.
"""
GEN_AI_OPENAI_RESPONSE_SERVICE_TIER: Final = (
"gen_ai.openai.response.service_tier"
)
"""
Deprecated: Replaced by `openai.response.service_tier`.
"""
GEN_AI_OPENAI_RESPONSE_SYSTEM_FINGERPRINT: Final = (
"gen_ai.openai.response.system_fingerprint"
)
"""
Deprecated: Replaced by `openai.response.system_fingerprint`.
"""
GEN_AI_OPERATION_NAME: Final = "gen_ai.operation.name"
"""
The name of the operation being performed.
Note: If one of the predefined values applies, but specific system uses a different name it's RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.
"""
GEN_AI_OUTPUT_MESSAGES: Final = "gen_ai.output.messages"
"""
Messages returned by the model where each message represents a specific model response (choice, candidate).
Note: Instrumentations MUST follow [Output messages JSON schema](/docs/gen-ai/gen-ai-output-messages.json)
Each message represents a single output choice/candidate generated by
the model. Each message corresponds to exactly one generation
(choice/candidate) and vice versa - one choice cannot be split across
multiple messages or one message cannot contain parts from multiple choices.
When the attribute is recorded on events, it MUST be recorded in structured
form. When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
Instrumentations MAY provide a way for users to filter or truncate
output messages.
> [!Warning]
> This attribute is likely to contain sensitive information including user/PII data.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
"""
GEN_AI_OUTPUT_TYPE: Final = "gen_ai.output.type"
"""
Represents the content type requested by the client.
Note: This attribute SHOULD be used when the client requests output of a specific type. The model may return zero or more outputs of this type.
This attribute specifies the output modality and not the actual output format. For example, if an image is requested, the actual output could be a URL pointing to an image file.
Additional output format details may be recorded in the future in the `gen_ai.output.{type}.*` attributes.
"""
GEN_AI_PROMPT: Final = "gen_ai.prompt"
"""
Deprecated: Removed, no replacement at this time.
"""
GEN_AI_PROVIDER_NAME: Final = "gen_ai.provider.name"
"""
The Generative AI provider as identified by the client or server instrumentation.
Note: The attribute SHOULD be set based on the instrumentation's best
knowledge and may differ from the actual model provider.
Multiple providers, including Azure OpenAI, Gemini, and AI hosting platforms
are accessible using the OpenAI REST API and corresponding client libraries,
but may proxy or host models from different providers.
The `gen_ai.request.model`, `gen_ai.response.model`, and `server.address`
attributes may help identify the actual system in use.
The `gen_ai.provider.name` attribute acts as a discriminator that
identifies the GenAI telemetry format flavor specific to that provider
within GenAI semantic conventions.
It SHOULD be set consistently with provider-specific attributes and signals.
For example, GenAI spans, metrics, and events related to AWS Bedrock
should have the `gen_ai.provider.name` set to `aws.bedrock` and include
applicable `aws.bedrock.*` attributes and are not expected to include
`openai.*` attributes.
"""
GEN_AI_REQUEST_CHOICE_COUNT: Final = "gen_ai.request.choice.count"
"""
The target number of candidate completions to return.
"""
GEN_AI_REQUEST_ENCODING_FORMATS: Final = "gen_ai.request.encoding_formats"
"""
The encoding formats requested in an embeddings operation, if specified.
Note: In some GenAI systems the encoding formats are called embedding types. Also, some GenAI systems only accept a single format per request.
"""
GEN_AI_REQUEST_FREQUENCY_PENALTY: Final = "gen_ai.request.frequency_penalty"
"""
The frequency penalty setting for the GenAI request.
"""
GEN_AI_REQUEST_MAX_TOKENS: Final = "gen_ai.request.max_tokens"
"""
The maximum number of tokens the model generates for a request.
"""
GEN_AI_REQUEST_MODEL: Final = "gen_ai.request.model"
"""
The name of the GenAI model a request is being made to.
"""
GEN_AI_REQUEST_PRESENCE_PENALTY: Final = "gen_ai.request.presence_penalty"
"""
The presence penalty setting for the GenAI request.
"""
GEN_AI_REQUEST_SEED: Final = "gen_ai.request.seed"
"""
Requests with same seed value more likely to return same result.
"""
GEN_AI_REQUEST_STOP_SEQUENCES: Final = "gen_ai.request.stop_sequences"
"""
List of sequences that the model will use to stop generating further tokens.
"""
GEN_AI_REQUEST_TEMPERATURE: Final = "gen_ai.request.temperature"
"""
The temperature setting for the GenAI request.
"""
GEN_AI_REQUEST_TOP_K: Final = "gen_ai.request.top_k"
"""
The top_k sampling setting for the GenAI request.
"""
GEN_AI_REQUEST_TOP_P: Final = "gen_ai.request.top_p"
"""
The top_p sampling setting for the GenAI request.
"""
GEN_AI_RESPONSE_FINISH_REASONS: Final = "gen_ai.response.finish_reasons"
"""
Array of reasons the model stopped generating tokens, corresponding to each generation received.
"""
GEN_AI_RESPONSE_ID: Final = "gen_ai.response.id"
"""
The unique identifier for the completion.
"""
GEN_AI_RESPONSE_MODEL: Final = "gen_ai.response.model"
"""
The name of the model that generated the response.
"""
GEN_AI_SYSTEM: Final = "gen_ai.system"
"""
Deprecated: Replaced by `gen_ai.provider.name`.
"""
GEN_AI_SYSTEM_INSTRUCTIONS: Final = "gen_ai.system_instructions"
"""
The system message or instructions provided to the GenAI model separately from the chat history.
Note: This attribute SHOULD be used when the corresponding provider or API
allows to provide system instructions or messages separately from the
chat history.
Instructions that are part of the chat history SHOULD be recorded in
`gen_ai.input.messages` attribute instead.
Instrumentations MUST follow [System instructions JSON schema](/docs/gen-ai/gen-ai-system-instructions.json).
When recorded on spans, it MAY be recorded as a JSON string if structured
format is not supported and SHOULD be recorded in structured form otherwise.
Instrumentations MAY provide a way for users to filter or truncate
system instructions.
> [!Warning]
> This attribute may contain sensitive information.
See [Recording content on attributes](/docs/gen-ai/gen-ai-spans.md#recording-content-on-attributes)
section for more details.
"""
GEN_AI_TOKEN_TYPE: Final = "gen_ai.token.type"
"""
The type of token being counted.
"""
GEN_AI_TOOL_CALL_ID: Final = "gen_ai.tool.call.id"
"""
The tool call identifier.
"""
GEN_AI_TOOL_DESCRIPTION: Final = "gen_ai.tool.description"
"""
The tool description.
"""
GEN_AI_TOOL_NAME: Final = "gen_ai.tool.name"
"""
Name of the tool utilized by the agent.
"""
GEN_AI_TOOL_TYPE: Final = "gen_ai.tool.type"
"""
Type of the tool utilized by the agent.
Note: Extension: A tool executed on the agent-side to directly call external APIs, bridging the gap between the agent and real-world systems.
Agent-side operations involve actions that are performed by the agent on the server or within the agent's controlled environment.
Function: A tool executed on the client-side, where the agent generates parameters for a predefined function, and the client executes the logic.
Client-side operations are actions taken on the user's end or within the client application.
Datastore: A tool used by the agent to access and query structured or unstructured external data for retrieval-augmented tasks or knowledge updates.
"""
GEN_AI_USAGE_COMPLETION_TOKENS: Final = "gen_ai.usage.completion_tokens"
"""
Deprecated: Replaced by `gen_ai.usage.output_tokens`.
"""
GEN_AI_USAGE_INPUT_TOKENS: Final = "gen_ai.usage.input_tokens"
"""
The number of tokens used in the GenAI input (prompt).
"""
GEN_AI_USAGE_OUTPUT_TOKENS: Final = "gen_ai.usage.output_tokens"
"""
The number of tokens used in the GenAI response (completion).
"""
GEN_AI_USAGE_PROMPT_TOKENS: Final = "gen_ai.usage.prompt_tokens"
"""
Deprecated: Replaced by `gen_ai.usage.input_tokens`.
"""
@deprecated(
"The attribute gen_ai.openai.request.response_format is deprecated - Replaced by `gen_ai.output.type`"
)
class GenAiOpenaiRequestResponseFormatValues(Enum):
TEXT = "text"
"""Text response format."""
JSON_OBJECT = "json_object"
"""JSON object response format."""
JSON_SCHEMA = "json_schema"
"""JSON schema response format."""
@deprecated(
"The attribute gen_ai.openai.request.service_tier is deprecated - Replaced by `openai.request.service_tier`"
)
class GenAiOpenaiRequestServiceTierValues(Enum):
AUTO = "auto"
"""The system will utilize scale tier credits until they are exhausted."""
DEFAULT = "default"
"""The system will utilize the default scale tier."""
class GenAiOperationNameValues(Enum):
CHAT = "chat"
"""Chat completion operation such as [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat)."""
GENERATE_CONTENT = "generate_content"
"""Multimodal content generation operation such as [Gemini Generate Content](https://ai.google.dev/api/generate-content)."""
TEXT_COMPLETION = "text_completion"
"""Text completions operation such as [OpenAI Completions API (Legacy)](https://platform.openai.com/docs/api-reference/completions)."""
EMBEDDINGS = "embeddings"
"""Embeddings operation such as [OpenAI Create embeddings API](https://platform.openai.com/docs/api-reference/embeddings/create)."""
CREATE_AGENT = "create_agent"
"""Create GenAI agent."""
INVOKE_AGENT = "invoke_agent"
"""Invoke GenAI agent."""
EXECUTE_TOOL = "execute_tool"
"""Execute a tool."""
class GenAiOutputTypeValues(Enum):
TEXT = "text"
"""Plain text."""
JSON = "json"
"""JSON object with known or unknown schema."""
IMAGE = "image"
"""Image."""
SPEECH = "speech"
"""Speech."""
class GenAiProviderNameValues(Enum):
OPENAI = "openai"
"""[OpenAI](https://openai.com/)."""
GCP_GEN_AI = "gcp.gen_ai"
"""Any Google generative AI endpoint."""
GCP_VERTEX_AI = "gcp.vertex_ai"
"""[Vertex AI](https://cloud.google.com/vertex-ai)."""
GCP_GEMINI = "gcp.gemini"
"""[Gemini](https://cloud.google.com/products/gemini)."""
ANTHROPIC = "anthropic"
"""[Anthropic](https://www.anthropic.com/)."""
COHERE = "cohere"
"""[Cohere](https://cohere.com/)."""
AZURE_AI_INFERENCE = "azure.ai.inference"
"""Azure AI Inference."""
AZURE_AI_OPENAI = "azure.ai.openai"
"""[Azure OpenAI](https://azure.microsoft.com/products/ai-services/openai-service/)."""
IBM_WATSONX_AI = "ibm.watsonx.ai"
"""[IBM Watsonx AI](https://www.ibm.com/products/watsonx-ai)."""
AWS_BEDROCK = "aws.bedrock"
"""[AWS Bedrock](https://aws.amazon.com/bedrock)."""
PERPLEXITY = "perplexity"
"""[Perplexity](https://www.perplexity.ai/)."""
X_AI = "x_ai"
"""[xAI](https://x.ai/)."""
DEEPSEEK = "deepseek"
"""[DeepSeek](https://www.deepseek.com/)."""
GROQ = "groq"
"""[Groq](https://groq.com/)."""
MISTRAL_AI = "mistral_ai"
"""[Mistral AI](https://mistral.ai/)."""
@deprecated(
"The attribute gen_ai.system is deprecated - Replaced by `gen_ai.provider.name`"
)
class GenAiSystemValues(Enum):
OPENAI = "openai"
"""OpenAI."""
GCP_GEN_AI = "gcp.gen_ai"
"""Any Google generative AI endpoint."""
GCP_VERTEX_AI = "gcp.vertex_ai"
"""Vertex AI."""
GCP_GEMINI = "gcp.gemini"
"""Gemini."""
VERTEX_AI = "vertex_ai"
"""Deprecated: Replaced by `gcp.vertex_ai`."""
GEMINI = "gemini"
"""Deprecated: Replaced by `gcp.gemini`."""
ANTHROPIC = "anthropic"
"""Anthropic."""
COHERE = "cohere"
"""Cohere."""
AZ_AI_INFERENCE = "az.ai.inference"
"""Azure AI Inference."""
AZ_AI_OPENAI = "az.ai.openai"
"""Azure OpenAI."""
AZURE_AI_INFERENCE = "azure.ai.inference"
"""Azure AI Inference."""
AZURE_AI_OPENAI = "azure.ai.openai"
"""Azure OpenAI."""
IBM_WATSONX_AI = "ibm.watsonx.ai"
"""IBM Watsonx AI."""
AWS_BEDROCK = "aws.bedrock"
"""AWS Bedrock."""
PERPLEXITY = "perplexity"
"""Perplexity."""
XAI = "xai"
"""Deprecated: Replaced by `x_ai`."""
DEEPSEEK = "deepseek"
"""DeepSeek."""
GROQ = "groq"
"""Groq."""
MISTRAL_AI = "mistral_ai"
"""Mistral AI."""
class GenAiTokenTypeValues(Enum):
INPUT = "input"
"""Input tokens (prompt, input, etc.)."""
COMPLETION = "output"
"""Deprecated: Replaced by `output`."""
OUTPUT = "output"
"""Output tokens (completion, response, etc.)."""

View File

@@ -0,0 +1,68 @@
# 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
GEO_CONTINENT_CODE: Final = "geo.continent.code"
"""
Two-letter code representing continents name.
"""
GEO_COUNTRY_ISO_CODE: Final = "geo.country.iso_code"
"""
Two-letter ISO Country Code ([ISO 3166-1 alpha2](https://wikipedia.org/wiki/ISO_3166-1#Codes)).
"""
GEO_LOCALITY_NAME: Final = "geo.locality.name"
"""
Locality name. Represents the name of a city, town, village, or similar populated place.
"""
GEO_LOCATION_LAT: Final = "geo.location.lat"
"""
Latitude of the geo location in [WGS84](https://wikipedia.org/wiki/World_Geodetic_System#WGS84).
"""
GEO_LOCATION_LON: Final = "geo.location.lon"
"""
Longitude of the geo location in [WGS84](https://wikipedia.org/wiki/World_Geodetic_System#WGS84).
"""
GEO_POSTAL_CODE: Final = "geo.postal_code"
"""
Postal code associated with the location. Values appropriate for this field may also be known as a postcode or ZIP code and will vary widely from country to country.
"""
GEO_REGION_ISO_CODE: Final = "geo.region.iso_code"
"""
Region ISO code ([ISO 3166-2](https://wikipedia.org/wiki/ISO_3166-2)).
"""
class GeoContinentCodeValues(Enum):
AF = "AF"
"""Africa."""
AN = "AN"
"""Antarctica."""
AS = "AS"
"""Asia."""
EU = "EU"
"""Europe."""
NA = "NA"
"""North America."""
OC = "OC"
"""Oceania."""
SA = "SA"
"""South America."""

View File

@@ -0,0 +1,41 @@
# 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
GRAPHQL_DOCUMENT: Final = "graphql.document"
"""
The GraphQL document being executed.
Note: The value may be sanitized to exclude sensitive information.
"""
GRAPHQL_OPERATION_NAME: Final = "graphql.operation.name"
"""
The name of the operation being executed.
"""
GRAPHQL_OPERATION_TYPE: Final = "graphql.operation.type"
"""
The type of the operation being executed.
"""
class GraphqlOperationTypeValues(Enum):
QUERY = "query"
"""GraphQL query."""
MUTATION = "mutation"
"""GraphQL mutation."""
SUBSCRIPTION = "subscription"
"""GraphQL subscription."""

View File

@@ -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 typing import Final
HEROKU_APP_ID: Final = "heroku.app.id"
"""
Unique identifier for the application.
"""
HEROKU_RELEASE_COMMIT: Final = "heroku.release.commit"
"""
Commit hash for the current release.
"""
HEROKU_RELEASE_CREATION_TIMESTAMP: Final = "heroku.release.creation_timestamp"
"""
Time and date the release was created.
"""

View File

@@ -0,0 +1,113 @@
# 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
HOST_ARCH: Final = "host.arch"
"""
The CPU architecture the host system is running on.
"""
HOST_CPU_CACHE_L2_SIZE: Final = "host.cpu.cache.l2.size"
"""
The amount of level 2 memory cache available to the processor (in Bytes).
"""
HOST_CPU_FAMILY: Final = "host.cpu.family"
"""
Family or generation of the CPU.
"""
HOST_CPU_MODEL_ID: Final = "host.cpu.model.id"
"""
Model identifier. It provides more granular information about the CPU, distinguishing it from other CPUs within the same family.
"""
HOST_CPU_MODEL_NAME: Final = "host.cpu.model.name"
"""
Model designation of the processor.
"""
HOST_CPU_STEPPING: Final = "host.cpu.stepping"
"""
Stepping or core revisions.
"""
HOST_CPU_VENDOR_ID: Final = "host.cpu.vendor.id"
"""
Processor manufacturer identifier. A maximum 12-character string.
Note: [CPUID](https://wiki.osdev.org/CPUID) command returns the vendor ID string in EBX, EDX and ECX registers. Writing these to memory in this order results in a 12-character string.
"""
HOST_ID: Final = "host.id"
"""
Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the `machine-id`. See the table below for the sources to use to determine the `machine-id` based on operating system.
"""
HOST_IMAGE_ID: Final = "host.image.id"
"""
VM image ID or host OS image ID. For Cloud, this value is from the provider.
"""
HOST_IMAGE_NAME: Final = "host.image.name"
"""
Name of the VM image or OS install the host was instantiated from.
"""
HOST_IMAGE_VERSION: Final = "host.image.version"
"""
The version string of the VM image or host OS as defined in [Version Attributes](/docs/resource/README.md#version-attributes).
"""
HOST_IP: Final = "host.ip"
"""
Available IP addresses of the host, excluding loopback interfaces.
Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 addresses MUST be specified in the [RFC 5952](https://www.rfc-editor.org/rfc/rfc5952.html) format.
"""
HOST_MAC: Final = "host.mac"
"""
Available MAC addresses of the host, excluding loopback interfaces.
Note: MAC Addresses MUST be represented in [IEEE RA hexadecimal form](https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf): as hyphen-separated octets in uppercase hexadecimal form from most to least significant.
"""
HOST_NAME: Final = "host.name"
"""
Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user.
"""
HOST_TYPE: Final = "host.type"
"""
Type of host. For Cloud, this must be the machine type.
"""
class HostArchValues(Enum):
AMD64 = "amd64"
"""AMD64."""
ARM32 = "arm32"
"""ARM32."""
ARM64 = "arm64"
"""ARM64."""
IA64 = "ia64"
"""Itanium."""
PPC32 = "ppc32"
"""32-bit PowerPC."""
PPC64 = "ppc64"
"""64-bit PowerPC."""
S390X = "s390x"
"""IBM z/Architecture."""
X86 = "x86"
"""32-bit x86."""

View File

@@ -0,0 +1,203 @@
# 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
from typing_extensions import deprecated
HTTP_CLIENT_IP: Final = "http.client_ip"
"""
Deprecated: Replaced by `client.address`.
"""
HTTP_CONNECTION_STATE: Final = "http.connection.state"
"""
State of the HTTP connection in the HTTP connection pool.
"""
HTTP_FLAVOR: Final = "http.flavor"
"""
Deprecated: Replaced by `network.protocol.name`.
"""
HTTP_HOST: Final = "http.host"
"""
Deprecated: Replaced by one of `server.address`, `client.address` or `http.request.header.host`, depending on the usage.
"""
HTTP_METHOD: Final = "http.method"
"""
Deprecated: Replaced by `http.request.method`.
"""
HTTP_REQUEST_BODY_SIZE: Final = "http.request.body.size"
"""
The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
"""
HTTP_REQUEST_HEADER_TEMPLATE: Final = "http.request.header"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_REQUEST_HEADER_TEMPLATE`.
"""
HTTP_REQUEST_METHOD: Final = "http.request.method"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_REQUEST_METHOD`.
"""
HTTP_REQUEST_METHOD_ORIGINAL: Final = "http.request.method_original"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_REQUEST_METHOD_ORIGINAL`.
"""
HTTP_REQUEST_RESEND_COUNT: Final = "http.request.resend_count"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_REQUEST_RESEND_COUNT`.
"""
HTTP_REQUEST_SIZE: Final = "http.request.size"
"""
The total size of the request in bytes. This should be the total number of bytes sent over the wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request body if any.
"""
HTTP_REQUEST_CONTENT_LENGTH: Final = "http.request_content_length"
"""
Deprecated: Replaced by `http.request.header.content-length`.
"""
HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED: Final = (
"http.request_content_length_uncompressed"
)
"""
Deprecated: Replaced by `http.request.body.size`.
"""
HTTP_RESPONSE_BODY_SIZE: Final = "http.response.body.size"
"""
The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
"""
HTTP_RESPONSE_HEADER_TEMPLATE: Final = "http.response.header"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_RESPONSE_HEADER_TEMPLATE`.
"""
HTTP_RESPONSE_SIZE: Final = "http.response.size"
"""
The total size of the response in bytes. This should be the total number of bytes sent over the wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and response body and trailers if any.
"""
HTTP_RESPONSE_STATUS_CODE: Final = "http.response.status_code"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_RESPONSE_STATUS_CODE`.
"""
HTTP_RESPONSE_CONTENT_LENGTH: Final = "http.response_content_length"
"""
Deprecated: Replaced by `http.response.header.content-length`.
"""
HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED: Final = (
"http.response_content_length_uncompressed"
)
"""
Deprecated: Replaced by `http.response.body.size`.
"""
HTTP_ROUTE: Final = "http.route"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HTTP_ROUTE`.
"""
HTTP_SCHEME: Final = "http.scheme"
"""
Deprecated: Replaced by `url.scheme`.
"""
HTTP_SERVER_NAME: Final = "http.server_name"
"""
Deprecated: Replaced by `server.address`.
"""
HTTP_STATUS_CODE: Final = "http.status_code"
"""
Deprecated: Replaced by `http.response.status_code`.
"""
HTTP_TARGET: Final = "http.target"
"""
Deprecated: Split to `url.path` and `url.query`.
"""
HTTP_URL: Final = "http.url"
"""
Deprecated: Replaced by `url.full`.
"""
HTTP_USER_AGENT: Final = "http.user_agent"
"""
Deprecated: Replaced by `user_agent.original`.
"""
class HttpConnectionStateValues(Enum):
ACTIVE = "active"
"""active state."""
IDLE = "idle"
"""idle state."""
@deprecated(
"The attribute http.flavor is deprecated - Replaced by `network.protocol.name`"
)
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."""
@deprecated(
"Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues`."
)
class HttpRequestMethodValues(Enum):
CONNECT = "CONNECT"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues.CONNECT`."""
DELETE = "DELETE"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues.DELETE`."""
GET = "GET"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues.GET`."""
HEAD = "HEAD"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues.HEAD`."""
OPTIONS = "OPTIONS"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues.OPTIONS`."""
PATCH = "PATCH"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues.PATCH`."""
POST = "POST"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues.POST`."""
PUT = "PUT"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues.PUT`."""
TRACE = "TRACE"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues.TRACE`."""
OTHER = "_OTHER"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.http_attributes.HttpRequestMethodValues.OTHER`."""

View File

@@ -0,0 +1,254 @@
# 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
HW_BATTERY_CAPACITY: Final = "hw.battery.capacity"
"""
Design capacity in Watts-hours or Amper-hours.
"""
HW_BATTERY_CHEMISTRY: Final = "hw.battery.chemistry"
"""
Battery [chemistry](https://schemas.dmtf.org/wbem/cim-html/2.31.0/CIM_Battery.html), e.g. Lithium-Ion, Nickel-Cadmium, etc.
"""
HW_BATTERY_STATE: Final = "hw.battery.state"
"""
The current state of the battery.
"""
HW_BIOS_VERSION: Final = "hw.bios_version"
"""
BIOS version of the hardware component.
"""
HW_DRIVER_VERSION: Final = "hw.driver_version"
"""
Driver version for the hardware component.
"""
HW_ENCLOSURE_TYPE: Final = "hw.enclosure.type"
"""
Type of the enclosure (useful for modular systems).
"""
HW_FIRMWARE_VERSION: Final = "hw.firmware_version"
"""
Firmware version of the hardware component.
"""
HW_GPU_TASK: Final = "hw.gpu.task"
"""
Type of task the GPU is performing.
"""
HW_ID: Final = "hw.id"
"""
An identifier for the hardware component, unique within the monitored host.
"""
HW_LIMIT_TYPE: Final = "hw.limit_type"
"""
Type of limit for hardware components.
"""
HW_LOGICAL_DISK_RAID_LEVEL: Final = "hw.logical_disk.raid_level"
"""
RAID Level of the logical disk.
"""
HW_LOGICAL_DISK_STATE: Final = "hw.logical_disk.state"
"""
State of the logical disk space usage.
"""
HW_MEMORY_TYPE: Final = "hw.memory.type"
"""
Type of the memory module.
"""
HW_MODEL: Final = "hw.model"
"""
Descriptive model name of the hardware component.
"""
HW_NAME: Final = "hw.name"
"""
An easily-recognizable name for the hardware component.
"""
HW_NETWORK_LOGICAL_ADDRESSES: Final = "hw.network.logical_addresses"
"""
Logical addresses of the adapter (e.g. IP address, or WWPN).
"""
HW_NETWORK_PHYSICAL_ADDRESS: Final = "hw.network.physical_address"
"""
Physical address of the adapter (e.g. MAC address, or WWNN).
"""
HW_PARENT: Final = "hw.parent"
"""
Unique identifier of the parent component (typically the `hw.id` attribute of the enclosure, or disk controller).
"""
HW_PHYSICAL_DISK_SMART_ATTRIBUTE: Final = "hw.physical_disk.smart_attribute"
"""
[S.M.A.R.T.](https://wikipedia.org/wiki/S.M.A.R.T.) (Self-Monitoring, Analysis, and Reporting Technology) attribute of the physical disk.
"""
HW_PHYSICAL_DISK_STATE: Final = "hw.physical_disk.state"
"""
State of the physical disk endurance utilization.
"""
HW_PHYSICAL_DISK_TYPE: Final = "hw.physical_disk.type"
"""
Type of the physical disk.
"""
HW_SENSOR_LOCATION: Final = "hw.sensor_location"
"""
Location of the sensor.
"""
HW_SERIAL_NUMBER: Final = "hw.serial_number"
"""
Serial number of the hardware component.
"""
HW_STATE: Final = "hw.state"
"""
The current state of the component.
"""
HW_TAPE_DRIVE_OPERATION_TYPE: Final = "hw.tape_drive.operation_type"
"""
Type of tape drive operation.
"""
HW_TYPE: Final = "hw.type"
"""
Type of the component.
Note: Describes the category of the hardware component for which `hw.state` is being reported. For example, `hw.type=temperature` along with `hw.state=degraded` would indicate that the temperature of the hardware component has been reported as `degraded`.
"""
HW_VENDOR: Final = "hw.vendor"
"""
Vendor name of the hardware component.
"""
class HwBatteryStateValues(Enum):
CHARGING = "charging"
"""Charging."""
DISCHARGING = "discharging"
"""Discharging."""
class HwGpuTaskValues(Enum):
DECODER = "decoder"
"""Decoder."""
ENCODER = "encoder"
"""Encoder."""
GENERAL = "general"
"""General."""
class HwLimitTypeValues(Enum):
CRITICAL = "critical"
"""Critical."""
DEGRADED = "degraded"
"""Degraded."""
HIGH_CRITICAL = "high.critical"
"""High Critical."""
HIGH_DEGRADED = "high.degraded"
"""High Degraded."""
LOW_CRITICAL = "low.critical"
"""Low Critical."""
LOW_DEGRADED = "low.degraded"
"""Low Degraded."""
MAX = "max"
"""Maximum."""
THROTTLED = "throttled"
"""Throttled."""
TURBO = "turbo"
"""Turbo."""
class HwLogicalDiskStateValues(Enum):
USED = "used"
"""Used."""
FREE = "free"
"""Free."""
class HwPhysicalDiskStateValues(Enum):
REMAINING = "remaining"
"""Remaining."""
class HwStateValues(Enum):
DEGRADED = "degraded"
"""Degraded."""
FAILED = "failed"
"""Failed."""
NEEDS_CLEANING = "needs_cleaning"
"""Needs Cleaning."""
OK = "ok"
"""OK."""
PREDICTED_FAILURE = "predicted_failure"
"""Predicted Failure."""
class HwTapeDriveOperationTypeValues(Enum):
MOUNT = "mount"
"""Mount."""
UNMOUNT = "unmount"
"""Unmount."""
CLEAN = "clean"
"""Clean."""
class HwTypeValues(Enum):
BATTERY = "battery"
"""Battery."""
CPU = "cpu"
"""CPU."""
DISK_CONTROLLER = "disk_controller"
"""Disk controller."""
ENCLOSURE = "enclosure"
"""Enclosure."""
FAN = "fan"
"""Fan."""
GPU = "gpu"
"""GPU."""
LOGICAL_DISK = "logical_disk"
"""Logical disk."""
MEMORY = "memory"
"""Memory."""
NETWORK = "network"
"""Network."""
PHYSICAL_DISK = "physical_disk"
"""Physical disk."""
POWER_SUPPLY = "power_supply"
"""Power supply."""
TAPE_DRIVE = "tape_drive"
"""Tape drive."""
TEMPERATURE = "temperature"
"""Temperature."""
VOLTAGE = "voltage"
"""Voltage."""

View File

@@ -0,0 +1,551 @@
# 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
K8S_CLUSTER_NAME: Final = "k8s.cluster.name"
"""
The name of the cluster.
"""
K8S_CLUSTER_UID: Final = "k8s.cluster.uid"
"""
A pseudo-ID for the cluster, set to the UID of the `kube-system` namespace.
Note: K8s doesn't have support for obtaining a cluster ID. If this is ever
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_CONTAINER_NAME: Final = "k8s.container.name"
"""
The name of the Container from Pod specification, must be unique within a Pod. Container runtime usually uses different globally unique name (`container.name`).
"""
K8S_CONTAINER_RESTART_COUNT: Final = "k8s.container.restart_count"
"""
Number of times the container was restarted. This attribute can be used to identify a particular container (running or stopped) within a container spec.
"""
K8S_CONTAINER_STATUS_LAST_TERMINATED_REASON: Final = (
"k8s.container.status.last_terminated_reason"
)
"""
Last terminated reason of the Container.
"""
K8S_CONTAINER_STATUS_REASON: Final = "k8s.container.status.reason"
"""
The reason for the container state. Corresponds to the `reason` field of the: [K8s ContainerStateWaiting](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatewaiting-v1-core) or [K8s ContainerStateTerminated](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstateterminated-v1-core).
"""
K8S_CONTAINER_STATUS_STATE: Final = "k8s.container.status.state"
"""
The state of the container. [K8s ContainerState](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstate-v1-core).
"""
K8S_CRONJOB_ANNOTATION_TEMPLATE: Final = "k8s.cronjob.annotation"
"""
The cronjob annotation placed on the CronJob, the `<key>` being the annotation name, the value being the annotation value.
Note: Examples:
- An annotation `retries` with value `4` SHOULD be recorded as the
`k8s.cronjob.annotation.retries` attribute with value `"4"`.
- An annotation `data` with empty string value SHOULD be recorded as
the `k8s.cronjob.annotation.data` attribute with value `""`.
"""
K8S_CRONJOB_LABEL_TEMPLATE: Final = "k8s.cronjob.label"
"""
The label placed on the CronJob, the `<key>` being the label name, the value being the label value.
Note: Examples:
- A label `type` with value `weekly` SHOULD be recorded as the
`k8s.cronjob.label.type` attribute with value `"weekly"`.
- A label `automated` with empty string value SHOULD be recorded as
the `k8s.cronjob.label.automated` attribute with value `""`.
"""
K8S_CRONJOB_NAME: Final = "k8s.cronjob.name"
"""
The name of the CronJob.
"""
K8S_CRONJOB_UID: Final = "k8s.cronjob.uid"
"""
The UID of the CronJob.
"""
K8S_DAEMONSET_ANNOTATION_TEMPLATE: Final = "k8s.daemonset.annotation"
"""
The annotation placed on the DaemonSet, the `<key>` being the annotation name, the value being the annotation value, even if the value is empty.
Note: Examples:
- A label `replicas` with value `1` SHOULD be recorded
as the `k8s.daemonset.annotation.replicas` attribute with value `"1"`.
- A label `data` with empty string value SHOULD be recorded as
the `k8s.daemonset.annotation.data` attribute with value `""`.
"""
K8S_DAEMONSET_LABEL_TEMPLATE: Final = "k8s.daemonset.label"
"""
The label placed on the DaemonSet, the `<key>` being the label name, the value being the label value, even if the value is empty.
Note: Examples:
- A label `app` with value `guestbook` SHOULD be recorded
as the `k8s.daemonset.label.app` attribute with value `"guestbook"`.
- A label `data` with empty string value SHOULD be recorded as
the `k8s.daemonset.label.injected` attribute with value `""`.
"""
K8S_DAEMONSET_NAME: Final = "k8s.daemonset.name"
"""
The name of the DaemonSet.
"""
K8S_DAEMONSET_UID: Final = "k8s.daemonset.uid"
"""
The UID of the DaemonSet.
"""
K8S_DEPLOYMENT_ANNOTATION_TEMPLATE: Final = "k8s.deployment.annotation"
"""
The annotation placed on the Deployment, the `<key>` being the annotation name, the value being the annotation value, even if the value is empty.
Note: Examples:
- A label `replicas` with value `1` SHOULD be recorded
as the `k8s.deployment.annotation.replicas` attribute with value `"1"`.
- A label `data` with empty string value SHOULD be recorded as
the `k8s.deployment.annotation.data` attribute with value `""`.
"""
K8S_DEPLOYMENT_LABEL_TEMPLATE: Final = "k8s.deployment.label"
"""
The label placed on the Deployment, the `<key>` being the label name, the value being the label value, even if the value is empty.
Note: Examples:
- A label `replicas` with value `0` SHOULD be recorded
as the `k8s.deployment.label.app` attribute with value `"guestbook"`.
- A label `injected` with empty string value SHOULD be recorded as
the `k8s.deployment.label.injected` attribute with value `""`.
"""
K8S_DEPLOYMENT_NAME: Final = "k8s.deployment.name"
"""
The name of the Deployment.
"""
K8S_DEPLOYMENT_UID: Final = "k8s.deployment.uid"
"""
The UID of the Deployment.
"""
K8S_HPA_METRIC_TYPE: Final = "k8s.hpa.metric.type"
"""
The type of metric source for the horizontal pod autoscaler.
Note: This attribute reflects the `type` field of spec.metrics[] in the HPA.
"""
K8S_HPA_NAME: Final = "k8s.hpa.name"
"""
The name of the horizontal pod autoscaler.
"""
K8S_HPA_SCALETARGETREF_API_VERSION: Final = (
"k8s.hpa.scaletargetref.api_version"
)
"""
The API version of the target resource to scale for the HorizontalPodAutoscaler.
Note: This maps to the `apiVersion` field in the `scaleTargetRef` of the HPA spec.
"""
K8S_HPA_SCALETARGETREF_KIND: Final = "k8s.hpa.scaletargetref.kind"
"""
The kind of the target resource to scale for the HorizontalPodAutoscaler.
Note: This maps to the `kind` field in the `scaleTargetRef` of the HPA spec.
"""
K8S_HPA_SCALETARGETREF_NAME: Final = "k8s.hpa.scaletargetref.name"
"""
The name of the target resource to scale for the HorizontalPodAutoscaler.
Note: This maps to the `name` field in the `scaleTargetRef` of the HPA spec.
"""
K8S_HPA_UID: Final = "k8s.hpa.uid"
"""
The UID of the horizontal pod autoscaler.
"""
K8S_HUGEPAGE_SIZE: Final = "k8s.hugepage.size"
"""
The size (identifier) of the K8s huge page.
"""
K8S_JOB_ANNOTATION_TEMPLATE: Final = "k8s.job.annotation"
"""
The annotation placed on the Job, the `<key>` being the annotation name, the value being the annotation value, even if the value is empty.
Note: Examples:
- A label `number` with value `1` SHOULD be recorded
as the `k8s.job.annotation.number` attribute with value `"1"`.
- A label `data` with empty string value SHOULD be recorded as
the `k8s.job.annotation.data` attribute with value `""`.
"""
K8S_JOB_LABEL_TEMPLATE: Final = "k8s.job.label"
"""
The label placed on the Job, the `<key>` being the label name, the value being the label value, even if the value is empty.
Note: Examples:
- A label `jobtype` with value `ci` SHOULD be recorded
as the `k8s.job.label.jobtype` attribute with value `"ci"`.
- A label `data` with empty string value SHOULD be recorded as
the `k8s.job.label.automated` attribute with value `""`.
"""
K8S_JOB_NAME: Final = "k8s.job.name"
"""
The name of the Job.
"""
K8S_JOB_UID: Final = "k8s.job.uid"
"""
The UID of the Job.
"""
K8S_NAMESPACE_ANNOTATION_TEMPLATE: Final = "k8s.namespace.annotation"
"""
The annotation placed on the Namespace, the `<key>` being the annotation name, the value being the annotation value, even if the value is empty.
Note: Examples:
- A label `ttl` with value `0` SHOULD be recorded
as the `k8s.namespace.annotation.ttl` attribute with value `"0"`.
- A label `data` with empty string value SHOULD be recorded as
the `k8s.namespace.annotation.data` attribute with value `""`.
"""
K8S_NAMESPACE_LABEL_TEMPLATE: Final = "k8s.namespace.label"
"""
The label placed on the Namespace, the `<key>` being the label name, the value being the label value, even if the value is empty.
Note: Examples:
- A label `kubernetes.io/metadata.name` with value `default` SHOULD be recorded
as the `k8s.namespace.label.kubernetes.io/metadata.name` attribute with value `"default"`.
- A label `data` with empty string value SHOULD be recorded as
the `k8s.namespace.label.data` attribute with value `""`.
"""
K8S_NAMESPACE_NAME: Final = "k8s.namespace.name"
"""
The name of the namespace that the pod is running in.
"""
K8S_NAMESPACE_PHASE: Final = "k8s.namespace.phase"
"""
The phase of the K8s namespace.
Note: This attribute aligns with the `phase` field of the
[K8s NamespaceStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#namespacestatus-v1-core).
"""
K8S_NODE_ANNOTATION_TEMPLATE: Final = "k8s.node.annotation"
"""
The annotation placed on the Node, the `<key>` being the annotation name, the value being the annotation value, even if the value is empty.
Note: Examples:
- An annotation `node.alpha.kubernetes.io/ttl` with value `0` SHOULD be recorded as
the `k8s.node.annotation.node.alpha.kubernetes.io/ttl` attribute with value `"0"`.
- An annotation `data` with empty string value SHOULD be recorded as
the `k8s.node.annotation.data` attribute with value `""`.
"""
K8S_NODE_CONDITION_STATUS: Final = "k8s.node.condition.status"
"""
The status of the condition, one of True, False, Unknown.
Note: This attribute aligns with the `status` field of the
[NodeCondition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core).
"""
K8S_NODE_CONDITION_TYPE: Final = "k8s.node.condition.type"
"""
The condition type of a K8s Node.
Note: K8s Node conditions as described
by [K8s documentation](https://v1-32.docs.kubernetes.io/docs/reference/node/node-status/#condition).
This attribute aligns with the `type` field of the
[NodeCondition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core)
The set of possible values is not limited to those listed here. Managed Kubernetes environments,
or custom controllers MAY introduce additional node condition types.
When this occurs, the exact value as reported by the Kubernetes API SHOULD be used.
"""
K8S_NODE_LABEL_TEMPLATE: Final = "k8s.node.label"
"""
The label placed on the Node, the `<key>` being the label name, the value being the label value, even if the value is empty.
Note: Examples:
- A label `kubernetes.io/arch` with value `arm64` SHOULD be recorded
as the `k8s.node.label.kubernetes.io/arch` attribute with value `"arm64"`.
- A label `data` with empty string value SHOULD be recorded as
the `k8s.node.label.data` attribute with value `""`.
"""
K8S_NODE_NAME: Final = "k8s.node.name"
"""
The name of the Node.
"""
K8S_NODE_UID: Final = "k8s.node.uid"
"""
The UID of the Node.
"""
K8S_POD_ANNOTATION_TEMPLATE: Final = "k8s.pod.annotation"
"""
The annotation placed on the Pod, the `<key>` being the annotation name, the value being the annotation value.
Note: Examples:
- An annotation `kubernetes.io/enforce-mountable-secrets` with value `true` SHOULD be recorded as
the `k8s.pod.annotation.kubernetes.io/enforce-mountable-secrets` attribute with value `"true"`.
- An annotation `mycompany.io/arch` with value `x64` SHOULD be recorded as
the `k8s.pod.annotation.mycompany.io/arch` attribute with value `"x64"`.
- An annotation `data` with empty string value SHOULD be recorded as
the `k8s.pod.annotation.data` attribute with value `""`.
"""
K8S_POD_LABEL_TEMPLATE: Final = "k8s.pod.label"
"""
The label placed on the Pod, the `<key>` being the label name, the value being the label value.
Note: Examples:
- A label `app` with value `my-app` SHOULD be recorded as
the `k8s.pod.label.app` attribute with value `"my-app"`.
- A label `mycompany.io/arch` with value `x64` SHOULD be recorded as
the `k8s.pod.label.mycompany.io/arch` attribute with value `"x64"`.
- A label `data` with empty string value SHOULD be recorded as
the `k8s.pod.label.data` attribute with value `""`.
"""
K8S_POD_LABELS_TEMPLATE: Final = "k8s.pod.labels"
"""
Deprecated: Replaced by `k8s.pod.label`.
"""
K8S_POD_NAME: Final = "k8s.pod.name"
"""
The name of the Pod.
"""
K8S_POD_UID: Final = "k8s.pod.uid"
"""
The UID of the Pod.
"""
K8S_REPLICASET_ANNOTATION_TEMPLATE: Final = "k8s.replicaset.annotation"
"""
The annotation placed on the ReplicaSet, the `<key>` being the annotation name, the value being the annotation value, even if the value is empty.
Note: Examples:
- A label `replicas` with value `0` SHOULD be recorded
as the `k8s.replicaset.annotation.replicas` attribute with value `"0"`.
- A label `data` with empty string value SHOULD be recorded as
the `k8s.replicaset.annotation.data` attribute with value `""`.
"""
K8S_REPLICASET_LABEL_TEMPLATE: Final = "k8s.replicaset.label"
"""
The label placed on the ReplicaSet, the `<key>` being the label name, the value being the label value, even if the value is empty.
Note: Examples:
- A label `app` with value `guestbook` SHOULD be recorded
as the `k8s.replicaset.label.app` attribute with value `"guestbook"`.
- A label `injected` with empty string value SHOULD be recorded as
the `k8s.replicaset.label.injected` attribute with value `""`.
"""
K8S_REPLICASET_NAME: Final = "k8s.replicaset.name"
"""
The name of the ReplicaSet.
"""
K8S_REPLICASET_UID: Final = "k8s.replicaset.uid"
"""
The UID of the ReplicaSet.
"""
K8S_REPLICATIONCONTROLLER_NAME: Final = "k8s.replicationcontroller.name"
"""
The name of the replication controller.
"""
K8S_REPLICATIONCONTROLLER_UID: Final = "k8s.replicationcontroller.uid"
"""
The UID of the replication controller.
"""
K8S_RESOURCEQUOTA_NAME: Final = "k8s.resourcequota.name"
"""
The name of the resource quota.
"""
K8S_RESOURCEQUOTA_RESOURCE_NAME: Final = "k8s.resourcequota.resource_name"
"""
The name of the K8s resource a resource quota defines.
Note: The value for this attribute can be either the full `count/<resource>[.<group>]` string (e.g., count/deployments.apps, count/pods), or, for certain core Kubernetes resources, just the resource name (e.g., pods, services, configmaps). Both forms are supported by Kubernetes for object count quotas. See [Kubernetes Resource Quotas documentation](https://kubernetes.io/docs/concepts/policy/resource-quotas/#object-count-quota) for more details.
"""
K8S_RESOURCEQUOTA_UID: Final = "k8s.resourcequota.uid"
"""
The UID of the resource quota.
"""
K8S_STATEFULSET_ANNOTATION_TEMPLATE: Final = "k8s.statefulset.annotation"
"""
The annotation placed on the StatefulSet, the `<key>` being the annotation name, the value being the annotation value, even if the value is empty.
Note: Examples:
- A label `replicas` with value `1` SHOULD be recorded
as the `k8s.statefulset.annotation.replicas` attribute with value `"1"`.
- A label `data` with empty string value SHOULD be recorded as
the `k8s.statefulset.annotation.data` attribute with value `""`.
"""
K8S_STATEFULSET_LABEL_TEMPLATE: Final = "k8s.statefulset.label"
"""
The label placed on the StatefulSet, the `<key>` being the label name, the value being the label value, even if the value is empty.
Note: Examples:
- A label `replicas` with value `0` SHOULD be recorded
as the `k8s.statefulset.label.app` attribute with value `"guestbook"`.
- A label `injected` with empty string value SHOULD be recorded as
the `k8s.statefulset.label.injected` attribute with value `""`.
"""
K8S_STATEFULSET_NAME: Final = "k8s.statefulset.name"
"""
The name of the StatefulSet.
"""
K8S_STATEFULSET_UID: Final = "k8s.statefulset.uid"
"""
The UID of the StatefulSet.
"""
K8S_STORAGECLASS_NAME: Final = "k8s.storageclass.name"
"""
The name of K8s [StorageClass](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io) object.
"""
K8S_VOLUME_NAME: Final = "k8s.volume.name"
"""
The name of the K8s volume.
"""
K8S_VOLUME_TYPE: Final = "k8s.volume.type"
"""
The type of the K8s volume.
"""
class K8sContainerStatusReasonValues(Enum):
CONTAINER_CREATING = "ContainerCreating"
"""The container is being created."""
CRASH_LOOP_BACK_OFF = "CrashLoopBackOff"
"""The container is in a crash loop back off state."""
CREATE_CONTAINER_CONFIG_ERROR = "CreateContainerConfigError"
"""There was an error creating the container configuration."""
ERR_IMAGE_PULL = "ErrImagePull"
"""There was an error pulling the container image."""
IMAGE_PULL_BACK_OFF = "ImagePullBackOff"
"""The container image pull is in back off state."""
OOM_KILLED = "OOMKilled"
"""The container was killed due to out of memory."""
COMPLETED = "Completed"
"""The container has completed execution."""
ERROR = "Error"
"""There was an error with the container."""
CONTAINER_CANNOT_RUN = "ContainerCannotRun"
"""The container cannot run."""
class K8sContainerStatusStateValues(Enum):
TERMINATED = "terminated"
"""The container has terminated."""
RUNNING = "running"
"""The container is running."""
WAITING = "waiting"
"""The container is waiting."""
class K8sNamespacePhaseValues(Enum):
ACTIVE = "active"
"""Active namespace phase as described by [K8s API](https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase)."""
TERMINATING = "terminating"
"""Terminating namespace phase as described by [K8s API](https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase)."""
class K8sNodeConditionStatusValues(Enum):
CONDITION_TRUE = "true"
"""condition_true."""
CONDITION_FALSE = "false"
"""condition_false."""
CONDITION_UNKNOWN = "unknown"
"""condition_unknown."""
class K8sNodeConditionTypeValues(Enum):
READY = "Ready"
"""The node is healthy and ready to accept pods."""
DISK_PRESSURE = "DiskPressure"
"""Pressure exists on the disk size—that is, if the disk capacity is low."""
MEMORY_PRESSURE = "MemoryPressure"
"""Pressure exists on the node memory—that is, if the node memory is low."""
PID_PRESSURE = "PIDPressure"
"""Pressure exists on the processes—that is, if there are too many processes on the node."""
NETWORK_UNAVAILABLE = "NetworkUnavailable"
"""The network for the node is not correctly configured."""
class K8sVolumeTypeValues(Enum):
PERSISTENT_VOLUME_CLAIM = "persistentVolumeClaim"
"""A [persistentVolumeClaim](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim) volume."""
CONFIG_MAP = "configMap"
"""A [configMap](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap) volume."""
DOWNWARD_API = "downwardAPI"
"""A [downwardAPI](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi) volume."""
EMPTY_DIR = "emptyDir"
"""An [emptyDir](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir) volume."""
SECRET = "secret"
"""A [secret](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#secret) volume."""
LOCAL = "local"
"""A [local](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#local) volume."""

View File

@@ -0,0 +1,28 @@
# 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
LINUX_MEMORY_SLAB_STATE: Final = "linux.memory.slab.state"
"""
The Linux Slab memory state.
"""
class LinuxMemorySlabStateValues(Enum):
RECLAIMABLE = "reclaimable"
"""reclaimable."""
UNRECLAIMABLE = "unreclaimable"
"""unreclaimable."""

View File

@@ -0,0 +1,61 @@
# 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
LOG_FILE_NAME: Final = "log.file.name"
"""
The basename of the file.
"""
LOG_FILE_NAME_RESOLVED: Final = "log.file.name_resolved"
"""
The basename of the file, with symlinks resolved.
"""
LOG_FILE_PATH: Final = "log.file.path"
"""
The full path to the file.
"""
LOG_FILE_PATH_RESOLVED: Final = "log.file.path_resolved"
"""
The full path to the file, with symlinks resolved.
"""
LOG_IOSTREAM: Final = "log.iostream"
"""
The stream associated with the log. See below for a list of well-known values.
"""
LOG_RECORD_ORIGINAL: Final = "log.record.original"
"""
The complete original Log Record.
Note: This value MAY be added when processing a Log Record which was originally transmitted as a string or equivalent data type AND the Body field of the Log Record does not contain the same value. (e.g. a syslog or a log record read from a file.).
"""
LOG_RECORD_UID: Final = "log.record.uid"
"""
A unique identifier for the Log Record.
Note: If an id is provided, other log records with the same id will be considered duplicates and can be removed safely. This means, that two distinguishable log records MUST have different values.
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.
"""
class LogIostreamValues(Enum):
STDOUT = "stdout"
"""Logs from stdout stream."""
STDERR = "stderr"
"""Events from stderr stream."""

View File

@@ -0,0 +1,20 @@
# 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
MAINFRAME_LPAR_NAME: Final = "mainframe.lpar.name"
"""
Name of the logical partition that hosts a systems with a mainframe operating system.
"""

View File

@@ -0,0 +1,48 @@
# 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
from typing_extensions import deprecated
MESSAGE_COMPRESSED_SIZE: Final = "message.compressed_size"
"""
Deprecated: Replaced by `rpc.message.compressed_size`.
"""
MESSAGE_ID: Final = "message.id"
"""
Deprecated: Replaced by `rpc.message.id`.
"""
MESSAGE_TYPE: Final = "message.type"
"""
Deprecated: Replaced by `rpc.message.type`.
"""
MESSAGE_UNCOMPRESSED_SIZE: Final = "message.uncompressed_size"
"""
Deprecated: Replaced by `rpc.message.uncompressed_size`.
"""
@deprecated(
"The attribute message.type is deprecated - Replaced by `rpc.message.type`"
)
class MessageTypeValues(Enum):
SENT = "SENT"
"""sent."""
RECEIVED = "RECEIVED"
"""received."""

View File

@@ -0,0 +1,372 @@
# 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
MESSAGING_BATCH_MESSAGE_COUNT: Final = "messaging.batch.message_count"
"""
The number of messages sent, received, or processed in the scope of the batching operation.
Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on spans that operate with a single message. When a messaging client library supports both batch and single-message API for the same operation, instrumentations SHOULD use `messaging.batch.message_count` for batching APIs and SHOULD NOT use it for single-message APIs.
"""
MESSAGING_CLIENT_ID: Final = "messaging.client.id"
"""
A unique identifier for the client that consumes or produces a message.
"""
MESSAGING_CONSUMER_GROUP_NAME: Final = "messaging.consumer.group.name"
"""
The name of the consumer group with which a consumer is associated.
Note: Semantic conventions for individual messaging systems SHOULD document whether `messaging.consumer.group.name` is applicable and what it means in the context of that system.
"""
MESSAGING_DESTINATION_ANONYMOUS: Final = "messaging.destination.anonymous"
"""
A boolean that is true if the message destination is anonymous (could be unnamed or have auto-generated name).
"""
MESSAGING_DESTINATION_NAME: Final = "messaging.destination.name"
"""
The message destination name.
Note: Destination name SHOULD uniquely identify a specific queue, topic or other entity within the broker. If
the broker doesn't have such notion, the destination name SHOULD uniquely identify the broker.
"""
MESSAGING_DESTINATION_PARTITION_ID: Final = (
"messaging.destination.partition.id"
)
"""
The identifier of the partition messages are sent to or received from, unique within the `messaging.destination.name`.
"""
MESSAGING_DESTINATION_SUBSCRIPTION_NAME: Final = (
"messaging.destination.subscription.name"
)
"""
The name of the destination subscription from which a message is consumed.
Note: Semantic conventions for individual messaging systems SHOULD document whether `messaging.destination.subscription.name` is applicable and what it means in the context of that system.
"""
MESSAGING_DESTINATION_TEMPLATE: Final = "messaging.destination.template"
"""
Low cardinality representation of the messaging destination name.
Note: Destination names could be constructed from templates. An example would be a destination name involving a user name or product id. Although the destination name in this case is of high cardinality, the underlying template is of low cardinality and can be effectively used for grouping and aggregation.
"""
MESSAGING_DESTINATION_TEMPORARY: Final = "messaging.destination.temporary"
"""
A boolean that is true if the message destination is temporary and might not exist anymore after messages are processed.
"""
MESSAGING_DESTINATION_PUBLISH_ANONYMOUS: Final = (
"messaging.destination_publish.anonymous"
)
"""
Deprecated: Removed. No replacement at this time.
"""
MESSAGING_DESTINATION_PUBLISH_NAME: Final = (
"messaging.destination_publish.name"
)
"""
Deprecated: Removed. No replacement at this time.
"""
MESSAGING_EVENTHUBS_CONSUMER_GROUP: Final = (
"messaging.eventhubs.consumer.group"
)
"""
Deprecated: Replaced by `messaging.consumer.group.name`.
"""
MESSAGING_EVENTHUBS_MESSAGE_ENQUEUED_TIME: Final = (
"messaging.eventhubs.message.enqueued_time"
)
"""
The UTC epoch seconds at which the message has been accepted and stored in the entity.
"""
MESSAGING_GCP_PUBSUB_MESSAGE_ACK_DEADLINE: Final = (
"messaging.gcp_pubsub.message.ack_deadline"
)
"""
The ack deadline in seconds set for the modify ack deadline request.
"""
MESSAGING_GCP_PUBSUB_MESSAGE_ACK_ID: Final = (
"messaging.gcp_pubsub.message.ack_id"
)
"""
The ack id for a given message.
"""
MESSAGING_GCP_PUBSUB_MESSAGE_DELIVERY_ATTEMPT: Final = (
"messaging.gcp_pubsub.message.delivery_attempt"
)
"""
The delivery attempt for a given message.
"""
MESSAGING_GCP_PUBSUB_MESSAGE_ORDERING_KEY: Final = (
"messaging.gcp_pubsub.message.ordering_key"
)
"""
The ordering key for a given message. If the attribute is not present, the message does not have an ordering key.
"""
MESSAGING_KAFKA_CONSUMER_GROUP: Final = "messaging.kafka.consumer.group"
"""
Deprecated: Replaced by `messaging.consumer.group.name`.
"""
MESSAGING_KAFKA_DESTINATION_PARTITION: Final = (
"messaging.kafka.destination.partition"
)
"""
Deprecated: Replaced by `messaging.destination.partition.id`.
"""
MESSAGING_KAFKA_MESSAGE_KEY: Final = "messaging.kafka.message.key"
"""
Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message.id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set.
Note: If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value.
"""
MESSAGING_KAFKA_MESSAGE_OFFSET: Final = "messaging.kafka.message.offset"
"""
Deprecated: Replaced by `messaging.kafka.offset`.
"""
MESSAGING_KAFKA_MESSAGE_TOMBSTONE: Final = "messaging.kafka.message.tombstone"
"""
A boolean that is true if the message is a tombstone.
"""
MESSAGING_KAFKA_OFFSET: Final = "messaging.kafka.offset"
"""
The offset of a record in the corresponding Kafka partition.
"""
MESSAGING_MESSAGE_BODY_SIZE: Final = "messaging.message.body.size"
"""
The size of the message body in bytes.
Note: This can refer to both the compressed or uncompressed body size. If both sizes are known, the uncompressed
body size should be used.
"""
MESSAGING_MESSAGE_CONVERSATION_ID: Final = "messaging.message.conversation_id"
"""
The conversation ID identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID".
"""
MESSAGING_MESSAGE_ENVELOPE_SIZE: Final = "messaging.message.envelope.size"
"""
The size of the message body and metadata in bytes.
Note: This can refer to both the compressed or uncompressed size. If both sizes are known, the uncompressed
size should be used.
"""
MESSAGING_MESSAGE_ID: Final = "messaging.message.id"
"""
A value used by the messaging system as an identifier for the message, represented as a string.
"""
MESSAGING_OPERATION: Final = "messaging.operation"
"""
Deprecated: Replaced by `messaging.operation.type`.
"""
MESSAGING_OPERATION_NAME: Final = "messaging.operation.name"
"""
The system-specific name of the messaging operation.
"""
MESSAGING_OPERATION_TYPE: Final = "messaging.operation.type"
"""
A string identifying the type of the messaging operation.
Note: If a custom value is used, it MUST be of low cardinality.
"""
MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY: Final = (
"messaging.rabbitmq.destination.routing_key"
)
"""
RabbitMQ message routing key.
"""
MESSAGING_RABBITMQ_MESSAGE_DELIVERY_TAG: Final = (
"messaging.rabbitmq.message.delivery_tag"
)
"""
RabbitMQ message delivery tag.
"""
MESSAGING_ROCKETMQ_CLIENT_GROUP: Final = "messaging.rocketmq.client_group"
"""
Deprecated: Replaced by `messaging.consumer.group.name` on the consumer spans. No replacement for producer spans.
"""
MESSAGING_ROCKETMQ_CONSUMPTION_MODEL: Final = (
"messaging.rocketmq.consumption_model"
)
"""
Model of message consumption. This only applies to consumer spans.
"""
MESSAGING_ROCKETMQ_MESSAGE_DELAY_TIME_LEVEL: Final = (
"messaging.rocketmq.message.delay_time_level"
)
"""
The delay time level for delay message, which determines the message delay time.
"""
MESSAGING_ROCKETMQ_MESSAGE_DELIVERY_TIMESTAMP: Final = (
"messaging.rocketmq.message.delivery_timestamp"
)
"""
The timestamp in milliseconds that the delay message is expected to be delivered to consumer.
"""
MESSAGING_ROCKETMQ_MESSAGE_GROUP: Final = "messaging.rocketmq.message.group"
"""
It is essential for FIFO message. Messages that belong to the same message group are always processed one by one within the same consumer group.
"""
MESSAGING_ROCKETMQ_MESSAGE_KEYS: Final = "messaging.rocketmq.message.keys"
"""
Key(s) of message, another way to mark message besides message id.
"""
MESSAGING_ROCKETMQ_MESSAGE_TAG: Final = "messaging.rocketmq.message.tag"
"""
The secondary classifier of message besides topic.
"""
MESSAGING_ROCKETMQ_MESSAGE_TYPE: Final = "messaging.rocketmq.message.type"
"""
Type of message.
"""
MESSAGING_ROCKETMQ_NAMESPACE: Final = "messaging.rocketmq.namespace"
"""
Namespace of RocketMQ resources, resources in different namespaces are individual.
"""
MESSAGING_SERVICEBUS_DESTINATION_SUBSCRIPTION_NAME: Final = (
"messaging.servicebus.destination.subscription_name"
)
"""
Deprecated: Replaced by `messaging.destination.subscription.name`.
"""
MESSAGING_SERVICEBUS_DISPOSITION_STATUS: Final = (
"messaging.servicebus.disposition_status"
)
"""
Describes the [settlement type](https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock).
"""
MESSAGING_SERVICEBUS_MESSAGE_DELIVERY_COUNT: Final = (
"messaging.servicebus.message.delivery_count"
)
"""
Number of deliveries that have been attempted for this message.
"""
MESSAGING_SERVICEBUS_MESSAGE_ENQUEUED_TIME: Final = (
"messaging.servicebus.message.enqueued_time"
)
"""
The UTC epoch seconds at which the message has been accepted and stored in the entity.
"""
MESSAGING_SYSTEM: Final = "messaging.system"
"""
The messaging system as identified by the client instrumentation.
Note: The actual messaging system may differ from the one known by the client. For example, when using Kafka client libraries to communicate with Azure Event Hubs, the `messaging.system` is set to `kafka` based on the instrumentation's best knowledge.
"""
class MessagingOperationTypeValues(Enum):
CREATE = "create"
"""A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch sending scenarios."""
SEND = "send"
"""One or more messages are provided for sending to an intermediary. If a single message is sent, the context of the "Send" span can be used as the creation context and no "Create" span needs to be created."""
RECEIVE = "receive"
"""One or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages."""
PROCESS = "process"
"""One or more messages are processed by a consumer."""
SETTLE = "settle"
"""One or more messages are settled."""
DELIVER = "deliver"
"""Deprecated: Replaced by `process`."""
PUBLISH = "publish"
"""Deprecated: Replaced by `send`."""
class MessagingRocketmqConsumptionModelValues(Enum):
CLUSTERING = "clustering"
"""Clustering consumption model."""
BROADCASTING = "broadcasting"
"""Broadcasting consumption model."""
class MessagingRocketmqMessageTypeValues(Enum):
NORMAL = "normal"
"""Normal message."""
FIFO = "fifo"
"""FIFO message."""
DELAY = "delay"
"""Delay message."""
TRANSACTION = "transaction"
"""Transaction message."""
class MessagingServicebusDispositionStatusValues(Enum):
COMPLETE = "complete"
"""Message is completed."""
ABANDON = "abandon"
"""Message is abandoned."""
DEAD_LETTER = "dead_letter"
"""Message is sent to dead letter queue."""
DEFER = "defer"
"""Message is deferred."""
class MessagingSystemValues(Enum):
ACTIVEMQ = "activemq"
"""Apache ActiveMQ."""
AWS_SNS = "aws.sns"
"""Amazon Simple Notification Service (SNS)."""
AWS_SQS = "aws_sqs"
"""Amazon Simple Queue Service (SQS)."""
EVENTGRID = "eventgrid"
"""Azure Event Grid."""
EVENTHUBS = "eventhubs"
"""Azure Event Hubs."""
SERVICEBUS = "servicebus"
"""Azure Service Bus."""
GCP_PUBSUB = "gcp_pubsub"
"""Google Cloud Pub/Sub."""
JMS = "jms"
"""Java Message Service."""
KAFKA = "kafka"
"""Apache Kafka."""
RABBITMQ = "rabbitmq"
"""RabbitMQ."""
ROCKETMQ = "rocketmq"
"""Apache RocketMQ."""
PULSAR = "pulsar"
"""Apache Pulsar."""

View File

@@ -0,0 +1,121 @@
# 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
from typing_extensions import deprecated
NET_HOST_IP: Final = "net.host.ip"
"""
Deprecated: Replaced by `network.local.address`.
"""
NET_HOST_NAME: Final = "net.host.name"
"""
Deprecated: Replaced by `server.address`.
"""
NET_HOST_PORT: Final = "net.host.port"
"""
Deprecated: Replaced by `server.port`.
"""
NET_PEER_IP: Final = "net.peer.ip"
"""
Deprecated: Replaced by `network.peer.address`.
"""
NET_PEER_NAME: Final = "net.peer.name"
"""
Deprecated: Replaced by `server.address` on client spans and `client.address` on server spans.
"""
NET_PEER_PORT: Final = "net.peer.port"
"""
Deprecated: Replaced by `server.port` on client spans and `client.port` on server spans.
"""
NET_PROTOCOL_NAME: Final = "net.protocol.name"
"""
Deprecated: Replaced by `network.protocol.name`.
"""
NET_PROTOCOL_VERSION: Final = "net.protocol.version"
"""
Deprecated: Replaced by `network.protocol.version`.
"""
NET_SOCK_FAMILY: Final = "net.sock.family"
"""
Deprecated: Split to `network.transport` and `network.type`.
"""
NET_SOCK_HOST_ADDR: Final = "net.sock.host.addr"
"""
Deprecated: Replaced by `network.local.address`.
"""
NET_SOCK_HOST_PORT: Final = "net.sock.host.port"
"""
Deprecated: Replaced by `network.local.port`.
"""
NET_SOCK_PEER_ADDR: Final = "net.sock.peer.addr"
"""
Deprecated: Replaced by `network.peer.address`.
"""
NET_SOCK_PEER_NAME: Final = "net.sock.peer.name"
"""
Deprecated: Removed. No replacement at this time.
"""
NET_SOCK_PEER_PORT: Final = "net.sock.peer.port"
"""
Deprecated: Replaced by `network.peer.port`.
"""
NET_TRANSPORT: Final = "net.transport"
"""
Deprecated: Replaced by `network.transport`.
"""
@deprecated(
"The attribute net.sock.family is deprecated - Split to `network.transport` and `network.type`"
)
class NetSockFamilyValues(Enum):
INET = "inet"
"""IPv4 address."""
INET6 = "inet6"
"""IPv6 address."""
UNIX = "unix"
"""Unix domain socket path."""
@deprecated(
"The attribute net.transport is deprecated - Replaced by `network.transport`"
)
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)."""

View File

@@ -0,0 +1,220 @@
# 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
from typing_extensions import deprecated
NETWORK_CARRIER_ICC: Final = "network.carrier.icc"
"""
The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network.
"""
NETWORK_CARRIER_MCC: Final = "network.carrier.mcc"
"""
The mobile carrier country code.
"""
NETWORK_CARRIER_MNC: Final = "network.carrier.mnc"
"""
The mobile carrier network code.
"""
NETWORK_CARRIER_NAME: Final = "network.carrier.name"
"""
The name of the mobile carrier.
"""
NETWORK_CONNECTION_STATE: Final = "network.connection.state"
"""
The state of network connection.
Note: Connection states are defined as part of the [rfc9293](https://datatracker.ietf.org/doc/html/rfc9293#section-3.3.2).
"""
NETWORK_CONNECTION_SUBTYPE: Final = "network.connection.subtype"
"""
This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection.
"""
NETWORK_CONNECTION_TYPE: Final = "network.connection.type"
"""
The internet connection type.
"""
NETWORK_INTERFACE_NAME: Final = "network.interface.name"
"""
The network interface name.
"""
NETWORK_IO_DIRECTION: Final = "network.io.direction"
"""
The network IO operation direction.
"""
NETWORK_LOCAL_ADDRESS: Final = "network.local.address"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_LOCAL_ADDRESS`.
"""
NETWORK_LOCAL_PORT: Final = "network.local.port"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_LOCAL_PORT`.
"""
NETWORK_PEER_ADDRESS: Final = "network.peer.address"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_PEER_ADDRESS`.
"""
NETWORK_PEER_PORT: Final = "network.peer.port"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_PEER_PORT`.
"""
NETWORK_PROTOCOL_NAME: Final = "network.protocol.name"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_PROTOCOL_NAME`.
"""
NETWORK_PROTOCOL_VERSION: Final = "network.protocol.version"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_PROTOCOL_VERSION`.
"""
NETWORK_TRANSPORT: Final = "network.transport"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_TRANSPORT`.
"""
NETWORK_TYPE: Final = "network.type"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NETWORK_TYPE`.
"""
class NetworkConnectionStateValues(Enum):
CLOSED = "closed"
"""closed."""
CLOSE_WAIT = "close_wait"
"""close_wait."""
CLOSING = "closing"
"""closing."""
ESTABLISHED = "established"
"""established."""
FIN_WAIT_1 = "fin_wait_1"
"""fin_wait_1."""
FIN_WAIT_2 = "fin_wait_2"
"""fin_wait_2."""
LAST_ACK = "last_ack"
"""last_ack."""
LISTEN = "listen"
"""listen."""
SYN_RECEIVED = "syn_received"
"""syn_received."""
SYN_SENT = "syn_sent"
"""syn_sent."""
TIME_WAIT = "time_wait"
"""time_wait."""
class NetworkConnectionSubtypeValues(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 NetworkConnectionTypeValues(Enum):
WIFI = "wifi"
"""wifi."""
WIRED = "wired"
"""wired."""
CELL = "cell"
"""cell."""
UNAVAILABLE = "unavailable"
"""unavailable."""
UNKNOWN = "unknown"
"""unknown."""
class NetworkIoDirectionValues(Enum):
TRANSMIT = "transmit"
"""transmit."""
RECEIVE = "receive"
"""receive."""
@deprecated(
"Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTransportValues`."
)
class NetworkTransportValues(Enum):
TCP = "tcp"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTransportValues.TCP`."""
UDP = "udp"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTransportValues.UDP`."""
PIPE = "pipe"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTransportValues.PIPE`."""
UNIX = "unix"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTransportValues.UNIX`."""
QUIC = "quic"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTransportValues.QUIC`."""
@deprecated(
"Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTypeValues`."
)
class NetworkTypeValues(Enum):
IPV4 = "ipv4"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTypeValues.IPV4`."""
IPV6 = "ipv6"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.network_attributes.NetworkTypeValues.IPV6`."""

View File

@@ -0,0 +1,22 @@
# 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
OCI_MANIFEST_DIGEST: Final = "oci.manifest.digest"
"""
The digest of the OCI image manifest. For container images specifically is the digest by which the container image is known.
Note: Follows [OCI Image Manifest Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md), and specifically the [Digest property](https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests).
An example can be found in [Example Image Manifest](https://github.com/opencontainers/image-spec/blob/main/manifest.md#example-image-manifest).
"""

View File

@@ -0,0 +1,40 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from enum import Enum
from typing import Final
OPENAI_REQUEST_SERVICE_TIER: Final = "openai.request.service_tier"
"""
The service tier requested. May be a specific tier, default, or auto.
"""
OPENAI_RESPONSE_SERVICE_TIER: Final = "openai.response.service_tier"
"""
The service tier used for the response.
"""
OPENAI_RESPONSE_SYSTEM_FINGERPRINT: Final = (
"openai.response.system_fingerprint"
)
"""
A fingerprint to track any eventual change in the Generative AI environment.
"""
class OpenaiRequestServiceTierValues(Enum):
AUTO = "auto"
"""The system will utilize scale tier credits until they are exhausted."""
DEFAULT = "default"
"""The system will utilize the default scale tier."""

View File

@@ -0,0 +1,29 @@
# 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
OPENTRACING_REF_TYPE: Final = "opentracing.ref_type"
"""
Parent-child Reference type.
Note: The causal relationship between a child Span and a parent Span.
"""
class OpentracingRefTypeValues(Enum):
CHILD_OF = "child_of"
"""The parent Span depends on the child Span in some capacity."""
FOLLOWS_FROM = "follows_from"
"""The parent Span doesn't depend in any way on the result of the child Span."""

View File

@@ -0,0 +1,68 @@
# 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
OS_BUILD_ID: Final = "os.build_id"
"""
Unique identifier for a particular build or compilation of the operating system.
"""
OS_DESCRIPTION: Final = "os.description"
"""
Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands.
"""
OS_NAME: Final = "os.name"
"""
Human readable operating system name.
"""
OS_TYPE: Final = "os.type"
"""
The operating system type.
"""
OS_VERSION: Final = "os.version"
"""
The version string of the operating system as defined in [Version Attributes](/docs/resource/README.md#version-attributes).
"""
class OsTypeValues(Enum):
WINDOWS = "windows"
"""Microsoft Windows."""
LINUX = "linux"
"""Linux."""
DARWIN = "darwin"
"""Apple Darwin."""
FREEBSD = "freebsd"
"""FreeBSD."""
NETBSD = "netbsd"
"""NetBSD."""
OPENBSD = "openbsd"
"""OpenBSD."""
DRAGONFLYBSD = "dragonflybsd"
"""DragonFly BSD."""
HPUX = "hpux"
"""HP-UX (Hewlett Packard Unix)."""
AIX = "aix"
"""AIX (Advanced Interactive eXecutive)."""
SOLARIS = "solaris"
"""SunOS, Oracle Solaris."""
Z_OS = "z_os"
"""Deprecated: Replaced by `zos`."""
ZOS = "zos"
"""IBM z/OS."""

View File

@@ -0,0 +1,153 @@
# 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
from typing_extensions import deprecated
OTEL_COMPONENT_NAME: Final = "otel.component.name"
"""
A name uniquely identifying the instance of the OpenTelemetry component within its containing SDK instance.
Note: Implementations SHOULD ensure a low cardinality for this attribute, even across application or SDK restarts.
E.g. implementations MUST NOT use UUIDs as values for this attribute.
Implementations MAY achieve these goals by following a `<otel.component.type>/<instance-counter>` pattern, e.g. `batching_span_processor/0`.
Hereby `otel.component.type` refers to the corresponding attribute value of the component.
The value of `instance-counter` MAY be automatically assigned by the component and uniqueness within the enclosing SDK instance MUST be guaranteed.
For example, `<instance-counter>` MAY be implemented by using a monotonically increasing counter (starting with `0`), which is incremented every time an
instance of the given component type is started.
With this implementation, for example the first Batching Span Processor would have `batching_span_processor/0`
as `otel.component.name`, the second one `batching_span_processor/1` and so on.
These values will therefore be reused in the case of an application restart.
"""
OTEL_COMPONENT_TYPE: Final = "otel.component.type"
"""
A name identifying the type of the OpenTelemetry component.
Note: If none of the standardized values apply, implementations SHOULD use the language-defined name of the type.
E.g. for Java the fully qualified classname SHOULD be used in this case.
"""
OTEL_LIBRARY_NAME: Final = "otel.library.name"
"""
Deprecated: Replaced by `otel.scope.name`.
"""
OTEL_LIBRARY_VERSION: Final = "otel.library.version"
"""
Deprecated: Replaced by `otel.scope.version`.
"""
OTEL_SCOPE_NAME: Final = "otel.scope.name"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OTEL_SCOPE_NAME`.
"""
OTEL_SCOPE_SCHEMA_URL: Final = "otel.scope.schema_url"
"""
The schema URL of the instrumentation scope.
"""
OTEL_SCOPE_VERSION: Final = "otel.scope.version"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OTEL_SCOPE_VERSION`.
"""
OTEL_SPAN_PARENT_ORIGIN: Final = "otel.span.parent.origin"
"""
Determines whether the span has a parent span, and if so, [whether it is a remote parent](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote).
"""
OTEL_SPAN_SAMPLING_RESULT: Final = "otel.span.sampling_result"
"""
The result value of the sampler for this span.
"""
OTEL_STATUS_CODE: Final = "otel.status_code"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OTEL_STATUS_CODE`.
"""
OTEL_STATUS_DESCRIPTION: Final = "otel.status_description"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OTEL_STATUS_DESCRIPTION`.
"""
class OtelComponentTypeValues(Enum):
BATCHING_SPAN_PROCESSOR = "batching_span_processor"
"""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 log record processor."""
SIMPLE_LOG_PROCESSOR = "simple_log_processor"
"""The builtin SDK simple log record 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."""
ZIPKIN_HTTP_SPAN_EXPORTER = "zipkin_http_span_exporter"
"""Zipkin span exporter over HTTP."""
OTLP_GRPC_LOG_EXPORTER = "otlp_grpc_log_exporter"
"""OTLP log record exporter over gRPC with protobuf serialization."""
OTLP_HTTP_LOG_EXPORTER = "otlp_http_log_exporter"
"""OTLP log record exporter over HTTP with protobuf serialization."""
OTLP_HTTP_JSON_LOG_EXPORTER = "otlp_http_json_log_exporter"
"""OTLP log record exporter over HTTP with JSON serialization."""
PERIODIC_METRIC_READER = "periodic_metric_reader"
"""The builtin SDK periodically exporting metric reader."""
OTLP_GRPC_METRIC_EXPORTER = "otlp_grpc_metric_exporter"
"""OTLP metric exporter over gRPC with protobuf serialization."""
OTLP_HTTP_METRIC_EXPORTER = "otlp_http_metric_exporter"
"""OTLP metric exporter over HTTP with protobuf serialization."""
OTLP_HTTP_JSON_METRIC_EXPORTER = "otlp_http_json_metric_exporter"
"""OTLP metric exporter over HTTP with JSON serialization."""
PROMETHEUS_HTTP_TEXT_METRIC_EXPORTER = (
"prometheus_http_text_metric_exporter"
)
"""Prometheus metric exporter over HTTP with the default text-based format."""
class OtelSpanParentOriginValues(Enum):
NONE = "none"
"""The span does not have a parent, it is a root span."""
LOCAL = "local"
"""The span has a parent and the parent's span context [isRemote()](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) is false."""
REMOTE = "remote"
"""The span has a parent and the parent's span context [isRemote()](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) is true."""
class OtelSpanSamplingResultValues(Enum):
DROP = "DROP"
"""The span is not sampled and not recording."""
RECORD_ONLY = "RECORD_ONLY"
"""The span is not sampled, but recording."""
RECORD_AND_SAMPLE = "RECORD_AND_SAMPLE"
"""The span is sampled and recording."""
@deprecated(
"Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OtelStatusCodeValues`."
)
class OtelStatusCodeValues(Enum):
OK = "OK"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OtelStatusCodeValues.OK`."""
ERROR = "ERROR"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OtelStatusCodeValues.ERROR`."""

View File

@@ -0,0 +1,33 @@
# 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
from typing_extensions import deprecated
STATE: Final = "state"
"""
Deprecated: Replaced by `db.client.connection.state`.
"""
@deprecated(
"The attribute state is deprecated - Replaced by `db.client.connection.state`"
)
class StateValues(Enum):
IDLE = "idle"
"""idle."""
USED = "used"
"""used."""

View File

@@ -0,0 +1,20 @@
# 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
PEER_SERVICE: Final = "peer.service"
"""
The [`service.name`](/docs/resource/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any.
"""

View File

@@ -0,0 +1,20 @@
# 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
POOL_NAME: Final = "pool.name"
"""
Deprecated: Replaced by `db.client.connection.pool.name`.
"""

View File

@@ -0,0 +1,240 @@
# 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
from typing_extensions import deprecated
PROCESS_ARGS_COUNT: Final = "process.args_count"
"""
Length of the process.command_args array.
Note: This field can be useful for querying or performing bucket analysis on how many arguments were provided to start a process. More arguments may be an indication of suspicious activity.
"""
PROCESS_COMMAND: Final = "process.command"
"""
The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`.
"""
PROCESS_COMMAND_ARGS: Final = "process.command_args"
"""
All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`. SHOULD NOT be collected by default unless there is sanitization that excludes sensitive data.
"""
PROCESS_COMMAND_LINE: Final = "process.command_line"
"""
The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to assemble it just for monitoring; use `process.command_args` instead. SHOULD NOT be collected by default unless there is sanitization that excludes sensitive data.
"""
PROCESS_CONTEXT_SWITCH_TYPE: Final = "process.context_switch_type"
"""
Specifies whether the context switches for this data point were voluntary or involuntary.
"""
PROCESS_CPU_STATE: Final = "process.cpu.state"
"""
Deprecated: Replaced by `cpu.mode`.
"""
PROCESS_CREATION_TIME: Final = "process.creation.time"
"""
The date and time the process was created, in ISO 8601 format.
"""
PROCESS_ENVIRONMENT_VARIABLE_TEMPLATE: Final = "process.environment_variable"
"""
Process environment variables, `<key>` being the environment variable name, the value being the environment variable value.
Note: Examples:
- an environment variable `USER` with value `"ubuntu"` SHOULD be recorded
as the `process.environment_variable.USER` attribute with value `"ubuntu"`.
- an environment variable `PATH` with value `"/usr/local/bin:/usr/bin"`
SHOULD be recorded as the `process.environment_variable.PATH` attribute
with value `"/usr/local/bin:/usr/bin"`.
"""
PROCESS_EXECUTABLE_BUILD_ID_GNU: Final = "process.executable.build_id.gnu"
"""
The GNU build ID as found in the `.note.gnu.build-id` ELF section (hex string).
"""
PROCESS_EXECUTABLE_BUILD_ID_GO: Final = "process.executable.build_id.go"
"""
The Go build ID as retrieved by `go tool buildid <go executable>`.
"""
PROCESS_EXECUTABLE_BUILD_ID_HTLHASH: Final = (
"process.executable.build_id.htlhash"
)
"""
Profiling specific build ID for executables. See the OTel specification for Profiles for more information.
"""
PROCESS_EXECUTABLE_BUILD_ID_PROFILING: Final = (
"process.executable.build_id.profiling"
)
"""
Deprecated: Replaced by `process.executable.build_id.htlhash`.
"""
PROCESS_EXECUTABLE_NAME: Final = "process.executable.name"
"""
The name of the process executable. On Linux based systems, this SHOULD be set to the base name of the target of `/proc/[pid]/exe`. On Windows, this SHOULD be set to the base name of `GetProcessImageFileNameW`.
"""
PROCESS_EXECUTABLE_PATH: Final = "process.executable.path"
"""
The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`.
"""
PROCESS_EXIT_CODE: Final = "process.exit.code"
"""
The exit code of the process.
"""
PROCESS_EXIT_TIME: Final = "process.exit.time"
"""
The date and time the process exited, in ISO 8601 format.
"""
PROCESS_GROUP_LEADER_PID: Final = "process.group_leader.pid"
"""
The PID of the process's group leader. This is also the process group ID (PGID) of the process.
"""
PROCESS_INTERACTIVE: Final = "process.interactive"
"""
Whether the process is connected to an interactive shell.
"""
PROCESS_LINUX_CGROUP: Final = "process.linux.cgroup"
"""
The control group associated with the process.
Note: Control groups (cgroups) are a kernel feature used to organize and manage process resources. This attribute provides the path(s) to the cgroup(s) associated with the process, which should match the contents of the [/proc/\\[PID\\]/cgroup](https://man7.org/linux/man-pages/man7/cgroups.7.html) file.
"""
PROCESS_OWNER: Final = "process.owner"
"""
The username of the user that owns the process.
"""
PROCESS_PAGING_FAULT_TYPE: Final = "process.paging.fault_type"
"""
The type of page fault for this data point. Type `major` is for major/hard page faults, and `minor` is for minor/soft page faults.
"""
PROCESS_PARENT_PID: Final = "process.parent_pid"
"""
Parent Process identifier (PPID).
"""
PROCESS_PID: Final = "process.pid"
"""
Process identifier (PID).
"""
PROCESS_REAL_USER_ID: Final = "process.real_user.id"
"""
The real user ID (RUID) of the process.
"""
PROCESS_REAL_USER_NAME: Final = "process.real_user.name"
"""
The username of the real user of the process.
"""
PROCESS_RUNTIME_DESCRIPTION: Final = "process.runtime.description"
"""
An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment.
"""
PROCESS_RUNTIME_NAME: Final = "process.runtime.name"
"""
The name of the runtime of this process.
"""
PROCESS_RUNTIME_VERSION: Final = "process.runtime.version"
"""
The version of the runtime of this process, as returned by the runtime without modification.
"""
PROCESS_SAVED_USER_ID: Final = "process.saved_user.id"
"""
The saved user ID (SUID) of the process.
"""
PROCESS_SAVED_USER_NAME: Final = "process.saved_user.name"
"""
The username of the saved user.
"""
PROCESS_SESSION_LEADER_PID: Final = "process.session_leader.pid"
"""
The PID of the process's session leader. This is also the session ID (SID) of the process.
"""
PROCESS_TITLE: Final = "process.title"
"""
Process title (proctitle).
Note: In many Unix-like systems, process title (proctitle), is the string that represents the name or command line of a running process, displayed by system monitoring tools like ps, top, and htop.
"""
PROCESS_USER_ID: Final = "process.user.id"
"""
The effective user ID (EUID) of the process.
"""
PROCESS_USER_NAME: Final = "process.user.name"
"""
The username of the effective user of the process.
"""
PROCESS_VPID: Final = "process.vpid"
"""
Virtual process identifier.
Note: The process ID within a PID namespace. This is not necessarily unique across all processes on the host but it is unique within the process namespace that the process exists within.
"""
PROCESS_WORKING_DIRECTORY: Final = "process.working_directory"
"""
The working directory of the process.
"""
class ProcessContextSwitchTypeValues(Enum):
VOLUNTARY = "voluntary"
"""voluntary."""
INVOLUNTARY = "involuntary"
"""involuntary."""
@deprecated(
"The attribute process.cpu.state is deprecated - Replaced by `cpu.mode`"
)
class ProcessCpuStateValues(Enum):
SYSTEM = "system"
"""system."""
USER = "user"
"""user."""
WAIT = "wait"
"""wait."""
class ProcessPagingFaultTypeValues(Enum):
MAJOR = "major"
"""major."""
MINOR = "minor"
"""minor."""

View File

@@ -0,0 +1,48 @@
# 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
PROFILE_FRAME_TYPE: Final = "profile.frame.type"
"""
Describes the interpreter or compiler of a single frame.
"""
class ProfileFrameTypeValues(Enum):
DOTNET = "dotnet"
"""[.NET](https://wikipedia.org/wiki/.NET)."""
JVM = "jvm"
"""[JVM](https://wikipedia.org/wiki/Java_virtual_machine)."""
KERNEL = "kernel"
"""[Kernel](https://wikipedia.org/wiki/Kernel_(operating_system))."""
NATIVE = "native"
"""Can be one of but not limited to [C](https://wikipedia.org/wiki/C_(programming_language)), [C++](https://wikipedia.org/wiki/C%2B%2B), [Go](https://wikipedia.org/wiki/Go_(programming_language)) or [Rust](https://wikipedia.org/wiki/Rust_(programming_language)). If possible, a more precise value MUST be used."""
PERL = "perl"
"""[Perl](https://wikipedia.org/wiki/Perl)."""
PHP = "php"
"""[PHP](https://wikipedia.org/wiki/PHP)."""
CPYTHON = "cpython"
"""[Python](https://wikipedia.org/wiki/Python_(programming_language))."""
RUBY = "ruby"
"""[Ruby](https://wikipedia.org/wiki/Ruby_(programming_language))."""
V8JS = "v8js"
"""[V8JS](https://wikipedia.org/wiki/V8_(JavaScript_engine))."""
BEAM = "beam"
"""[Erlang](https://en.wikipedia.org/wiki/BEAM_(Erlang_virtual_machine))."""
GO = "go"
"""[Go](https://wikipedia.org/wiki/Go_(programming_language)),."""
RUST = "rust"
"""[Rust](https://wikipedia.org/wiki/Rust_(programming_language))."""

View File

@@ -0,0 +1,220 @@
# 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
RPC_CONNECT_RPC_ERROR_CODE: Final = "rpc.connect_rpc.error_code"
"""
The [error codes](https://connectrpc.com//docs/protocol/#error-codes) of the Connect request. Error codes are always string values.
"""
RPC_CONNECT_RPC_REQUEST_METADATA_TEMPLATE: Final = (
"rpc.connect_rpc.request.metadata"
)
"""
Connect request metadata, `<key>` being the normalized Connect Metadata key (lowercase), the value being the metadata values.
Note: Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured.
Including all request metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information.
For example, a property `my-custom-key` with value `["1.2.3.4", "1.2.3.5"]` SHOULD be recorded as
the `rpc.connect_rpc.request.metadata.my-custom-key` attribute with value `["1.2.3.4", "1.2.3.5"]`.
"""
RPC_CONNECT_RPC_RESPONSE_METADATA_TEMPLATE: Final = (
"rpc.connect_rpc.response.metadata"
)
"""
Connect response metadata, `<key>` being the normalized Connect Metadata key (lowercase), the value being the metadata values.
Note: Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured.
Including all response metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information.
For example, a property `my-custom-key` with value `"attribute_value"` SHOULD be recorded as
the `rpc.connect_rpc.response.metadata.my-custom-key` attribute with value `["attribute_value"]`.
"""
RPC_GRPC_REQUEST_METADATA_TEMPLATE: Final = "rpc.grpc.request.metadata"
"""
gRPC request metadata, `<key>` being the normalized gRPC Metadata key (lowercase), the value being the metadata values.
Note: Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured.
Including all request metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information.
For example, a property `my-custom-key` with value `["1.2.3.4", "1.2.3.5"]` SHOULD be recorded as
`rpc.grpc.request.metadata.my-custom-key` attribute with value `["1.2.3.4", "1.2.3.5"]`.
"""
RPC_GRPC_RESPONSE_METADATA_TEMPLATE: Final = "rpc.grpc.response.metadata"
"""
gRPC response metadata, `<key>` being the normalized gRPC Metadata key (lowercase), the value being the metadata values.
Note: Instrumentations SHOULD require an explicit configuration of which metadata values are to be captured.
Including all response metadata values can be a security risk - explicit configuration helps avoid leaking sensitive information.
For example, a property `my-custom-key` with value `["attribute_value"]` SHOULD be recorded as
the `rpc.grpc.response.metadata.my-custom-key` attribute with value `["attribute_value"]`.
"""
RPC_GRPC_STATUS_CODE: Final = "rpc.grpc.status_code"
"""
The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request.
"""
RPC_JSONRPC_ERROR_CODE: Final = "rpc.jsonrpc.error_code"
"""
`error.code` property of response if it is an error response.
"""
RPC_JSONRPC_ERROR_MESSAGE: Final = "rpc.jsonrpc.error_message"
"""
`error.message` property of response if it is an error response.
"""
RPC_JSONRPC_REQUEST_ID: Final = "rpc.jsonrpc.request_id"
"""
`id` property of request or response. Since protocol allows id to be int, string, `null` or missing (for notifications), value is expected to be cast to string for simplicity. Use empty string in case of `null` value. Omit entirely if this is a notification.
"""
RPC_JSONRPC_VERSION: Final = "rpc.jsonrpc.version"
"""
Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 doesn't specify this, the value can be omitted.
"""
RPC_MESSAGE_COMPRESSED_SIZE: Final = "rpc.message.compressed_size"
"""
Compressed size of the message in bytes.
"""
RPC_MESSAGE_ID: Final = "rpc.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.
"""
RPC_MESSAGE_TYPE: Final = "rpc.message.type"
"""
Whether this is a received or sent message.
"""
RPC_MESSAGE_UNCOMPRESSED_SIZE: Final = "rpc.message.uncompressed_size"
"""
Uncompressed size of the message in bytes.
"""
RPC_METHOD: Final = "rpc.method"
"""
The name of the (logical) method being called, must be equal to the $method part in the span name.
Note: This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function.name` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side).
"""
RPC_SERVICE: Final = "rpc.service"
"""
The full (logical) name of the service being called, including its package name, if applicable.
Note: This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side).
"""
RPC_SYSTEM: Final = "rpc.system"
"""
A string identifying the remoting system. See below for a list of well-known identifiers.
"""
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."""
class RpcGrpcStatusCodeValues(Enum):
OK = 0
"""OK."""
CANCELLED = 1
"""CANCELLED."""
UNKNOWN = 2
"""UNKNOWN."""
INVALID_ARGUMENT = 3
"""INVALID_ARGUMENT."""
DEADLINE_EXCEEDED = 4
"""DEADLINE_EXCEEDED."""
NOT_FOUND = 5
"""NOT_FOUND."""
ALREADY_EXISTS = 6
"""ALREADY_EXISTS."""
PERMISSION_DENIED = 7
"""PERMISSION_DENIED."""
RESOURCE_EXHAUSTED = 8
"""RESOURCE_EXHAUSTED."""
FAILED_PRECONDITION = 9
"""FAILED_PRECONDITION."""
ABORTED = 10
"""ABORTED."""
OUT_OF_RANGE = 11
"""OUT_OF_RANGE."""
UNIMPLEMENTED = 12
"""UNIMPLEMENTED."""
INTERNAL = 13
"""INTERNAL."""
UNAVAILABLE = 14
"""UNAVAILABLE."""
DATA_LOSS = 15
"""DATA_LOSS."""
UNAUTHENTICATED = 16
"""UNAUTHENTICATED."""
class RpcMessageTypeValues(Enum):
SENT = "SENT"
"""sent."""
RECEIVED = "RECEIVED"
"""received."""
class RpcSystemValues(Enum):
GRPC = "grpc"
"""gRPC."""
JAVA_RMI = "java_rmi"
"""Java RMI."""
DOTNET_WCF = "dotnet_wcf"
""".NET WCF."""
APACHE_DUBBO = "apache_dubbo"
"""Apache Dubbo."""
CONNECT_RPC = "connect_rpc"
"""Connect RPC."""

View File

@@ -0,0 +1,56 @@
# 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
SECURITY_RULE_CATEGORY: Final = "security_rule.category"
"""
A categorization value keyword used by the entity using the rule for detection of this event.
"""
SECURITY_RULE_DESCRIPTION: Final = "security_rule.description"
"""
The description of the rule generating the event.
"""
SECURITY_RULE_LICENSE: Final = "security_rule.license"
"""
Name of the license under which the rule used to generate this event is made available.
"""
SECURITY_RULE_NAME: Final = "security_rule.name"
"""
The name of the rule or signature generating the event.
"""
SECURITY_RULE_REFERENCE: Final = "security_rule.reference"
"""
Reference URL to additional information about the rule used to generate this event.
Note: The URL can point to the vendors documentation about the rule. If thats not available, it can also be a link to a more general page describing this type of alert.
"""
SECURITY_RULE_RULESET_NAME: Final = "security_rule.ruleset.name"
"""
Name of the ruleset, policy, group, or parent category in which the rule used to generate this event is a member.
"""
SECURITY_RULE_UUID: Final = "security_rule.uuid"
"""
A rule ID that is unique within the scope of a set or group of agents, observers, or other entities using the rule for detection of this event.
"""
SECURITY_RULE_VERSION: Final = "security_rule.version"
"""
The version / revision of the rule being used for analysis.
"""

View File

@@ -0,0 +1,25 @@
# 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
SERVER_ADDRESS: Final = "server.address"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.server_attributes.SERVER_ADDRESS`.
"""
SERVER_PORT: Final = "server.port"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.server_attributes.SERVER_PORT`.
"""

View File

@@ -0,0 +1,62 @@
# 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
SERVICE_INSTANCE_ID: Final = "service.instance.id"
"""
The string ID of the service instance.
Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words
`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).
Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC
4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of
this value if stability is desirable. In that case, the ID SHOULD be used as source of a UUID Version 5 and
SHOULD use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`.
UUIDs are typically recommended, as only an opaque value for the purposes of identifying a service instance is
needed. Similar to what can be seen in the man page for the
[`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/latest/machine-id.html) file, the underlying
data, such as pod name and namespace should be treated as confidential, being the user's choice to expose it
or not via another resource attribute.
For applications running behind an application server (like unicorn), we do not recommend using one identifier
for all processes participating in the application. Instead, it's recommended each division (e.g. a worker
thread in unicorn) to have its own instance.id.
It's not recommended for a Collector to set `service.instance.id` if it can't unambiguously determine the
service instance that is generating that telemetry. For instance, creating an UUID based on `pod.name` will
likely be wrong, as the Collector might not know from which container within that pod the telemetry originated.
However, Collectors can set the `service.instance.id` if they can unambiguously determine the service instance
for that telemetry. This is typically the case for scraping receivers, as they know the target address and
port.
"""
SERVICE_NAME: Final = "service.name"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.service_attributes.SERVICE_NAME`.
"""
SERVICE_NAMESPACE: Final = "service.namespace"
"""
A namespace for `service.name`.
Note: A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace.
"""
SERVICE_VERSION: Final = "service.version"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.service_attributes.SERVICE_VERSION`.
"""

View File

@@ -0,0 +1,25 @@
# 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
SESSION_ID: Final = "session.id"
"""
A unique id to identify a session.
"""
SESSION_PREVIOUS_ID: Final = "session.previous_id"
"""
The previous `session.id` for this user, when known.
"""

View File

@@ -0,0 +1,26 @@
# 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
SOURCE_ADDRESS: Final = "source.address"
"""
Source address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
Note: When observed from the destination side, and when communicating through an intermediary, `source.address` SHOULD represent the source address behind any intermediaries, for example proxies, if it's available.
"""
SOURCE_PORT: Final = "source.port"
"""
Source port number.
"""

View File

@@ -0,0 +1,221 @@
# 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
from typing_extensions import deprecated
SYSTEM_CPU_LOGICAL_NUMBER: Final = "system.cpu.logical_number"
"""
Deprecated, use `cpu.logical_number` instead.
"""
SYSTEM_CPU_STATE: Final = "system.cpu.state"
"""
Deprecated: Replaced by `cpu.mode`.
"""
SYSTEM_DEVICE: Final = "system.device"
"""
The device identifier.
"""
SYSTEM_FILESYSTEM_MODE: Final = "system.filesystem.mode"
"""
The filesystem mode.
"""
SYSTEM_FILESYSTEM_MOUNTPOINT: Final = "system.filesystem.mountpoint"
"""
The filesystem mount path.
"""
SYSTEM_FILESYSTEM_STATE: Final = "system.filesystem.state"
"""
The filesystem state.
"""
SYSTEM_FILESYSTEM_TYPE: Final = "system.filesystem.type"
"""
The filesystem type.
"""
SYSTEM_MEMORY_STATE: Final = "system.memory.state"
"""
The memory state.
"""
SYSTEM_NETWORK_STATE: Final = "system.network.state"
"""
Deprecated: Replaced by `network.connection.state`.
"""
SYSTEM_PAGING_DIRECTION: Final = "system.paging.direction"
"""
The paging access direction.
"""
SYSTEM_PAGING_STATE: Final = "system.paging.state"
"""
The memory paging state.
"""
SYSTEM_PAGING_TYPE: Final = "system.paging.type"
"""
The memory paging type.
"""
SYSTEM_PROCESS_STATUS: Final = "system.process.status"
"""
The process state, e.g., [Linux Process State Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES).
"""
SYSTEM_PROCESSES_STATUS: Final = "system.processes.status"
"""
Deprecated: Replaced by `system.process.status`.
"""
@deprecated(
"The attribute system.cpu.state is deprecated - Replaced by `cpu.mode`"
)
class SystemCpuStateValues(Enum):
USER = "user"
"""user."""
SYSTEM = "system"
"""system."""
NICE = "nice"
"""nice."""
IDLE = "idle"
"""idle."""
IOWAIT = "iowait"
"""iowait."""
INTERRUPT = "interrupt"
"""interrupt."""
STEAL = "steal"
"""steal."""
class SystemFilesystemStateValues(Enum):
USED = "used"
"""used."""
FREE = "free"
"""free."""
RESERVED = "reserved"
"""reserved."""
class SystemFilesystemTypeValues(Enum):
FAT32 = "fat32"
"""fat32."""
EXFAT = "exfat"
"""exfat."""
NTFS = "ntfs"
"""ntfs."""
REFS = "refs"
"""refs."""
HFSPLUS = "hfsplus"
"""hfsplus."""
EXT4 = "ext4"
"""ext4."""
class SystemMemoryStateValues(Enum):
USED = "used"
"""Actual used virtual memory in bytes."""
FREE = "free"
"""free."""
SHARED = "shared"
"""Deprecated: Removed, report shared memory usage with `metric.system.memory.shared` metric."""
BUFFERS = "buffers"
"""buffers."""
CACHED = "cached"
"""cached."""
@deprecated(
"The attribute system.network.state is deprecated - Replaced by `network.connection.state`"
)
class SystemNetworkStateValues(Enum):
CLOSE = "close"
"""close."""
CLOSE_WAIT = "close_wait"
"""close_wait."""
CLOSING = "closing"
"""closing."""
DELETE = "delete"
"""delete."""
ESTABLISHED = "established"
"""established."""
FIN_WAIT_1 = "fin_wait_1"
"""fin_wait_1."""
FIN_WAIT_2 = "fin_wait_2"
"""fin_wait_2."""
LAST_ACK = "last_ack"
"""last_ack."""
LISTEN = "listen"
"""listen."""
SYN_RECV = "syn_recv"
"""syn_recv."""
SYN_SENT = "syn_sent"
"""syn_sent."""
TIME_WAIT = "time_wait"
"""time_wait."""
class SystemPagingDirectionValues(Enum):
IN = "in"
"""in."""
OUT = "out"
"""out."""
class SystemPagingStateValues(Enum):
USED = "used"
"""used."""
FREE = "free"
"""free."""
class SystemPagingTypeValues(Enum):
MAJOR = "major"
"""major."""
MINOR = "minor"
"""minor."""
class SystemProcessStatusValues(Enum):
RUNNING = "running"
"""running."""
SLEEPING = "sleeping"
"""sleeping."""
STOPPED = "stopped"
"""stopped."""
DEFUNCT = "defunct"
"""defunct."""
@deprecated(
"The attribute system.processes.status is deprecated - Replaced by `system.process.status`"
)
class SystemProcessesStatusValues(Enum):
RUNNING = "running"
"""running."""
SLEEPING = "sleeping"
"""sleeping."""
STOPPED = "stopped"
"""stopped."""
DEFUNCT = "defunct"
"""defunct."""

View File

@@ -0,0 +1,75 @@
# 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
from typing_extensions import deprecated
TELEMETRY_DISTRO_NAME: Final = "telemetry.distro.name"
"""
The name of the auto instrumentation agent or distribution, if used.
Note: Official auto instrumentation agents and distributions SHOULD set the `telemetry.distro.name` attribute to
a string starting with `opentelemetry-`, e.g. `opentelemetry-java-instrumentation`.
"""
TELEMETRY_DISTRO_VERSION: Final = "telemetry.distro.version"
"""
The version string of the auto instrumentation agent or distribution, if used.
"""
TELEMETRY_SDK_LANGUAGE: Final = "telemetry.sdk.language"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TELEMETRY_SDK_LANGUAGE`.
"""
TELEMETRY_SDK_NAME: Final = "telemetry.sdk.name"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TELEMETRY_SDK_NAME`.
"""
TELEMETRY_SDK_VERSION: Final = "telemetry.sdk.version"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TELEMETRY_SDK_VERSION`.
"""
@deprecated(
"Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues`."
)
class TelemetrySdkLanguageValues(Enum):
CPP = "cpp"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.CPP`."""
DOTNET = "dotnet"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.DOTNET`."""
ERLANG = "erlang"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.ERLANG`."""
GO = "go"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.GO`."""
JAVA = "java"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.JAVA`."""
NODEJS = "nodejs"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.NODEJS`."""
PHP = "php"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.PHP`."""
PYTHON = "python"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.PYTHON`."""
RUBY = "ruby"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.RUBY`."""
RUST = "rust"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.RUST`."""
SWIFT = "swift"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.SWIFT`."""
WEBJS = "webjs"
"""Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.telemetry_attributes.TelemetrySdkLanguageValues.WEBJS`."""

View File

@@ -0,0 +1,58 @@
# 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
TEST_CASE_NAME: Final = "test.case.name"
"""
The fully qualified human readable name of the [test case](https://wikipedia.org/wiki/Test_case).
"""
TEST_CASE_RESULT_STATUS: Final = "test.case.result.status"
"""
The status of the actual test case result from test execution.
"""
TEST_SUITE_NAME: Final = "test.suite.name"
"""
The human readable name of a [test suite](https://wikipedia.org/wiki/Test_suite).
"""
TEST_SUITE_RUN_STATUS: Final = "test.suite.run.status"
"""
The status of the test suite run.
"""
class TestCaseResultStatusValues(Enum):
PASS = "pass"
"""pass."""
FAIL = "fail"
"""fail."""
class TestSuiteRunStatusValues(Enum):
SUCCESS = "success"
"""success."""
FAILURE = "failure"
"""failure."""
SKIPPED = "skipped"
"""skipped."""
ABORTED = "aborted"
"""aborted."""
TIMED_OUT = "timed_out"
"""timed_out."""
IN_PROGRESS = "in_progress"
"""in_progress."""

View File

@@ -0,0 +1,25 @@
# 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
THREAD_ID: Final = "thread.id"
"""
Current "managed" thread ID (as opposed to OS thread ID).
"""
THREAD_NAME: Final = "thread.name"
"""
Current thread name.
"""

View File

@@ -0,0 +1,169 @@
# 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
TLS_CIPHER: Final = "tls.cipher"
"""
String indicating the [cipher](https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5) used during the current connection.
Note: The values allowed for `tls.cipher` MUST be one of the `Descriptions` of the [registered TLS Cipher Suits](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#table-tls-parameters-4).
"""
TLS_CLIENT_CERTIFICATE: Final = "tls.client.certificate"
"""
PEM-encoded stand-alone certificate offered by the client. This is usually mutually-exclusive of `client.certificate_chain` since this value also exists in that list.
"""
TLS_CLIENT_CERTIFICATE_CHAIN: Final = "tls.client.certificate_chain"
"""
Array of PEM-encoded certificates that make up the certificate chain offered by the client. This is usually mutually-exclusive of `client.certificate` since that value should be the first certificate in the chain.
"""
TLS_CLIENT_HASH_MD5: Final = "tls.client.hash.md5"
"""
Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the client. For consistency with other hash values, this value should be formatted as an uppercase hash.
"""
TLS_CLIENT_HASH_SHA1: Final = "tls.client.hash.sha1"
"""
Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by the client. For consistency with other hash values, this value should be formatted as an uppercase hash.
"""
TLS_CLIENT_HASH_SHA256: Final = "tls.client.hash.sha256"
"""
Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by the client. For consistency with other hash values, this value should be formatted as an uppercase hash.
"""
TLS_CLIENT_ISSUER: Final = "tls.client.issuer"
"""
Distinguished name of [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of the issuer of the x.509 certificate presented by the client.
"""
TLS_CLIENT_JA3: Final = "tls.client.ja3"
"""
A hash that identifies clients based on how they perform an SSL/TLS handshake.
"""
TLS_CLIENT_NOT_AFTER: Final = "tls.client.not_after"
"""
Date/Time indicating when client certificate is no longer considered valid.
"""
TLS_CLIENT_NOT_BEFORE: Final = "tls.client.not_before"
"""
Date/Time indicating when client certificate is first considered valid.
"""
TLS_CLIENT_SERVER_NAME: Final = "tls.client.server_name"
"""
Deprecated: Replaced by `server.address`.
"""
TLS_CLIENT_SUBJECT: Final = "tls.client.subject"
"""
Distinguished name of subject of the x.509 certificate presented by the client.
"""
TLS_CLIENT_SUPPORTED_CIPHERS: Final = "tls.client.supported_ciphers"
"""
Array of ciphers offered by the client during the client hello.
"""
TLS_CURVE: Final = "tls.curve"
"""
String indicating the curve used for the given cipher, when applicable.
"""
TLS_ESTABLISHED: Final = "tls.established"
"""
Boolean flag indicating if the TLS negotiation was successful and transitioned to an encrypted tunnel.
"""
TLS_NEXT_PROTOCOL: Final = "tls.next_protocol"
"""
String indicating the protocol being tunneled. Per the values in the [IANA registry](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids), this string should be lower case.
"""
TLS_PROTOCOL_NAME: Final = "tls.protocol.name"
"""
Normalized lowercase protocol name parsed from original string of the negotiated [SSL/TLS protocol version](https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values).
"""
TLS_PROTOCOL_VERSION: Final = "tls.protocol.version"
"""
Numeric part of the version parsed from the original string of the negotiated [SSL/TLS protocol version](https://docs.openssl.org/1.1.1/man3/SSL_get_version/#return-values).
"""
TLS_RESUMED: Final = "tls.resumed"
"""
Boolean flag indicating if this TLS connection was resumed from an existing TLS negotiation.
"""
TLS_SERVER_CERTIFICATE: Final = "tls.server.certificate"
"""
PEM-encoded stand-alone certificate offered by the server. This is usually mutually-exclusive of `server.certificate_chain` since this value also exists in that list.
"""
TLS_SERVER_CERTIFICATE_CHAIN: Final = "tls.server.certificate_chain"
"""
Array of PEM-encoded certificates that make up the certificate chain offered by the server. This is usually mutually-exclusive of `server.certificate` since that value should be the first certificate in the chain.
"""
TLS_SERVER_HASH_MD5: Final = "tls.server.hash.md5"
"""
Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the server. For consistency with other hash values, this value should be formatted as an uppercase hash.
"""
TLS_SERVER_HASH_SHA1: Final = "tls.server.hash.sha1"
"""
Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by the server. For consistency with other hash values, this value should be formatted as an uppercase hash.
"""
TLS_SERVER_HASH_SHA256: Final = "tls.server.hash.sha256"
"""
Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by the server. For consistency with other hash values, this value should be formatted as an uppercase hash.
"""
TLS_SERVER_ISSUER: Final = "tls.server.issuer"
"""
Distinguished name of [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of the issuer of the x.509 certificate presented by the client.
"""
TLS_SERVER_JA3S: Final = "tls.server.ja3s"
"""
A hash that identifies servers based on how they perform an SSL/TLS handshake.
"""
TLS_SERVER_NOT_AFTER: Final = "tls.server.not_after"
"""
Date/Time indicating when server certificate is no longer considered valid.
"""
TLS_SERVER_NOT_BEFORE: Final = "tls.server.not_before"
"""
Date/Time indicating when server certificate is first considered valid.
"""
TLS_SERVER_SUBJECT: Final = "tls.server.subject"
"""
Distinguished name of subject of the x.509 certificate presented by the server.
"""
class TlsProtocolNameValues(Enum):
SSL = "ssl"
"""ssl."""
TLS = "tls"
"""tls."""

View File

@@ -0,0 +1,87 @@
# 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
URL_DOMAIN: Final = "url.domain"
"""
Domain extracted from the `url.full`, such as "opentelemetry.io".
Note: In some cases a URL may refer to an IP and/or port directly, without a domain name. In this case, the IP address would go to the domain field. If the URL contains a [literal IPv6 address](https://www.rfc-editor.org/rfc/rfc2732#section-2) enclosed by `[` and `]`, the `[` and `]` characters should also be captured in the domain field.
"""
URL_EXTENSION: Final = "url.extension"
"""
The file extension extracted from the `url.full`, excluding the leading dot.
Note: The file extension is only set if it exists, as not every url has a file extension. When the file name has multiple extensions `example.tar.gz`, only the last one should be captured `gz`, not `tar.gz`.
"""
URL_FRAGMENT: Final = "url.fragment"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.url_attributes.URL_FRAGMENT`.
"""
URL_FULL: Final = "url.full"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.url_attributes.URL_FULL`.
"""
URL_ORIGINAL: Final = "url.original"
"""
Unmodified original URL as seen in the event source.
Note: In network monitoring, the observed URL may be a full URL, whereas in access logs, the URL is often just represented as a path. This field is meant to represent the URL as it was observed, complete or not.
`url.original` might contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case password and username SHOULD NOT be redacted and attribute's value SHOULD remain the same.
"""
URL_PATH: Final = "url.path"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.url_attributes.URL_PATH`.
"""
URL_PORT: Final = "url.port"
"""
Port extracted from the `url.full`.
"""
URL_QUERY: Final = "url.query"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.url_attributes.URL_QUERY`.
"""
URL_REGISTERED_DOMAIN: Final = "url.registered_domain"
"""
The highest registered url domain, stripped of the subdomain.
Note: This value can be determined precisely with the [public suffix list](https://publicsuffix.org/). For example, the registered domain for `foo.example.com` is `example.com`. Trying to approximate this by simply taking the last two labels will not work well for TLDs such as `co.uk`.
"""
URL_SCHEME: Final = "url.scheme"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.url_attributes.URL_SCHEME`.
"""
URL_SUBDOMAIN: Final = "url.subdomain"
"""
The subdomain portion of a fully qualified domain name includes all of the names except the host name under the registered_domain. In a partially qualified domain, or if the qualification level of the full name cannot be determined, subdomain contains all of the names below the registered domain.
Note: The subdomain portion of `www.east.mydomain.co.uk` is `east`. If the domain has multiple levels of subdomain, such as `sub2.sub1.example.com`, the subdomain field should contain `sub2.sub1`, with no trailing period.
"""
URL_TEMPLATE: Final = "url.template"
"""
The low-cardinality template of an [absolute path reference](https://www.rfc-editor.org/rfc/rfc3986#section-4.2).
"""
URL_TOP_LEVEL_DOMAIN: Final = "url.top_level_domain"
"""
The effective top level domain (eTLD), also known as the domain suffix, is the last part of the domain name. For example, the top level domain for example.com is `com`.
Note: This value can be determined precisely with the [public suffix list](https://publicsuffix.org/).
"""

View File

@@ -0,0 +1,58 @@
# 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
USER_AGENT_NAME: Final = "user_agent.name"
"""
Name of the user-agent extracted from original. Usually refers to the browser's name.
Note: [Example](https://www.whatsmyua.info) of extracting browser's name from original string. In the case of using a user-agent for non-browser products, such as microservices with multiple names/versions inside the `user_agent.original`, the most significant name SHOULD be selected. In such a scenario it should align with `user_agent.version`.
"""
USER_AGENT_ORIGINAL: Final = "user_agent.original"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.user_agent_attributes.USER_AGENT_ORIGINAL`.
"""
USER_AGENT_OS_NAME: Final = "user_agent.os.name"
"""
Human readable operating system name.
Note: For mapping user agent strings to OS names, libraries such as [ua-parser](https://github.com/ua-parser) can be utilized.
"""
USER_AGENT_OS_VERSION: Final = "user_agent.os.version"
"""
The version string of the operating system as defined in [Version Attributes](/docs/resource/README.md#version-attributes).
Note: For mapping user agent strings to OS versions, libraries such as [ua-parser](https://github.com/ua-parser) can be utilized.
"""
USER_AGENT_SYNTHETIC_TYPE: Final = "user_agent.synthetic.type"
"""
Specifies the category of synthetic traffic, such as tests or bots.
Note: This attribute MAY be derived from the contents of the `user_agent.original` attribute. Components that populate the attribute are responsible for determining what they consider to be synthetic bot or test traffic. This attribute can either be set for self-identification purposes, or on telemetry detected to be generated as a result of a synthetic request. This attribute is useful for distinguishing between genuine client traffic and synthetic traffic generated by bots or tests.
"""
USER_AGENT_VERSION: Final = "user_agent.version"
"""
Version of the user-agent extracted from original. Usually refers to the browser's version.
Note: [Example](https://www.whatsmyua.info) of extracting browser's version from original string. In the case of using a user-agent for non-browser products, such as microservices with multiple names/versions inside the `user_agent.original`, the most significant version SHOULD be selected. In such a scenario it should align with `user_agent.name`.
"""
class UserAgentSyntheticTypeValues(Enum):
BOT = "bot"
"""Bot source."""
TEST = "test"
"""Synthetic test source."""

View File

@@ -0,0 +1,46 @@
# 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
USER_EMAIL: Final = "user.email"
"""
User email address.
"""
USER_FULL_NAME: Final = "user.full_name"
"""
User's full name.
"""
USER_HASH: Final = "user.hash"
"""
Unique user hash to correlate information for a user in anonymized form.
Note: Useful if `user.id` or `user.name` contain confidential information and cannot be used.
"""
USER_ID: Final = "user.id"
"""
Unique identifier of the user.
"""
USER_NAME: Final = "user.name"
"""
Short name or login/username of the user.
"""
USER_ROLES: Final = "user.roles"
"""
Array of user roles at the time of the event.
"""

View File

@@ -0,0 +1,231 @@
# 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
from typing_extensions import deprecated
VCS_CHANGE_ID: Final = "vcs.change.id"
"""
The ID of the change (pull request/merge request/changelist) if applicable. This is usually a unique (within repository) identifier generated by the VCS system.
"""
VCS_CHANGE_STATE: Final = "vcs.change.state"
"""
The state of the change (pull request/merge request/changelist).
"""
VCS_CHANGE_TITLE: Final = "vcs.change.title"
"""
The human readable title of the change (pull request/merge request/changelist). This title is often a brief summary of the change and may get merged in to a ref as the commit summary.
"""
VCS_LINE_CHANGE_TYPE: Final = "vcs.line_change.type"
"""
The type of line change being measured on a branch or change.
"""
VCS_OWNER_NAME: Final = "vcs.owner.name"
"""
The group owner within the version control system.
"""
VCS_PROVIDER_NAME: Final = "vcs.provider.name"
"""
The name of the version control system provider.
"""
VCS_REF_BASE_NAME: Final = "vcs.ref.base.name"
"""
The name of the [reference](https://git-scm.com/docs/gitglossary#def_ref) such as **branch** or **tag** in the repository.
Note: `base` refers to the starting point of a change. For example, `main`
would be the base reference of type branch if you've created a new
reference of type branch from it and created new commits.
"""
VCS_REF_BASE_REVISION: Final = "vcs.ref.base.revision"
"""
The revision, literally [revised version](https://www.merriam-webster.com/dictionary/revision), The revision most often refers to a commit object in Git, or a revision number in SVN.
Note: `base` refers to the starting point of a change. For example, `main`
would be the base reference of type branch if you've created a new
reference of type branch from it and created new commits. The
revision can be a full [hash value (see
glossary)](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf),
of the recorded change to a ref within a repository pointing to a
commit [commit](https://git-scm.com/docs/git-commit) object. It does
not necessarily have to be a hash; it can simply define a [revision
number](https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html)
which is an integer that is monotonically increasing. In cases where
it is identical to the `ref.base.name`, it SHOULD still be included.
It is up to the implementer to decide which value to set as the
revision based on the VCS system and situational context.
"""
VCS_REF_BASE_TYPE: Final = "vcs.ref.base.type"
"""
The type of the [reference](https://git-scm.com/docs/gitglossary#def_ref) in the repository.
Note: `base` refers to the starting point of a change. For example, `main`
would be the base reference of type branch if you've created a new
reference of type branch from it and created new commits.
"""
VCS_REF_HEAD_NAME: Final = "vcs.ref.head.name"
"""
The name of the [reference](https://git-scm.com/docs/gitglossary#def_ref) such as **branch** or **tag** in the repository.
Note: `head` refers to where you are right now; the current reference at a
given time.
"""
VCS_REF_HEAD_REVISION: Final = "vcs.ref.head.revision"
"""
The revision, literally [revised version](https://www.merriam-webster.com/dictionary/revision), The revision most often refers to a commit object in Git, or a revision number in SVN.
Note: `head` refers to where you are right now; the current reference at a
given time.The revision can be a full [hash value (see
glossary)](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf),
of the recorded change to a ref within a repository pointing to a
commit [commit](https://git-scm.com/docs/git-commit) object. It does
not necessarily have to be a hash; it can simply define a [revision
number](https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html)
which is an integer that is monotonically increasing. In cases where
it is identical to the `ref.head.name`, it SHOULD still be included.
It is up to the implementer to decide which value to set as the
revision based on the VCS system and situational context.
"""
VCS_REF_HEAD_TYPE: Final = "vcs.ref.head.type"
"""
The type of the [reference](https://git-scm.com/docs/gitglossary#def_ref) in the repository.
Note: `head` refers to where you are right now; the current reference at a
given time.
"""
VCS_REF_TYPE: Final = "vcs.ref.type"
"""
The type of the [reference](https://git-scm.com/docs/gitglossary#def_ref) in the repository.
"""
VCS_REPOSITORY_CHANGE_ID: Final = "vcs.repository.change.id"
"""
Deprecated: Replaced by `vcs.change.id`.
"""
VCS_REPOSITORY_CHANGE_TITLE: Final = "vcs.repository.change.title"
"""
Deprecated: Replaced by `vcs.change.title`.
"""
VCS_REPOSITORY_NAME: Final = "vcs.repository.name"
"""
The human readable name of the repository. It SHOULD NOT include any additional identifier like Group/SubGroup in GitLab or organization in GitHub.
Note: Due to it only being the name, it can clash with forks of the same
repository if collecting telemetry across multiple orgs or groups in
the same backends.
"""
VCS_REPOSITORY_REF_NAME: Final = "vcs.repository.ref.name"
"""
Deprecated: Replaced by `vcs.ref.head.name`.
"""
VCS_REPOSITORY_REF_REVISION: Final = "vcs.repository.ref.revision"
"""
Deprecated: Replaced by `vcs.ref.head.revision`.
"""
VCS_REPOSITORY_REF_TYPE: Final = "vcs.repository.ref.type"
"""
Deprecated: Replaced by `vcs.ref.head.type`.
"""
VCS_REPOSITORY_URL_FULL: Final = "vcs.repository.url.full"
"""
The [canonical URL](https://support.google.com/webmasters/answer/10347851?hl=en#:~:text=A%20canonical%20URL%20is%20the,Google%20chooses%20one%20as%20canonical.) of the repository providing the complete HTTP(S) address in order to locate and identify the repository through a browser.
Note: In Git Version Control Systems, the canonical URL SHOULD NOT include
the `.git` extension.
"""
VCS_REVISION_DELTA_DIRECTION: Final = "vcs.revision_delta.direction"
"""
The type of revision comparison.
"""
class VcsChangeStateValues(Enum):
OPEN = "open"
"""Open means the change is currently active and under review. It hasn't been merged into the target branch yet, and it's still possible to make changes or add comments."""
WIP = "wip"
"""WIP (work-in-progress, draft) means the change is still in progress and not yet ready for a full review. It might still undergo significant changes."""
CLOSED = "closed"
"""Closed means the merge request has been closed without merging. This can happen for various reasons, such as the changes being deemed unnecessary, the issue being resolved in another way, or the author deciding to withdraw the request."""
MERGED = "merged"
"""Merged indicates that the change has been successfully integrated into the target codebase."""
class VcsLineChangeTypeValues(Enum):
ADDED = "added"
"""How many lines were added."""
REMOVED = "removed"
"""How many lines were removed."""
class VcsProviderNameValues(Enum):
GITHUB = "github"
"""[GitHub](https://github.com)."""
GITLAB = "gitlab"
"""[GitLab](https://gitlab.com)."""
GITTEA = "gittea"
"""Deprecated: Replaced by `gitea`."""
GITEA = "gitea"
"""[Gitea](https://gitea.io)."""
BITBUCKET = "bitbucket"
"""[Bitbucket](https://bitbucket.org)."""
class VcsRefBaseTypeValues(Enum):
BRANCH = "branch"
"""[branch](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch)."""
TAG = "tag"
"""[tag](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag)."""
class VcsRefHeadTypeValues(Enum):
BRANCH = "branch"
"""[branch](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch)."""
TAG = "tag"
"""[tag](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag)."""
class VcsRefTypeValues(Enum):
BRANCH = "branch"
"""[branch](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch)."""
TAG = "tag"
"""[tag](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag)."""
@deprecated(
"The attribute vcs.repository.ref.type is deprecated - Replaced by `vcs.ref.head.type`"
)
class VcsRepositoryRefTypeValues(Enum):
BRANCH = "branch"
"""[branch](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefbranchabranch)."""
TAG = "tag"
"""[tag](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddeftagatag)."""
class VcsRevisionDeltaDirectionValues(Enum):
BEHIND = "behind"
"""How many revisions the change is behind the target ref."""
AHEAD = "ahead"
"""How many revisions the change is ahead of the target ref."""

View File

@@ -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 typing import Final
WEBENGINE_DESCRIPTION: Final = "webengine.description"
"""
Additional description of the web engine (e.g. detailed version and edition information).
"""
WEBENGINE_NAME: Final = "webengine.name"
"""
The name of the web engine.
"""
WEBENGINE_VERSION: Final = "webengine.version"
"""
The version of the web engine.
"""

View File

@@ -0,0 +1,25 @@
# 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
ZOS_SMF_ID: Final = "zos.smf.id"
"""
The System Management Facility (SMF) Identifier uniquely identified a z/OS system within a SYSPLEX or mainframe environment and is used for system and performance analysis.
"""
ZOS_SYSPLEX_NAME: Final = "zos.sysplex.name"
"""
The name of the SYSPLEX to which the z/OS system belongs too.
"""

View File

@@ -0,0 +1,59 @@
# 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
from opentelemetry.metrics import Histogram, Meter, UpDownCounter
AZURE_COSMOSDB_CLIENT_ACTIVE_INSTANCE_COUNT: Final = (
"azure.cosmosdb.client.active_instance.count"
)
"""
Number of active client instances
Instrument: updowncounter
Unit: {instance}
"""
def create_azure_cosmosdb_client_active_instance_count(
meter: Meter,
) -> UpDownCounter:
"""Number of active client instances"""
return meter.create_up_down_counter(
name=AZURE_COSMOSDB_CLIENT_ACTIVE_INSTANCE_COUNT,
description="Number of active client instances.",
unit="{instance}",
)
AZURE_COSMOSDB_CLIENT_OPERATION_REQUEST_CHARGE: Final = (
"azure.cosmosdb.client.operation.request_charge"
)
"""
[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation
Instrument: histogram
Unit: {request_unit}
"""
def create_azure_cosmosdb_client_operation_request_charge(
meter: Meter,
) -> Histogram:
"""[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation"""
return meter.create_histogram(
name=AZURE_COSMOSDB_CLIENT_OPERATION_REQUEST_CHARGE,
description="[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation.",
unit="{request_unit}",
)

View File

@@ -0,0 +1,105 @@
# 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
from opentelemetry.metrics import Counter, Histogram, Meter, UpDownCounter
CICD_PIPELINE_RUN_ACTIVE: Final = "cicd.pipeline.run.active"
"""
The number of pipeline runs currently active in the system by state
Instrument: updowncounter
Unit: {run}
"""
def create_cicd_pipeline_run_active(meter: Meter) -> UpDownCounter:
"""The number of pipeline runs currently active in the system by state"""
return meter.create_up_down_counter(
name=CICD_PIPELINE_RUN_ACTIVE,
description="The number of pipeline runs currently active in the system by state.",
unit="{run}",
)
CICD_PIPELINE_RUN_DURATION: Final = "cicd.pipeline.run.duration"
"""
Duration of a pipeline run grouped by pipeline, state and result
Instrument: histogram
Unit: s
"""
def create_cicd_pipeline_run_duration(meter: Meter) -> Histogram:
"""Duration of a pipeline run grouped by pipeline, state and result"""
return meter.create_histogram(
name=CICD_PIPELINE_RUN_DURATION,
description="Duration of a pipeline run grouped by pipeline, state and result.",
unit="s",
)
CICD_PIPELINE_RUN_ERRORS: Final = "cicd.pipeline.run.errors"
"""
The number of errors encountered in pipeline runs (eg. compile, test failures)
Instrument: counter
Unit: {error}
Note: There might be errors in a pipeline run that are non fatal (eg. they are suppressed) or in a parallel stage multiple stages could have a fatal error.
This means that this error count might not be the same as the count of metric `cicd.pipeline.run.duration` with run result `failure`.
"""
def create_cicd_pipeline_run_errors(meter: Meter) -> Counter:
"""The number of errors encountered in pipeline runs (eg. compile, test failures)"""
return meter.create_counter(
name=CICD_PIPELINE_RUN_ERRORS,
description="The number of errors encountered in pipeline runs (eg. compile, test failures).",
unit="{error}",
)
CICD_SYSTEM_ERRORS: Final = "cicd.system.errors"
"""
The number of errors in a component of the CICD system (eg. controller, scheduler, agent)
Instrument: counter
Unit: {error}
Note: Errors in pipeline run execution are explicitly excluded. Ie a test failure is not counted in this metric.
"""
def create_cicd_system_errors(meter: Meter) -> Counter:
"""The number of errors in a component of the CICD system (eg. controller, scheduler, agent)"""
return meter.create_counter(
name=CICD_SYSTEM_ERRORS,
description="The number of errors in a component of the CICD system (eg. controller, scheduler, agent).",
unit="{error}",
)
CICD_WORKER_COUNT: Final = "cicd.worker.count"
"""
The number of workers on the CICD system by state
Instrument: updowncounter
Unit: {count}
"""
def create_cicd_worker_count(meter: Meter) -> UpDownCounter:
"""The number of workers on the CICD system by state"""
return meter.create_up_down_counter(
name=CICD_WORKER_COUNT,
description="The number of workers on the CICD system by state.",
unit="{count}",
)

View File

@@ -0,0 +1,218 @@
# 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 (
Callable,
Final,
Generator,
Iterable,
Optional,
Sequence,
Union,
)
from opentelemetry.metrics import (
CallbackOptions,
Counter,
Meter,
ObservableGauge,
Observation,
UpDownCounter,
)
# pylint: disable=invalid-name
CallbackT = Union[
Callable[[CallbackOptions], Iterable[Observation]],
Generator[Iterable[Observation], CallbackOptions, None],
]
CONTAINER_CPU_TIME: Final = "container.cpu.time"
"""
Total CPU time consumed
Instrument: counter
Unit: s
Note: Total CPU time consumed by the specific container on all available CPU cores.
"""
def create_container_cpu_time(meter: Meter) -> Counter:
"""Total CPU time consumed"""
return meter.create_counter(
name=CONTAINER_CPU_TIME,
description="Total CPU time consumed.",
unit="s",
)
CONTAINER_CPU_USAGE: Final = "container.cpu.usage"
"""
Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs
Instrument: gauge
Unit: {cpu}
Note: CPU usage of the specific container on all available CPU cores, averaged over the sample window.
"""
def create_container_cpu_usage(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs"""
return meter.create_observable_gauge(
name=CONTAINER_CPU_USAGE,
callbacks=callbacks,
description="Container's CPU usage, measured in cpus. Range from 0 to the number of allocatable CPUs.",
unit="{cpu}",
)
CONTAINER_DISK_IO: Final = "container.disk.io"
"""
Disk bytes for the container
Instrument: counter
Unit: By
Note: The total number of bytes read/written successfully (aggregated from all disks).
"""
def create_container_disk_io(meter: Meter) -> Counter:
"""Disk bytes for the container"""
return meter.create_counter(
name=CONTAINER_DISK_IO,
description="Disk bytes for the container.",
unit="By",
)
CONTAINER_FILESYSTEM_AVAILABLE: Final = "container.filesystem.available"
"""
Container filesystem available bytes
Instrument: updowncounter
Unit: By
Note: In K8s, this metric is derived from the
[FsStats.AvailableBytes](https://pkg.go.dev/k8s.io/kubelet@v0.33.0/pkg/apis/stats/v1alpha1#FsStats) field
of the [ContainerStats.Rootfs](https://pkg.go.dev/k8s.io/kubelet@v0.33.0/pkg/apis/stats/v1alpha1#ContainerStats)
of the Kubelet's stats API.
"""
def create_container_filesystem_available(meter: Meter) -> UpDownCounter:
"""Container filesystem available bytes"""
return meter.create_up_down_counter(
name=CONTAINER_FILESYSTEM_AVAILABLE,
description="Container filesystem available bytes.",
unit="By",
)
CONTAINER_FILESYSTEM_CAPACITY: Final = "container.filesystem.capacity"
"""
Container filesystem capacity
Instrument: updowncounter
Unit: By
Note: In K8s, this metric is derived from the
[FsStats.CapacityBytes](https://pkg.go.dev/k8s.io/kubelet@v0.33.0/pkg/apis/stats/v1alpha1#FsStats) field
of the [ContainerStats.Rootfs](https://pkg.go.dev/k8s.io/kubelet@v0.33.0/pkg/apis/stats/v1alpha1#ContainerStats)
of the Kubelet's stats API.
"""
def create_container_filesystem_capacity(meter: Meter) -> UpDownCounter:
"""Container filesystem capacity"""
return meter.create_up_down_counter(
name=CONTAINER_FILESYSTEM_CAPACITY,
description="Container filesystem capacity.",
unit="By",
)
CONTAINER_FILESYSTEM_USAGE: Final = "container.filesystem.usage"
"""
Container filesystem usage
Instrument: updowncounter
Unit: By
Note: This may not equal capacity - available.
In K8s, this metric is derived from the
[FsStats.UsedBytes](https://pkg.go.dev/k8s.io/kubelet@v0.33.0/pkg/apis/stats/v1alpha1#FsStats) field
of the [ContainerStats.Rootfs](https://pkg.go.dev/k8s.io/kubelet@v0.33.0/pkg/apis/stats/v1alpha1#ContainerStats)
of the Kubelet's stats API.
"""
def create_container_filesystem_usage(meter: Meter) -> UpDownCounter:
"""Container filesystem usage"""
return meter.create_up_down_counter(
name=CONTAINER_FILESYSTEM_USAGE,
description="Container filesystem usage.",
unit="By",
)
CONTAINER_MEMORY_USAGE: Final = "container.memory.usage"
"""
Memory usage of the container
Instrument: counter
Unit: By
Note: Memory usage of the container.
"""
def create_container_memory_usage(meter: Meter) -> Counter:
"""Memory usage of the container"""
return meter.create_counter(
name=CONTAINER_MEMORY_USAGE,
description="Memory usage of the container.",
unit="By",
)
CONTAINER_NETWORK_IO: Final = "container.network.io"
"""
Network bytes for the container
Instrument: counter
Unit: By
Note: The number of bytes sent/received on all network interfaces by the container.
"""
def create_container_network_io(meter: Meter) -> Counter:
"""Network bytes for the container"""
return meter.create_counter(
name=CONTAINER_NETWORK_IO,
description="Network bytes for the container.",
unit="By",
)
CONTAINER_UPTIME: Final = "container.uptime"
"""
The time the container has been running
Instrument: gauge
Unit: s
Note: Instrumentations SHOULD use a gauge with type `double` and measure uptime in seconds as a floating point number with the highest precision available.
The actual accuracy would depend on the instrumentation and operating system.
"""
def create_container_uptime(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""The time the container has been running"""
return meter.create_observable_gauge(
name=CONTAINER_UPTIME,
callbacks=callbacks,
description="The time the container has been running.",
unit="s",
)

View File

@@ -0,0 +1,88 @@
# 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 (
Callable,
Final,
Generator,
Iterable,
Optional,
Sequence,
Union,
)
from opentelemetry.metrics import (
CallbackOptions,
Counter,
Meter,
ObservableGauge,
Observation,
)
# pylint: disable=invalid-name
CallbackT = Union[
Callable[[CallbackOptions], Iterable[Observation]],
Generator[Iterable[Observation], CallbackOptions, None],
]
CPU_FREQUENCY: Final = "cpu.frequency"
"""
Deprecated: Replaced by `system.cpu.frequency`.
"""
def create_cpu_frequency(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Deprecated. Use `system.cpu.frequency` instead"""
return meter.create_observable_gauge(
name=CPU_FREQUENCY,
callbacks=callbacks,
description="Deprecated. Use `system.cpu.frequency` instead.",
unit="{Hz}",
)
CPU_TIME: Final = "cpu.time"
"""
Deprecated: Replaced by `system.cpu.time`.
"""
def create_cpu_time(meter: Meter) -> Counter:
"""Deprecated. Use `system.cpu.time` instead"""
return meter.create_counter(
name=CPU_TIME,
description="Deprecated. Use `system.cpu.time` instead.",
unit="s",
)
CPU_UTILIZATION: Final = "cpu.utilization"
"""
Deprecated: Replaced by `system.cpu.utilization`.
"""
def create_cpu_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Deprecated. Use `system.cpu.utilization` instead"""
return meter.create_observable_gauge(
name=CPU_UTILIZATION,
callbacks=callbacks,
description="Deprecated. Use `system.cpu.utilization` instead.",
unit="1",
)

View File

@@ -0,0 +1,71 @@
# 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
from opentelemetry.metrics import Counter, Meter
CPYTHON_GC_COLLECTED_OBJECTS: Final = "cpython.gc.collected_objects"
"""
The total number of objects collected inside a generation since interpreter start
Instrument: counter
Unit: {object}
Note: This metric reports data from [`gc.stats()`](https://docs.python.org/3/library/gc.html#gc.get_stats).
"""
def create_cpython_gc_collected_objects(meter: Meter) -> Counter:
"""The total number of objects collected inside a generation since interpreter start"""
return meter.create_counter(
name=CPYTHON_GC_COLLECTED_OBJECTS,
description="The total number of objects collected inside a generation since interpreter start.",
unit="{object}",
)
CPYTHON_GC_COLLECTIONS: Final = "cpython.gc.collections"
"""
The number of times a generation was collected since interpreter start
Instrument: counter
Unit: {collection}
Note: This metric reports data from [`gc.stats()`](https://docs.python.org/3/library/gc.html#gc.get_stats).
"""
def create_cpython_gc_collections(meter: Meter) -> Counter:
"""The number of times a generation was collected since interpreter start"""
return meter.create_counter(
name=CPYTHON_GC_COLLECTIONS,
description="The number of times a generation was collected since interpreter start.",
unit="{collection}",
)
CPYTHON_GC_UNCOLLECTABLE_OBJECTS: Final = "cpython.gc.uncollectable_objects"
"""
The total number of objects which were found to be uncollectable inside a generation since interpreter start
Instrument: counter
Unit: {object}
Note: This metric reports data from [`gc.stats()`](https://docs.python.org/3/library/gc.html#gc.get_stats).
"""
def create_cpython_gc_uncollectable_objects(meter: Meter) -> Counter:
"""The total number of objects which were found to be uncollectable inside a generation since interpreter start"""
return meter.create_counter(
name=CPYTHON_GC_UNCOLLECTABLE_OBJECTS,
description="The total number of objects which were found to be uncollectable inside a generation since interpreter start.",
unit="{object}",
)

View File

@@ -0,0 +1,383 @@
# 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
from opentelemetry.metrics import Counter, Histogram, Meter, UpDownCounter
DB_CLIENT_CONNECTION_COUNT: Final = "db.client.connection.count"
"""
The number of connections that are currently in state described by the `state` attribute
Instrument: updowncounter
Unit: {connection}
"""
def create_db_client_connection_count(meter: Meter) -> UpDownCounter:
"""The number of connections that are currently in state described by the `state` attribute"""
return meter.create_up_down_counter(
name=DB_CLIENT_CONNECTION_COUNT,
description="The number of connections that are currently in state described by the `state` attribute.",
unit="{connection}",
)
DB_CLIENT_CONNECTION_CREATE_TIME: Final = "db.client.connection.create_time"
"""
The time it took to create a new connection
Instrument: histogram
Unit: s
"""
def create_db_client_connection_create_time(meter: Meter) -> Histogram:
"""The time it took to create a new connection"""
return meter.create_histogram(
name=DB_CLIENT_CONNECTION_CREATE_TIME,
description="The time it took to create a new connection.",
unit="s",
)
DB_CLIENT_CONNECTION_IDLE_MAX: Final = "db.client.connection.idle.max"
"""
The maximum number of idle open connections allowed
Instrument: updowncounter
Unit: {connection}
"""
def create_db_client_connection_idle_max(meter: Meter) -> UpDownCounter:
"""The maximum number of idle open connections allowed"""
return meter.create_up_down_counter(
name=DB_CLIENT_CONNECTION_IDLE_MAX,
description="The maximum number of idle open connections allowed.",
unit="{connection}",
)
DB_CLIENT_CONNECTION_IDLE_MIN: Final = "db.client.connection.idle.min"
"""
The minimum number of idle open connections allowed
Instrument: updowncounter
Unit: {connection}
"""
def create_db_client_connection_idle_min(meter: Meter) -> UpDownCounter:
"""The minimum number of idle open connections allowed"""
return meter.create_up_down_counter(
name=DB_CLIENT_CONNECTION_IDLE_MIN,
description="The minimum number of idle open connections allowed.",
unit="{connection}",
)
DB_CLIENT_CONNECTION_MAX: Final = "db.client.connection.max"
"""
The maximum number of open connections allowed
Instrument: updowncounter
Unit: {connection}
"""
def create_db_client_connection_max(meter: Meter) -> UpDownCounter:
"""The maximum number of open connections allowed"""
return meter.create_up_down_counter(
name=DB_CLIENT_CONNECTION_MAX,
description="The maximum number of open connections allowed.",
unit="{connection}",
)
DB_CLIENT_CONNECTION_PENDING_REQUESTS: Final = (
"db.client.connection.pending_requests"
)
"""
The number of current pending requests for an open connection
Instrument: updowncounter
Unit: {request}
"""
def create_db_client_connection_pending_requests(
meter: Meter,
) -> UpDownCounter:
"""The number of current pending requests for an open connection"""
return meter.create_up_down_counter(
name=DB_CLIENT_CONNECTION_PENDING_REQUESTS,
description="The number of current pending requests for an open connection.",
unit="{request}",
)
DB_CLIENT_CONNECTION_TIMEOUTS: Final = "db.client.connection.timeouts"
"""
The number of connection timeouts that have occurred trying to obtain a connection from the pool
Instrument: counter
Unit: {timeout}
"""
def create_db_client_connection_timeouts(meter: Meter) -> Counter:
"""The number of connection timeouts that have occurred trying to obtain a connection from the pool"""
return meter.create_counter(
name=DB_CLIENT_CONNECTION_TIMEOUTS,
description="The number of connection timeouts that have occurred trying to obtain a connection from the pool.",
unit="{timeout}",
)
DB_CLIENT_CONNECTION_USE_TIME: Final = "db.client.connection.use_time"
"""
The time between borrowing a connection and returning it to the pool
Instrument: histogram
Unit: s
"""
def create_db_client_connection_use_time(meter: Meter) -> Histogram:
"""The time between borrowing a connection and returning it to the pool"""
return meter.create_histogram(
name=DB_CLIENT_CONNECTION_USE_TIME,
description="The time between borrowing a connection and returning it to the pool.",
unit="s",
)
DB_CLIENT_CONNECTION_WAIT_TIME: Final = "db.client.connection.wait_time"
"""
The time it took to obtain an open connection from the pool
Instrument: histogram
Unit: s
"""
def create_db_client_connection_wait_time(meter: Meter) -> Histogram:
"""The time it took to obtain an open connection from the pool"""
return meter.create_histogram(
name=DB_CLIENT_CONNECTION_WAIT_TIME,
description="The time it took to obtain an open connection from the pool.",
unit="s",
)
DB_CLIENT_CONNECTIONS_CREATE_TIME: Final = "db.client.connections.create_time"
"""
Deprecated: Replaced by `db.client.connection.create_time` with unit `s`.
"""
def create_db_client_connections_create_time(meter: Meter) -> Histogram:
"""Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from `ms` to `s`"""
return meter.create_histogram(
name=DB_CLIENT_CONNECTIONS_CREATE_TIME,
description="Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from `ms` to `s`.",
unit="ms",
)
DB_CLIENT_CONNECTIONS_IDLE_MAX: Final = "db.client.connections.idle.max"
"""
Deprecated: Replaced by `db.client.connection.idle.max`.
"""
def create_db_client_connections_idle_max(meter: Meter) -> UpDownCounter:
"""Deprecated, use `db.client.connection.idle.max` instead"""
return meter.create_up_down_counter(
name=DB_CLIENT_CONNECTIONS_IDLE_MAX,
description="Deprecated, use `db.client.connection.idle.max` instead.",
unit="{connection}",
)
DB_CLIENT_CONNECTIONS_IDLE_MIN: Final = "db.client.connections.idle.min"
"""
Deprecated: Replaced by `db.client.connection.idle.min`.
"""
def create_db_client_connections_idle_min(meter: Meter) -> UpDownCounter:
"""Deprecated, use `db.client.connection.idle.min` instead"""
return meter.create_up_down_counter(
name=DB_CLIENT_CONNECTIONS_IDLE_MIN,
description="Deprecated, use `db.client.connection.idle.min` instead.",
unit="{connection}",
)
DB_CLIENT_CONNECTIONS_MAX: Final = "db.client.connections.max"
"""
Deprecated: Replaced by `db.client.connection.max`.
"""
def create_db_client_connections_max(meter: Meter) -> UpDownCounter:
"""Deprecated, use `db.client.connection.max` instead"""
return meter.create_up_down_counter(
name=DB_CLIENT_CONNECTIONS_MAX,
description="Deprecated, use `db.client.connection.max` instead.",
unit="{connection}",
)
DB_CLIENT_CONNECTIONS_PENDING_REQUESTS: Final = (
"db.client.connections.pending_requests"
)
"""
Deprecated: Replaced by `db.client.connection.pending_requests`.
"""
def create_db_client_connections_pending_requests(
meter: Meter,
) -> UpDownCounter:
"""Deprecated, use `db.client.connection.pending_requests` instead"""
return meter.create_up_down_counter(
name=DB_CLIENT_CONNECTIONS_PENDING_REQUESTS,
description="Deprecated, use `db.client.connection.pending_requests` instead.",
unit="{request}",
)
DB_CLIENT_CONNECTIONS_TIMEOUTS: Final = "db.client.connections.timeouts"
"""
Deprecated: Replaced by `db.client.connection.timeouts`.
"""
def create_db_client_connections_timeouts(meter: Meter) -> Counter:
"""Deprecated, use `db.client.connection.timeouts` instead"""
return meter.create_counter(
name=DB_CLIENT_CONNECTIONS_TIMEOUTS,
description="Deprecated, use `db.client.connection.timeouts` instead.",
unit="{timeout}",
)
DB_CLIENT_CONNECTIONS_USAGE: Final = "db.client.connections.usage"
"""
Deprecated: Replaced by `db.client.connection.count`.
"""
def create_db_client_connections_usage(meter: Meter) -> UpDownCounter:
"""Deprecated, use `db.client.connection.count` instead"""
return meter.create_up_down_counter(
name=DB_CLIENT_CONNECTIONS_USAGE,
description="Deprecated, use `db.client.connection.count` instead.",
unit="{connection}",
)
DB_CLIENT_CONNECTIONS_USE_TIME: Final = "db.client.connections.use_time"
"""
Deprecated: Replaced by `db.client.connection.use_time` with unit `s`.
"""
def create_db_client_connections_use_time(meter: Meter) -> Histogram:
"""Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from `ms` to `s`"""
return meter.create_histogram(
name=DB_CLIENT_CONNECTIONS_USE_TIME,
description="Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from `ms` to `s`.",
unit="ms",
)
DB_CLIENT_CONNECTIONS_WAIT_TIME: Final = "db.client.connections.wait_time"
"""
Deprecated: Replaced by `db.client.connection.wait_time` with unit `s`.
"""
def create_db_client_connections_wait_time(meter: Meter) -> Histogram:
"""Deprecated, use `db.client.connection.wait_time` instead. Note: the unit also changed from `ms` to `s`"""
return meter.create_histogram(
name=DB_CLIENT_CONNECTIONS_WAIT_TIME,
description="Deprecated, use `db.client.connection.wait_time` instead. Note: the unit also changed from `ms` to `s`.",
unit="ms",
)
DB_CLIENT_COSMOSDB_ACTIVE_INSTANCE_COUNT: Final = (
"db.client.cosmosdb.active_instance.count"
)
"""
Deprecated: Replaced by `azure.cosmosdb.client.active_instance.count`.
"""
def create_db_client_cosmosdb_active_instance_count(
meter: Meter,
) -> UpDownCounter:
"""Deprecated, use `azure.cosmosdb.client.active_instance.count` instead"""
return meter.create_up_down_counter(
name=DB_CLIENT_COSMOSDB_ACTIVE_INSTANCE_COUNT,
description="Deprecated, use `azure.cosmosdb.client.active_instance.count` instead.",
unit="{instance}",
)
DB_CLIENT_COSMOSDB_OPERATION_REQUEST_CHARGE: Final = (
"db.client.cosmosdb.operation.request_charge"
)
"""
Deprecated: Replaced by `azure.cosmosdb.client.operation.request_charge`.
"""
def create_db_client_cosmosdb_operation_request_charge(
meter: Meter,
) -> Histogram:
"""Deprecated, use `azure.cosmosdb.client.operation.request_charge` instead"""
return meter.create_histogram(
name=DB_CLIENT_COSMOSDB_OPERATION_REQUEST_CHARGE,
description="Deprecated, use `azure.cosmosdb.client.operation.request_charge` instead.",
unit="{request_unit}",
)
DB_CLIENT_OPERATION_DURATION: Final = "db.client.operation.duration"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.metrics.db_metrics.DB_CLIENT_OPERATION_DURATION`.
"""
def create_db_client_operation_duration(meter: Meter) -> Histogram:
"""Duration of database client operations"""
return meter.create_histogram(
name=DB_CLIENT_OPERATION_DURATION,
description="Duration of database client operations.",
unit="s",
)
DB_CLIENT_RESPONSE_RETURNED_ROWS: Final = "db.client.response.returned_rows"
"""
The actual number of records returned by the database operation
Instrument: histogram
Unit: {row}
"""
def create_db_client_response_returned_rows(meter: Meter) -> Histogram:
"""The actual number of records returned by the database operation"""
return meter.create_histogram(
name=DB_CLIENT_RESPONSE_RETURNED_ROWS,
description="The actual number of records returned by the database operation.",
unit="{row}",
)

View File

@@ -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.
from typing import Final
from opentelemetry.metrics import Histogram, Meter
DNS_LOOKUP_DURATION: Final = "dns.lookup.duration"
"""
Measures the time taken to perform a DNS lookup
Instrument: histogram
Unit: s
"""
def create_dns_lookup_duration(meter: Meter) -> Histogram:
"""Measures the time taken to perform a DNS lookup"""
return meter.create_histogram(
name=DNS_LOOKUP_DURATION,
description="Measures the time taken to perform a DNS lookup.",
unit="s",
)

View File

@@ -0,0 +1,170 @@
# 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
from opentelemetry.metrics import Counter, Histogram, Meter
FAAS_COLDSTARTS: Final = "faas.coldstarts"
"""
Number of invocation cold starts
Instrument: counter
Unit: {coldstart}
"""
def create_faas_coldstarts(meter: Meter) -> Counter:
"""Number of invocation cold starts"""
return meter.create_counter(
name=FAAS_COLDSTARTS,
description="Number of invocation cold starts.",
unit="{coldstart}",
)
FAAS_CPU_USAGE: Final = "faas.cpu_usage"
"""
Distribution of CPU usage per invocation
Instrument: histogram
Unit: s
"""
def create_faas_cpu_usage(meter: Meter) -> Histogram:
"""Distribution of CPU usage per invocation"""
return meter.create_histogram(
name=FAAS_CPU_USAGE,
description="Distribution of CPU usage per invocation.",
unit="s",
)
FAAS_ERRORS: Final = "faas.errors"
"""
Number of invocation errors
Instrument: counter
Unit: {error}
"""
def create_faas_errors(meter: Meter) -> Counter:
"""Number of invocation errors"""
return meter.create_counter(
name=FAAS_ERRORS,
description="Number of invocation errors.",
unit="{error}",
)
FAAS_INIT_DURATION: Final = "faas.init_duration"
"""
Measures the duration of the function's initialization, such as a cold start
Instrument: histogram
Unit: s
"""
def create_faas_init_duration(meter: Meter) -> Histogram:
"""Measures the duration of the function's initialization, such as a cold start"""
return meter.create_histogram(
name=FAAS_INIT_DURATION,
description="Measures the duration of the function's initialization, such as a cold start.",
unit="s",
)
FAAS_INVOCATIONS: Final = "faas.invocations"
"""
Number of successful invocations
Instrument: counter
Unit: {invocation}
"""
def create_faas_invocations(meter: Meter) -> Counter:
"""Number of successful invocations"""
return meter.create_counter(
name=FAAS_INVOCATIONS,
description="Number of successful invocations.",
unit="{invocation}",
)
FAAS_INVOKE_DURATION: Final = "faas.invoke_duration"
"""
Measures the duration of the function's logic execution
Instrument: histogram
Unit: s
"""
def create_faas_invoke_duration(meter: Meter) -> Histogram:
"""Measures the duration of the function's logic execution"""
return meter.create_histogram(
name=FAAS_INVOKE_DURATION,
description="Measures the duration of the function's logic execution.",
unit="s",
)
FAAS_MEM_USAGE: Final = "faas.mem_usage"
"""
Distribution of max memory usage per invocation
Instrument: histogram
Unit: By
"""
def create_faas_mem_usage(meter: Meter) -> Histogram:
"""Distribution of max memory usage per invocation"""
return meter.create_histogram(
name=FAAS_MEM_USAGE,
description="Distribution of max memory usage per invocation.",
unit="By",
)
FAAS_NET_IO: Final = "faas.net_io"
"""
Distribution of net I/O usage per invocation
Instrument: histogram
Unit: By
"""
def create_faas_net_io(meter: Meter) -> Histogram:
"""Distribution of net I/O usage per invocation"""
return meter.create_histogram(
name=FAAS_NET_IO,
description="Distribution of net I/O usage per invocation.",
unit="By",
)
FAAS_TIMEOUTS: Final = "faas.timeouts"
"""
Number of invocation timeouts
Instrument: counter
Unit: {timeout}
"""
def create_faas_timeouts(meter: Meter) -> Counter:
"""Number of invocation timeouts"""
return meter.create_counter(
name=FAAS_TIMEOUTS,
description="Number of invocation timeouts.",
unit="{timeout}",
)

View File

@@ -0,0 +1,104 @@
# 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
from opentelemetry.metrics import Histogram, Meter
GEN_AI_CLIENT_OPERATION_DURATION: Final = "gen_ai.client.operation.duration"
"""
GenAI operation duration
Instrument: histogram
Unit: s
"""
def create_gen_ai_client_operation_duration(meter: Meter) -> Histogram:
"""GenAI operation duration"""
return meter.create_histogram(
name=GEN_AI_CLIENT_OPERATION_DURATION,
description="GenAI operation duration.",
unit="s",
)
GEN_AI_CLIENT_TOKEN_USAGE: Final = "gen_ai.client.token.usage"
"""
Number of input and output tokens used
Instrument: histogram
Unit: {token}
"""
def create_gen_ai_client_token_usage(meter: Meter) -> Histogram:
"""Number of input and output tokens used"""
return meter.create_histogram(
name=GEN_AI_CLIENT_TOKEN_USAGE,
description="Number of input and output tokens used.",
unit="{token}",
)
GEN_AI_SERVER_REQUEST_DURATION: Final = "gen_ai.server.request.duration"
"""
Generative AI server request duration such as time-to-last byte or last output token
Instrument: histogram
Unit: s
"""
def create_gen_ai_server_request_duration(meter: Meter) -> Histogram:
"""Generative AI server request duration such as time-to-last byte or last output token"""
return meter.create_histogram(
name=GEN_AI_SERVER_REQUEST_DURATION,
description="Generative AI server request duration such as time-to-last byte or last output token.",
unit="s",
)
GEN_AI_SERVER_TIME_PER_OUTPUT_TOKEN: Final = (
"gen_ai.server.time_per_output_token"
)
"""
Time per output token generated after the first token for successful responses
Instrument: histogram
Unit: s
"""
def create_gen_ai_server_time_per_output_token(meter: Meter) -> Histogram:
"""Time per output token generated after the first token for successful responses"""
return meter.create_histogram(
name=GEN_AI_SERVER_TIME_PER_OUTPUT_TOKEN,
description="Time per output token generated after the first token for successful responses.",
unit="s",
)
GEN_AI_SERVER_TIME_TO_FIRST_TOKEN: Final = "gen_ai.server.time_to_first_token"
"""
Time to generate first token for successful responses
Instrument: histogram
Unit: s
"""
def create_gen_ai_server_time_to_first_token(meter: Meter) -> Histogram:
"""Time to generate first token for successful responses"""
return meter.create_histogram(
name=GEN_AI_SERVER_TIME_TO_FIRST_TOKEN,
description="Time to generate first token for successful responses.",
unit="s",
)

View File

@@ -0,0 +1,187 @@
# 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
from opentelemetry.metrics import Histogram, Meter, UpDownCounter
HTTP_CLIENT_ACTIVE_REQUESTS: Final = "http.client.active_requests"
"""
Number of active HTTP requests
Instrument: updowncounter
Unit: {request}
"""
def create_http_client_active_requests(meter: Meter) -> UpDownCounter:
"""Number of active HTTP requests"""
return meter.create_up_down_counter(
name=HTTP_CLIENT_ACTIVE_REQUESTS,
description="Number of active HTTP requests.",
unit="{request}",
)
HTTP_CLIENT_CONNECTION_DURATION: Final = "http.client.connection.duration"
"""
The duration of the successfully established outbound HTTP connections
Instrument: histogram
Unit: s
"""
def create_http_client_connection_duration(meter: Meter) -> Histogram:
"""The duration of the successfully established outbound HTTP connections"""
return meter.create_histogram(
name=HTTP_CLIENT_CONNECTION_DURATION,
description="The duration of the successfully established outbound HTTP connections.",
unit="s",
)
HTTP_CLIENT_OPEN_CONNECTIONS: Final = "http.client.open_connections"
"""
Number of outbound HTTP connections that are currently active or idle on the client
Instrument: updowncounter
Unit: {connection}
"""
def create_http_client_open_connections(meter: Meter) -> UpDownCounter:
"""Number of outbound HTTP connections that are currently active or idle on the client"""
return meter.create_up_down_counter(
name=HTTP_CLIENT_OPEN_CONNECTIONS,
description="Number of outbound HTTP connections that are currently active or idle on the client.",
unit="{connection}",
)
HTTP_CLIENT_REQUEST_BODY_SIZE: Final = "http.client.request.body.size"
"""
Size of HTTP client request bodies
Instrument: histogram
Unit: By
Note: 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.
"""
def create_http_client_request_body_size(meter: Meter) -> Histogram:
"""Size of HTTP client request bodies"""
return meter.create_histogram(
name=HTTP_CLIENT_REQUEST_BODY_SIZE,
description="Size of HTTP client request bodies.",
unit="By",
)
HTTP_CLIENT_REQUEST_DURATION: Final = "http.client.request.duration"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.metrics.http_metrics.HTTP_CLIENT_REQUEST_DURATION`.
"""
def create_http_client_request_duration(meter: Meter) -> Histogram:
"""Duration of HTTP client requests"""
return meter.create_histogram(
name=HTTP_CLIENT_REQUEST_DURATION,
description="Duration of HTTP client requests.",
unit="s",
)
HTTP_CLIENT_RESPONSE_BODY_SIZE: Final = "http.client.response.body.size"
"""
Size of HTTP client response bodies
Instrument: histogram
Unit: By
Note: 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.
"""
def create_http_client_response_body_size(meter: Meter) -> Histogram:
"""Size of HTTP client response bodies"""
return meter.create_histogram(
name=HTTP_CLIENT_RESPONSE_BODY_SIZE,
description="Size of HTTP client response bodies.",
unit="By",
)
HTTP_SERVER_ACTIVE_REQUESTS: Final = "http.server.active_requests"
"""
Number of active HTTP server requests
Instrument: updowncounter
Unit: {request}
"""
def create_http_server_active_requests(meter: Meter) -> UpDownCounter:
"""Number of active HTTP server requests"""
return meter.create_up_down_counter(
name=HTTP_SERVER_ACTIVE_REQUESTS,
description="Number of active HTTP server requests.",
unit="{request}",
)
HTTP_SERVER_REQUEST_BODY_SIZE: Final = "http.server.request.body.size"
"""
Size of HTTP server request bodies
Instrument: histogram
Unit: By
Note: 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.
"""
def create_http_server_request_body_size(meter: Meter) -> Histogram:
"""Size of HTTP server request bodies"""
return meter.create_histogram(
name=HTTP_SERVER_REQUEST_BODY_SIZE,
description="Size of HTTP server request bodies.",
unit="By",
)
HTTP_SERVER_REQUEST_DURATION: Final = "http.server.request.duration"
"""
Deprecated in favor of stable :py:const:`opentelemetry.semconv.metrics.http_metrics.HTTP_SERVER_REQUEST_DURATION`.
"""
def create_http_server_request_duration(meter: Meter) -> Histogram:
"""Duration of HTTP server requests"""
return meter.create_histogram(
name=HTTP_SERVER_REQUEST_DURATION,
description="Duration of HTTP server requests.",
unit="s",
)
HTTP_SERVER_RESPONSE_BODY_SIZE: Final = "http.server.response.body.size"
"""
Size of HTTP server response bodies
Instrument: histogram
Unit: By
Note: 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.
"""
def create_http_server_response_body_size(meter: Meter) -> Histogram:
"""Size of HTTP server response bodies"""
return meter.create_histogram(
name=HTTP_SERVER_RESPONSE_BODY_SIZE,
description="Size of HTTP server response bodies.",
unit="By",
)

View File

@@ -0,0 +1,830 @@
# 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 (
Callable,
Final,
Generator,
Iterable,
Optional,
Sequence,
Union,
)
from opentelemetry.metrics import (
CallbackOptions,
Counter,
Meter,
ObservableGauge,
Observation,
UpDownCounter,
)
# pylint: disable=invalid-name
CallbackT = Union[
Callable[[CallbackOptions], Iterable[Observation]],
Generator[Iterable[Observation], CallbackOptions, None],
]
HW_BATTERY_CHARGE: Final = "hw.battery.charge"
"""
Remaining fraction of battery charge
Instrument: gauge
Unit: 1
"""
def create_hw_battery_charge(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Remaining fraction of battery charge"""
return meter.create_observable_gauge(
name=HW_BATTERY_CHARGE,
callbacks=callbacks,
description="Remaining fraction of battery charge.",
unit="1",
)
HW_BATTERY_CHARGE_LIMIT: Final = "hw.battery.charge.limit"
"""
Lower limit of battery charge fraction to ensure proper operation
Instrument: gauge
Unit: 1
"""
def create_hw_battery_charge_limit(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Lower limit of battery charge fraction to ensure proper operation"""
return meter.create_observable_gauge(
name=HW_BATTERY_CHARGE_LIMIT,
callbacks=callbacks,
description="Lower limit of battery charge fraction to ensure proper operation.",
unit="1",
)
HW_BATTERY_TIME_LEFT: Final = "hw.battery.time_left"
"""
Time left before battery is completely charged or discharged
Instrument: gauge
Unit: s
"""
def create_hw_battery_time_left(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Time left before battery is completely charged or discharged"""
return meter.create_observable_gauge(
name=HW_BATTERY_TIME_LEFT,
callbacks=callbacks,
description="Time left before battery is completely charged or discharged.",
unit="s",
)
HW_CPU_SPEED: Final = "hw.cpu.speed"
"""
CPU current frequency
Instrument: gauge
Unit: Hz
"""
def create_hw_cpu_speed(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""CPU current frequency"""
return meter.create_observable_gauge(
name=HW_CPU_SPEED,
callbacks=callbacks,
description="CPU current frequency.",
unit="Hz",
)
HW_CPU_SPEED_LIMIT: Final = "hw.cpu.speed.limit"
"""
CPU maximum frequency
Instrument: gauge
Unit: Hz
"""
def create_hw_cpu_speed_limit(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""CPU maximum frequency"""
return meter.create_observable_gauge(
name=HW_CPU_SPEED_LIMIT,
callbacks=callbacks,
description="CPU maximum frequency.",
unit="Hz",
)
HW_ENERGY: Final = "hw.energy"
"""
Energy consumed by the component
Instrument: counter
Unit: J
"""
def create_hw_energy(meter: Meter) -> Counter:
"""Energy consumed by the component"""
return meter.create_counter(
name=HW_ENERGY,
description="Energy consumed by the component.",
unit="J",
)
HW_ERRORS: Final = "hw.errors"
"""
Number of errors encountered by the component
Instrument: counter
Unit: {error}
"""
def create_hw_errors(meter: Meter) -> Counter:
"""Number of errors encountered by the component"""
return meter.create_counter(
name=HW_ERRORS,
description="Number of errors encountered by the component.",
unit="{error}",
)
HW_FAN_SPEED: Final = "hw.fan.speed"
"""
Fan speed in revolutions per minute
Instrument: gauge
Unit: rpm
"""
def create_hw_fan_speed(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Fan speed in revolutions per minute"""
return meter.create_observable_gauge(
name=HW_FAN_SPEED,
callbacks=callbacks,
description="Fan speed in revolutions per minute.",
unit="rpm",
)
HW_FAN_SPEED_LIMIT: Final = "hw.fan.speed.limit"
"""
Speed limit in rpm
Instrument: gauge
Unit: rpm
"""
def create_hw_fan_speed_limit(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Speed limit in rpm"""
return meter.create_observable_gauge(
name=HW_FAN_SPEED_LIMIT,
callbacks=callbacks,
description="Speed limit in rpm.",
unit="rpm",
)
HW_FAN_SPEED_RATIO: Final = "hw.fan.speed_ratio"
"""
Fan speed expressed as a fraction of its maximum speed
Instrument: gauge
Unit: 1
"""
def create_hw_fan_speed_ratio(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Fan speed expressed as a fraction of its maximum speed"""
return meter.create_observable_gauge(
name=HW_FAN_SPEED_RATIO,
callbacks=callbacks,
description="Fan speed expressed as a fraction of its maximum speed.",
unit="1",
)
HW_GPU_IO: Final = "hw.gpu.io"
"""
Received and transmitted bytes by the GPU
Instrument: counter
Unit: By
"""
def create_hw_gpu_io(meter: Meter) -> Counter:
"""Received and transmitted bytes by the GPU"""
return meter.create_counter(
name=HW_GPU_IO,
description="Received and transmitted bytes by the GPU.",
unit="By",
)
HW_GPU_MEMORY_LIMIT: Final = "hw.gpu.memory.limit"
"""
Size of the GPU memory
Instrument: updowncounter
Unit: By
"""
def create_hw_gpu_memory_limit(meter: Meter) -> UpDownCounter:
"""Size of the GPU memory"""
return meter.create_up_down_counter(
name=HW_GPU_MEMORY_LIMIT,
description="Size of the GPU memory.",
unit="By",
)
HW_GPU_MEMORY_USAGE: Final = "hw.gpu.memory.usage"
"""
GPU memory used
Instrument: updowncounter
Unit: By
"""
def create_hw_gpu_memory_usage(meter: Meter) -> UpDownCounter:
"""GPU memory used"""
return meter.create_up_down_counter(
name=HW_GPU_MEMORY_USAGE,
description="GPU memory used.",
unit="By",
)
HW_GPU_MEMORY_UTILIZATION: Final = "hw.gpu.memory.utilization"
"""
Fraction of GPU memory used
Instrument: gauge
Unit: 1
"""
def create_hw_gpu_memory_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Fraction of GPU memory used"""
return meter.create_observable_gauge(
name=HW_GPU_MEMORY_UTILIZATION,
callbacks=callbacks,
description="Fraction of GPU memory used.",
unit="1",
)
HW_GPU_UTILIZATION: Final = "hw.gpu.utilization"
"""
Fraction of time spent in a specific task
Instrument: gauge
Unit: 1
"""
def create_hw_gpu_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Fraction of time spent in a specific task"""
return meter.create_observable_gauge(
name=HW_GPU_UTILIZATION,
callbacks=callbacks,
description="Fraction of time spent in a specific task.",
unit="1",
)
HW_HOST_AMBIENT_TEMPERATURE: Final = "hw.host.ambient_temperature"
"""
Ambient (external) temperature of the physical host
Instrument: gauge
Unit: Cel
"""
def create_hw_host_ambient_temperature(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Ambient (external) temperature of the physical host"""
return meter.create_observable_gauge(
name=HW_HOST_AMBIENT_TEMPERATURE,
callbacks=callbacks,
description="Ambient (external) temperature of the physical host.",
unit="Cel",
)
HW_HOST_ENERGY: Final = "hw.host.energy"
"""
Total energy consumed by the entire physical host, in joules
Instrument: counter
Unit: J
Note: The overall energy usage of a host MUST be reported using the specific `hw.host.energy` and `hw.host.power` metrics **only**, instead of the generic `hw.energy` and `hw.power` described in the previous section, to prevent summing up overlapping values.
"""
def create_hw_host_energy(meter: Meter) -> Counter:
"""Total energy consumed by the entire physical host, in joules"""
return meter.create_counter(
name=HW_HOST_ENERGY,
description="Total energy consumed by the entire physical host, in joules.",
unit="J",
)
HW_HOST_HEATING_MARGIN: Final = "hw.host.heating_margin"
"""
By how many degrees Celsius the temperature of the physical host can be increased, before reaching a warning threshold on one of the internal sensors
Instrument: gauge
Unit: Cel
"""
def create_hw_host_heating_margin(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""By how many degrees Celsius the temperature of the physical host can be increased, before reaching a warning threshold on one of the internal sensors"""
return meter.create_observable_gauge(
name=HW_HOST_HEATING_MARGIN,
callbacks=callbacks,
description="By how many degrees Celsius the temperature of the physical host can be increased, before reaching a warning threshold on one of the internal sensors.",
unit="Cel",
)
HW_HOST_POWER: Final = "hw.host.power"
"""
Instantaneous power consumed by the entire physical host in Watts (`hw.host.energy` is preferred)
Instrument: gauge
Unit: W
Note: The overall energy usage of a host MUST be reported using the specific `hw.host.energy` and `hw.host.power` metrics **only**, instead of the generic `hw.energy` and `hw.power` described in the previous section, to prevent summing up overlapping values.
"""
def create_hw_host_power(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Instantaneous power consumed by the entire physical host in Watts (`hw.host.energy` is preferred)"""
return meter.create_observable_gauge(
name=HW_HOST_POWER,
callbacks=callbacks,
description="Instantaneous power consumed by the entire physical host in Watts (`hw.host.energy` is preferred).",
unit="W",
)
HW_LOGICAL_DISK_LIMIT: Final = "hw.logical_disk.limit"
"""
Size of the logical disk
Instrument: updowncounter
Unit: By
"""
def create_hw_logical_disk_limit(meter: Meter) -> UpDownCounter:
"""Size of the logical disk"""
return meter.create_up_down_counter(
name=HW_LOGICAL_DISK_LIMIT,
description="Size of the logical disk.",
unit="By",
)
HW_LOGICAL_DISK_USAGE: Final = "hw.logical_disk.usage"
"""
Logical disk space usage
Instrument: updowncounter
Unit: By
"""
def create_hw_logical_disk_usage(meter: Meter) -> UpDownCounter:
"""Logical disk space usage"""
return meter.create_up_down_counter(
name=HW_LOGICAL_DISK_USAGE,
description="Logical disk space usage.",
unit="By",
)
HW_LOGICAL_DISK_UTILIZATION: Final = "hw.logical_disk.utilization"
"""
Logical disk space utilization as a fraction
Instrument: gauge
Unit: 1
"""
def create_hw_logical_disk_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Logical disk space utilization as a fraction"""
return meter.create_observable_gauge(
name=HW_LOGICAL_DISK_UTILIZATION,
callbacks=callbacks,
description="Logical disk space utilization as a fraction.",
unit="1",
)
HW_MEMORY_SIZE: Final = "hw.memory.size"
"""
Size of the memory module
Instrument: updowncounter
Unit: By
"""
def create_hw_memory_size(meter: Meter) -> UpDownCounter:
"""Size of the memory module"""
return meter.create_up_down_counter(
name=HW_MEMORY_SIZE,
description="Size of the memory module.",
unit="By",
)
HW_NETWORK_BANDWIDTH_LIMIT: Final = "hw.network.bandwidth.limit"
"""
Link speed
Instrument: updowncounter
Unit: By/s
"""
def create_hw_network_bandwidth_limit(meter: Meter) -> UpDownCounter:
"""Link speed"""
return meter.create_up_down_counter(
name=HW_NETWORK_BANDWIDTH_LIMIT,
description="Link speed.",
unit="By/s",
)
HW_NETWORK_BANDWIDTH_UTILIZATION: Final = "hw.network.bandwidth.utilization"
"""
Utilization of the network bandwidth as a fraction
Instrument: gauge
Unit: 1
"""
def create_hw_network_bandwidth_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Utilization of the network bandwidth as a fraction"""
return meter.create_observable_gauge(
name=HW_NETWORK_BANDWIDTH_UTILIZATION,
callbacks=callbacks,
description="Utilization of the network bandwidth as a fraction.",
unit="1",
)
HW_NETWORK_IO: Final = "hw.network.io"
"""
Received and transmitted network traffic in bytes
Instrument: counter
Unit: By
"""
def create_hw_network_io(meter: Meter) -> Counter:
"""Received and transmitted network traffic in bytes"""
return meter.create_counter(
name=HW_NETWORK_IO,
description="Received and transmitted network traffic in bytes.",
unit="By",
)
HW_NETWORK_PACKETS: Final = "hw.network.packets"
"""
Received and transmitted network traffic in packets (or frames)
Instrument: counter
Unit: {packet}
"""
def create_hw_network_packets(meter: Meter) -> Counter:
"""Received and transmitted network traffic in packets (or frames)"""
return meter.create_counter(
name=HW_NETWORK_PACKETS,
description="Received and transmitted network traffic in packets (or frames).",
unit="{packet}",
)
HW_NETWORK_UP: Final = "hw.network.up"
"""
Link status: `1` (up) or `0` (down)
Instrument: updowncounter
Unit: 1
"""
def create_hw_network_up(meter: Meter) -> UpDownCounter:
"""Link status: `1` (up) or `0` (down)"""
return meter.create_up_down_counter(
name=HW_NETWORK_UP,
description="Link status: `1` (up) or `0` (down).",
unit="1",
)
HW_PHYSICAL_DISK_ENDURANCE_UTILIZATION: Final = (
"hw.physical_disk.endurance_utilization"
)
"""
Endurance remaining for this SSD disk
Instrument: gauge
Unit: 1
"""
def create_hw_physical_disk_endurance_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Endurance remaining for this SSD disk"""
return meter.create_observable_gauge(
name=HW_PHYSICAL_DISK_ENDURANCE_UTILIZATION,
callbacks=callbacks,
description="Endurance remaining for this SSD disk.",
unit="1",
)
HW_PHYSICAL_DISK_SIZE: Final = "hw.physical_disk.size"
"""
Size of the disk
Instrument: updowncounter
Unit: By
"""
def create_hw_physical_disk_size(meter: Meter) -> UpDownCounter:
"""Size of the disk"""
return meter.create_up_down_counter(
name=HW_PHYSICAL_DISK_SIZE,
description="Size of the disk.",
unit="By",
)
HW_PHYSICAL_DISK_SMART: Final = "hw.physical_disk.smart"
"""
Value of the corresponding [S.M.A.R.T.](https://wikipedia.org/wiki/S.M.A.R.T.) (Self-Monitoring, Analysis, and Reporting Technology) attribute
Instrument: gauge
Unit: 1
"""
def create_hw_physical_disk_smart(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Value of the corresponding [S.M.A.R.T.](https://wikipedia.org/wiki/S.M.A.R.T.) (Self-Monitoring, Analysis, and Reporting Technology) attribute"""
return meter.create_observable_gauge(
name=HW_PHYSICAL_DISK_SMART,
callbacks=callbacks,
description="Value of the corresponding [S.M.A.R.T.](https://wikipedia.org/wiki/S.M.A.R.T.) (Self-Monitoring, Analysis, and Reporting Technology) attribute.",
unit="1",
)
HW_POWER: Final = "hw.power"
"""
Instantaneous power consumed by the component
Instrument: gauge
Unit: W
Note: It is recommended to report `hw.energy` instead of `hw.power` when possible.
"""
def create_hw_power(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Instantaneous power consumed by the component"""
return meter.create_observable_gauge(
name=HW_POWER,
callbacks=callbacks,
description="Instantaneous power consumed by the component.",
unit="W",
)
HW_POWER_SUPPLY_LIMIT: Final = "hw.power_supply.limit"
"""
Maximum power output of the power supply
Instrument: updowncounter
Unit: W
"""
def create_hw_power_supply_limit(meter: Meter) -> UpDownCounter:
"""Maximum power output of the power supply"""
return meter.create_up_down_counter(
name=HW_POWER_SUPPLY_LIMIT,
description="Maximum power output of the power supply.",
unit="W",
)
HW_POWER_SUPPLY_USAGE: Final = "hw.power_supply.usage"
"""
Current power output of the power supply
Instrument: updowncounter
Unit: W
"""
def create_hw_power_supply_usage(meter: Meter) -> UpDownCounter:
"""Current power output of the power supply"""
return meter.create_up_down_counter(
name=HW_POWER_SUPPLY_USAGE,
description="Current power output of the power supply.",
unit="W",
)
HW_POWER_SUPPLY_UTILIZATION: Final = "hw.power_supply.utilization"
"""
Utilization of the power supply as a fraction of its maximum output
Instrument: gauge
Unit: 1
"""
def create_hw_power_supply_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Utilization of the power supply as a fraction of its maximum output"""
return meter.create_observable_gauge(
name=HW_POWER_SUPPLY_UTILIZATION,
callbacks=callbacks,
description="Utilization of the power supply as a fraction of its maximum output.",
unit="1",
)
HW_STATUS: Final = "hw.status"
"""
Operational status: `1` (true) or `0` (false) for each of the possible states
Instrument: updowncounter
Unit: 1
Note: `hw.status` is currently specified as an *UpDownCounter* but would ideally be represented using a [*StateSet* as defined in OpenMetrics](https://github.com/prometheus/OpenMetrics/blob/v1.0.0/specification/OpenMetrics.md#stateset). This semantic convention will be updated once *StateSet* is specified in OpenTelemetry. This planned change is not expected to have any consequence on the way users query their timeseries backend to retrieve the values of `hw.status` over time.
"""
def create_hw_status(meter: Meter) -> UpDownCounter:
"""Operational status: `1` (true) or `0` (false) for each of the possible states"""
return meter.create_up_down_counter(
name=HW_STATUS,
description="Operational status: `1` (true) or `0` (false) for each of the possible states.",
unit="1",
)
HW_TAPE_DRIVE_OPERATIONS: Final = "hw.tape_drive.operations"
"""
Operations performed by the tape drive
Instrument: counter
Unit: {operation}
"""
def create_hw_tape_drive_operations(meter: Meter) -> Counter:
"""Operations performed by the tape drive"""
return meter.create_counter(
name=HW_TAPE_DRIVE_OPERATIONS,
description="Operations performed by the tape drive.",
unit="{operation}",
)
HW_TEMPERATURE: Final = "hw.temperature"
"""
Temperature in degrees Celsius
Instrument: gauge
Unit: Cel
"""
def create_hw_temperature(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Temperature in degrees Celsius"""
return meter.create_observable_gauge(
name=HW_TEMPERATURE,
callbacks=callbacks,
description="Temperature in degrees Celsius.",
unit="Cel",
)
HW_TEMPERATURE_LIMIT: Final = "hw.temperature.limit"
"""
Temperature limit in degrees Celsius
Instrument: gauge
Unit: Cel
"""
def create_hw_temperature_limit(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Temperature limit in degrees Celsius"""
return meter.create_observable_gauge(
name=HW_TEMPERATURE_LIMIT,
callbacks=callbacks,
description="Temperature limit in degrees Celsius.",
unit="Cel",
)
HW_VOLTAGE: Final = "hw.voltage"
"""
Voltage measured by the sensor
Instrument: gauge
Unit: V
"""
def create_hw_voltage(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Voltage measured by the sensor"""
return meter.create_observable_gauge(
name=HW_VOLTAGE,
callbacks=callbacks,
description="Voltage measured by the sensor.",
unit="V",
)
HW_VOLTAGE_LIMIT: Final = "hw.voltage.limit"
"""
Voltage limit in Volts
Instrument: gauge
Unit: V
"""
def create_hw_voltage_limit(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Voltage limit in Volts"""
return meter.create_observable_gauge(
name=HW_VOLTAGE_LIMIT,
callbacks=callbacks,
description="Voltage limit in Volts.",
unit="V",
)
HW_VOLTAGE_NOMINAL: Final = "hw.voltage.nominal"
"""
Nominal (expected) voltage
Instrument: gauge
Unit: V
"""
def create_hw_voltage_nominal(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Nominal (expected) voltage"""
return meter.create_observable_gauge(
name=HW_VOLTAGE_NOMINAL,
callbacks=callbacks,
description="Nominal (expected) voltage.",
unit="V",
)

View File

@@ -0,0 +1,186 @@
# 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
from opentelemetry.metrics import Counter, Histogram, Meter
MESSAGING_CLIENT_CONSUMED_MESSAGES: Final = (
"messaging.client.consumed.messages"
)
"""
Number of messages that were delivered to the application
Instrument: counter
Unit: {message}
Note: Records the number of messages pulled from the broker or number of messages dispatched to the application in push-based scenarios.
The metric SHOULD be reported once per message delivery. For example, if receiving and processing operations are both instrumented for a single message delivery, this counter is incremented when the message is received and not reported when it is processed.
"""
def create_messaging_client_consumed_messages(meter: Meter) -> Counter:
"""Number of messages that were delivered to the application"""
return meter.create_counter(
name=MESSAGING_CLIENT_CONSUMED_MESSAGES,
description="Number of messages that were delivered to the application.",
unit="{message}",
)
MESSAGING_CLIENT_OPERATION_DURATION: Final = (
"messaging.client.operation.duration"
)
"""
Duration of messaging operation initiated by a producer or consumer client
Instrument: histogram
Unit: s
Note: This metric SHOULD NOT be used to report processing duration - processing duration is reported in `messaging.process.duration` metric.
"""
def create_messaging_client_operation_duration(meter: Meter) -> Histogram:
"""Duration of messaging operation initiated by a producer or consumer client"""
return meter.create_histogram(
name=MESSAGING_CLIENT_OPERATION_DURATION,
description="Duration of messaging operation initiated by a producer or consumer client.",
unit="s",
)
MESSAGING_CLIENT_PUBLISHED_MESSAGES: Final = (
"messaging.client.published.messages"
)
"""
Deprecated: Replaced by `messaging.client.sent.messages`.
"""
def create_messaging_client_published_messages(meter: Meter) -> Counter:
"""Deprecated. Use `messaging.client.sent.messages` instead"""
return meter.create_counter(
name=MESSAGING_CLIENT_PUBLISHED_MESSAGES,
description="Deprecated. Use `messaging.client.sent.messages` instead.",
unit="{message}",
)
MESSAGING_CLIENT_SENT_MESSAGES: Final = "messaging.client.sent.messages"
"""
Number of messages producer attempted to send to the broker
Instrument: counter
Unit: {message}
Note: This metric MUST NOT count messages that were created but haven't yet been sent.
"""
def create_messaging_client_sent_messages(meter: Meter) -> Counter:
"""Number of messages producer attempted to send to the broker"""
return meter.create_counter(
name=MESSAGING_CLIENT_SENT_MESSAGES,
description="Number of messages producer attempted to send to the broker.",
unit="{message}",
)
MESSAGING_PROCESS_DURATION: Final = "messaging.process.duration"
"""
Duration of processing operation
Instrument: histogram
Unit: s
Note: This metric MUST be reported for operations with `messaging.operation.type` that matches `process`.
"""
def create_messaging_process_duration(meter: Meter) -> Histogram:
"""Duration of processing operation"""
return meter.create_histogram(
name=MESSAGING_PROCESS_DURATION,
description="Duration of processing operation.",
unit="s",
)
MESSAGING_PROCESS_MESSAGES: Final = "messaging.process.messages"
"""
Deprecated: Replaced by `messaging.client.consumed.messages`.
"""
def create_messaging_process_messages(meter: Meter) -> Counter:
"""Deprecated. Use `messaging.client.consumed.messages` instead"""
return meter.create_counter(
name=MESSAGING_PROCESS_MESSAGES,
description="Deprecated. Use `messaging.client.consumed.messages` instead.",
unit="{message}",
)
MESSAGING_PUBLISH_DURATION: Final = "messaging.publish.duration"
"""
Deprecated: Replaced by `messaging.client.operation.duration`.
"""
def create_messaging_publish_duration(meter: Meter) -> Histogram:
"""Deprecated. Use `messaging.client.operation.duration` instead"""
return meter.create_histogram(
name=MESSAGING_PUBLISH_DURATION,
description="Deprecated. Use `messaging.client.operation.duration` instead.",
unit="s",
)
MESSAGING_PUBLISH_MESSAGES: Final = "messaging.publish.messages"
"""
Deprecated: Replaced by `messaging.client.sent.messages`.
"""
def create_messaging_publish_messages(meter: Meter) -> Counter:
"""Deprecated. Use `messaging.client.sent.messages` instead"""
return meter.create_counter(
name=MESSAGING_PUBLISH_MESSAGES,
description="Deprecated. Use `messaging.client.sent.messages` instead.",
unit="{message}",
)
MESSAGING_RECEIVE_DURATION: Final = "messaging.receive.duration"
"""
Deprecated: Replaced by `messaging.client.operation.duration`.
"""
def create_messaging_receive_duration(meter: Meter) -> Histogram:
"""Deprecated. Use `messaging.client.operation.duration` instead"""
return meter.create_histogram(
name=MESSAGING_RECEIVE_DURATION,
description="Deprecated. Use `messaging.client.operation.duration` instead.",
unit="s",
)
MESSAGING_RECEIVE_MESSAGES: Final = "messaging.receive.messages"
"""
Deprecated: Replaced by `messaging.client.consumed.messages`.
"""
def create_messaging_receive_messages(meter: Meter) -> Counter:
"""Deprecated. Use `messaging.client.consumed.messages` instead"""
return meter.create_counter(
name=MESSAGING_RECEIVE_MESSAGES,
description="Deprecated. Use `messaging.client.consumed.messages` instead.",
unit="{message}",
)

View File

@@ -0,0 +1,459 @@
# 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
from opentelemetry.metrics import Counter, Histogram, Meter, UpDownCounter
OTEL_SDK_EXPORTER_LOG_EXPORTED: Final = "otel.sdk.exporter.log.exported"
"""
The number of log records for which the export has finished, either successful or failed
Instrument: counter
Unit: {log_record}
Note: For successful exports, `error.type` MUST NOT be set. For failed exports, `error.type` MUST contain the failure cause.
For exporters with partial success semantics (e.g. OTLP with `rejected_log_records`), rejected log records MUST count as failed and only non-rejected log records count as success.
If no rejection reason is available, `rejected` SHOULD be used as value for `error.type`.
"""
def create_otel_sdk_exporter_log_exported(meter: Meter) -> Counter:
"""The number of log records for which the export has finished, either successful or failed"""
return meter.create_counter(
name=OTEL_SDK_EXPORTER_LOG_EXPORTED,
description="The number of log records for which the export has finished, either successful or failed.",
unit="{log_record}",
)
OTEL_SDK_EXPORTER_LOG_INFLIGHT: Final = "otel.sdk.exporter.log.inflight"
"""
The number of log records which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)
Instrument: updowncounter
Unit: {log_record}
Note: For successful exports, `error.type` MUST NOT be set. For failed exports, `error.type` MUST contain the failure cause.
"""
def create_otel_sdk_exporter_log_inflight(meter: Meter) -> UpDownCounter:
"""The number of log records which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)"""
return meter.create_up_down_counter(
name=OTEL_SDK_EXPORTER_LOG_INFLIGHT,
description="The number of log records which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).",
unit="{log_record}",
)
OTEL_SDK_EXPORTER_METRIC_DATA_POINT_EXPORTED: Final = (
"otel.sdk.exporter.metric_data_point.exported"
)
"""
The number of metric data points for which the export has finished, either successful or failed
Instrument: counter
Unit: {data_point}
Note: For successful exports, `error.type` MUST NOT be set. For failed exports, `error.type` MUST contain the failure cause.
For exporters with partial success semantics (e.g. OTLP with `rejected_data_points`), rejected data points MUST count as failed and only non-rejected data points count as success.
If no rejection reason is available, `rejected` SHOULD be used as value for `error.type`.
"""
def create_otel_sdk_exporter_metric_data_point_exported(
meter: Meter,
) -> Counter:
"""The number of metric data points for which the export has finished, either successful or failed"""
return meter.create_counter(
name=OTEL_SDK_EXPORTER_METRIC_DATA_POINT_EXPORTED,
description="The number of metric data points for which the export has finished, either successful or failed.",
unit="{data_point}",
)
OTEL_SDK_EXPORTER_METRIC_DATA_POINT_INFLIGHT: Final = (
"otel.sdk.exporter.metric_data_point.inflight"
)
"""
The number of metric data points which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)
Instrument: updowncounter
Unit: {data_point}
Note: For successful exports, `error.type` MUST NOT be set. For failed exports, `error.type` MUST contain the failure cause.
"""
def create_otel_sdk_exporter_metric_data_point_inflight(
meter: Meter,
) -> UpDownCounter:
"""The number of metric data points which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)"""
return meter.create_up_down_counter(
name=OTEL_SDK_EXPORTER_METRIC_DATA_POINT_INFLIGHT,
description="The number of metric data points which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).",
unit="{data_point}",
)
OTEL_SDK_EXPORTER_OPERATION_DURATION: Final = (
"otel.sdk.exporter.operation.duration"
)
"""
The duration of exporting a batch of telemetry records
Instrument: histogram
Unit: s
Note: This metric defines successful operations using the full success definitions for [http](https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/docs/specification.md#full-success-1)
and [grpc](https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/docs/specification.md#full-success). Anything else is defined as an unsuccessful operation. For successful
operations, `error.type` MUST NOT be set. For unsuccessful export operations, `error.type` MUST contain a relevant failure cause.
"""
def create_otel_sdk_exporter_operation_duration(meter: Meter) -> Histogram:
"""The duration of exporting a batch of telemetry records"""
return meter.create_histogram(
name=OTEL_SDK_EXPORTER_OPERATION_DURATION,
description="The duration of exporting a batch of telemetry records.",
unit="s",
)
OTEL_SDK_EXPORTER_SPAN_EXPORTED: Final = "otel.sdk.exporter.span.exported"
"""
The number of spans for which the export has finished, either successful or failed
Instrument: counter
Unit: {span}
Note: For successful exports, `error.type` MUST NOT be set. For failed exports, `error.type` MUST contain the failure cause.
For exporters with partial success semantics (e.g. OTLP with `rejected_spans`), rejected spans MUST count as failed and only non-rejected spans count as success.
If no rejection reason is available, `rejected` SHOULD be used as value for `error.type`.
"""
def create_otel_sdk_exporter_span_exported(meter: Meter) -> Counter:
"""The number of spans for which the export has finished, either successful or failed"""
return meter.create_counter(
name=OTEL_SDK_EXPORTER_SPAN_EXPORTED,
description="The number of spans for which the export has finished, either successful or failed.",
unit="{span}",
)
OTEL_SDK_EXPORTER_SPAN_EXPORTED_COUNT: Final = (
"otel.sdk.exporter.span.exported.count"
)
"""
Deprecated: Replaced by `otel.sdk.exporter.span.exported`.
"""
def create_otel_sdk_exporter_span_exported_count(
meter: Meter,
) -> UpDownCounter:
"""Deprecated, use `otel.sdk.exporter.span.exported` instead"""
return meter.create_up_down_counter(
name=OTEL_SDK_EXPORTER_SPAN_EXPORTED_COUNT,
description="Deprecated, use `otel.sdk.exporter.span.exported` instead.",
unit="{span}",
)
OTEL_SDK_EXPORTER_SPAN_INFLIGHT: Final = "otel.sdk.exporter.span.inflight"
"""
The number of spans which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)
Instrument: updowncounter
Unit: {span}
Note: For successful exports, `error.type` MUST NOT be set. For failed exports, `error.type` MUST contain the failure cause.
"""
def create_otel_sdk_exporter_span_inflight(meter: Meter) -> UpDownCounter:
"""The number of spans which were passed to the exporter, but that have not been exported yet (neither successful, nor failed)"""
return meter.create_up_down_counter(
name=OTEL_SDK_EXPORTER_SPAN_INFLIGHT,
description="The number of spans which were passed to the exporter, but that have not been exported yet (neither successful, nor failed).",
unit="{span}",
)
OTEL_SDK_EXPORTER_SPAN_INFLIGHT_COUNT: Final = (
"otel.sdk.exporter.span.inflight.count"
)
"""
Deprecated: Replaced by `otel.sdk.exporter.span.inflight`.
"""
def create_otel_sdk_exporter_span_inflight_count(
meter: Meter,
) -> UpDownCounter:
"""Deprecated, use `otel.sdk.exporter.span.inflight` instead"""
return meter.create_up_down_counter(
name=OTEL_SDK_EXPORTER_SPAN_INFLIGHT_COUNT,
description="Deprecated, use `otel.sdk.exporter.span.inflight` instead.",
unit="{span}",
)
OTEL_SDK_LOG_CREATED: Final = "otel.sdk.log.created"
"""
The number of logs submitted to enabled SDK Loggers
Instrument: counter
Unit: {log_record}
"""
def create_otel_sdk_log_created(meter: Meter) -> Counter:
"""The number of logs submitted to enabled SDK Loggers"""
return meter.create_counter(
name=OTEL_SDK_LOG_CREATED,
description="The number of logs submitted to enabled SDK Loggers.",
unit="{log_record}",
)
OTEL_SDK_METRIC_READER_COLLECTION_DURATION: Final = (
"otel.sdk.metric_reader.collection.duration"
)
"""
The duration of the collect operation of the metric reader
Instrument: histogram
Unit: s
Note: For successful collections, `error.type` MUST NOT be set. For failed collections, `error.type` SHOULD contain the failure cause.
It can happen that metrics collection is successful for some MetricProducers, while others fail. In that case `error.type` SHOULD be set to any of the failure causes.
"""
def create_otel_sdk_metric_reader_collection_duration(
meter: Meter,
) -> Histogram:
"""The duration of the collect operation of the metric reader"""
return meter.create_histogram(
name=OTEL_SDK_METRIC_READER_COLLECTION_DURATION,
description="The duration of the collect operation of the metric reader.",
unit="s",
)
OTEL_SDK_PROCESSOR_LOG_PROCESSED: Final = "otel.sdk.processor.log.processed"
"""
The number of log records for which the processing has finished, either successful or failed
Instrument: counter
Unit: {log_record}
Note: For successful processing, `error.type` MUST NOT be set. For failed processing, `error.type` MUST contain the failure cause.
For the SDK Simple and Batching Log Record Processor a log record is considered to be processed already when it has been submitted to the exporter,
not when the corresponding export call has finished.
"""
def create_otel_sdk_processor_log_processed(meter: Meter) -> Counter:
"""The number of log records for which the processing has finished, either successful or failed"""
return meter.create_counter(
name=OTEL_SDK_PROCESSOR_LOG_PROCESSED,
description="The number of log records for which the processing has finished, either successful or failed.",
unit="{log_record}",
)
OTEL_SDK_PROCESSOR_LOG_QUEUE_CAPACITY: Final = (
"otel.sdk.processor.log.queue.capacity"
)
"""
The maximum number of log records the queue of a given instance of an SDK Log Record processor can hold
Instrument: updowncounter
Unit: {log_record}
Note: Only applies to Log Record processors which use a queue, e.g. the SDK Batching Log Record Processor.
"""
def create_otel_sdk_processor_log_queue_capacity(
meter: Meter,
) -> UpDownCounter:
"""The maximum number of log records the queue of a given instance of an SDK Log Record processor can hold"""
return meter.create_up_down_counter(
name=OTEL_SDK_PROCESSOR_LOG_QUEUE_CAPACITY,
description="The maximum number of log records the queue of a given instance of an SDK Log Record processor can hold.",
unit="{log_record}",
)
OTEL_SDK_PROCESSOR_LOG_QUEUE_SIZE: Final = "otel.sdk.processor.log.queue.size"
"""
The number of log records in the queue of a given instance of an SDK log processor
Instrument: updowncounter
Unit: {log_record}
Note: Only applies to log record processors which use a queue, e.g. the SDK Batching Log Record Processor.
"""
def create_otel_sdk_processor_log_queue_size(meter: Meter) -> UpDownCounter:
"""The number of log records in the queue of a given instance of an SDK log processor"""
return meter.create_up_down_counter(
name=OTEL_SDK_PROCESSOR_LOG_QUEUE_SIZE,
description="The number of log records in the queue of a given instance of an SDK log processor.",
unit="{log_record}",
)
OTEL_SDK_PROCESSOR_SPAN_PROCESSED: Final = "otel.sdk.processor.span.processed"
"""
The number of spans for which the processing has finished, either successful or failed
Instrument: counter
Unit: {span}
Note: For successful processing, `error.type` MUST NOT be set. For failed processing, `error.type` MUST contain the failure cause.
For the SDK Simple and Batching Span Processor a span is considered to be processed already when it has been submitted to the exporter, not when the corresponding export call has finished.
"""
def create_otel_sdk_processor_span_processed(meter: Meter) -> Counter:
"""The number of spans for which the processing has finished, either successful or failed"""
return meter.create_counter(
name=OTEL_SDK_PROCESSOR_SPAN_PROCESSED,
description="The number of spans for which the processing has finished, either successful or failed.",
unit="{span}",
)
OTEL_SDK_PROCESSOR_SPAN_PROCESSED_COUNT: Final = (
"otel.sdk.processor.span.processed.count"
)
"""
Deprecated: Replaced by `otel.sdk.processor.span.processed`.
"""
def create_otel_sdk_processor_span_processed_count(
meter: Meter,
) -> UpDownCounter:
"""Deprecated, use `otel.sdk.processor.span.processed` instead"""
return meter.create_up_down_counter(
name=OTEL_SDK_PROCESSOR_SPAN_PROCESSED_COUNT,
description="Deprecated, use `otel.sdk.processor.span.processed` instead.",
unit="{span}",
)
OTEL_SDK_PROCESSOR_SPAN_QUEUE_CAPACITY: Final = (
"otel.sdk.processor.span.queue.capacity"
)
"""
The maximum number of spans the queue of a given instance of an SDK span processor can hold
Instrument: updowncounter
Unit: {span}
Note: Only applies to span processors which use a queue, e.g. the SDK Batching Span Processor.
"""
def create_otel_sdk_processor_span_queue_capacity(
meter: Meter,
) -> UpDownCounter:
"""The maximum number of spans the queue of a given instance of an SDK span processor can hold"""
return meter.create_up_down_counter(
name=OTEL_SDK_PROCESSOR_SPAN_QUEUE_CAPACITY,
description="The maximum number of spans the queue of a given instance of an SDK span processor can hold.",
unit="{span}",
)
OTEL_SDK_PROCESSOR_SPAN_QUEUE_SIZE: Final = (
"otel.sdk.processor.span.queue.size"
)
"""
The number of spans in the queue of a given instance of an SDK span processor
Instrument: updowncounter
Unit: {span}
Note: Only applies to span processors which use a queue, e.g. the SDK Batching Span Processor.
"""
def create_otel_sdk_processor_span_queue_size(meter: Meter) -> UpDownCounter:
"""The number of spans in the queue of a given instance of an SDK span processor"""
return meter.create_up_down_counter(
name=OTEL_SDK_PROCESSOR_SPAN_QUEUE_SIZE,
description="The number of spans in the queue of a given instance of an SDK span processor.",
unit="{span}",
)
OTEL_SDK_SPAN_ENDED: Final = "otel.sdk.span.ended"
"""
Deprecated: Obsoleted.
"""
def create_otel_sdk_span_ended(meter: Meter) -> Counter:
"""Use `otel.sdk.span.started` minus `otel.sdk.span.live` to derive this value"""
return meter.create_counter(
name=OTEL_SDK_SPAN_ENDED,
description="Use `otel.sdk.span.started` minus `otel.sdk.span.live` to derive this value.",
unit="{span}",
)
OTEL_SDK_SPAN_ENDED_COUNT: Final = "otel.sdk.span.ended.count"
"""
Deprecated: Obsoleted.
"""
def create_otel_sdk_span_ended_count(meter: Meter) -> Counter:
"""Use `otel.sdk.span.started` minus `otel.sdk.span.live` to derive this value"""
return meter.create_counter(
name=OTEL_SDK_SPAN_ENDED_COUNT,
description="Use `otel.sdk.span.started` minus `otel.sdk.span.live` to derive this value.",
unit="{span}",
)
OTEL_SDK_SPAN_LIVE: Final = "otel.sdk.span.live"
"""
The number of created spans with `recording=true` for which the end operation has not been called yet
Instrument: updowncounter
Unit: {span}
"""
def create_otel_sdk_span_live(meter: Meter) -> UpDownCounter:
"""The number of created spans with `recording=true` for which the end operation has not been called yet"""
return meter.create_up_down_counter(
name=OTEL_SDK_SPAN_LIVE,
description="The number of created spans with `recording=true` for which the end operation has not been called yet.",
unit="{span}",
)
OTEL_SDK_SPAN_LIVE_COUNT: Final = "otel.sdk.span.live.count"
"""
Deprecated: Replaced by `otel.sdk.span.live`.
"""
def create_otel_sdk_span_live_count(meter: Meter) -> UpDownCounter:
"""Deprecated, use `otel.sdk.span.live` instead"""
return meter.create_up_down_counter(
name=OTEL_SDK_SPAN_LIVE_COUNT,
description="Deprecated, use `otel.sdk.span.live` instead.",
unit="{span}",
)
OTEL_SDK_SPAN_STARTED: Final = "otel.sdk.span.started"
"""
The number of created spans
Instrument: counter
Unit: {span}
Note: Implementations MUST record this metric for all spans, even for non-recording ones.
"""
def create_otel_sdk_span_started(meter: Meter) -> Counter:
"""The number of created spans"""
return meter.create_counter(
name=OTEL_SDK_SPAN_STARTED,
description="The number of created spans.",
unit="{span}",
)

View File

@@ -0,0 +1,235 @@
# 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 (
Callable,
Final,
Generator,
Iterable,
Optional,
Sequence,
Union,
)
from opentelemetry.metrics import (
CallbackOptions,
Counter,
Meter,
ObservableGauge,
Observation,
UpDownCounter,
)
# pylint: disable=invalid-name
CallbackT = Union[
Callable[[CallbackOptions], Iterable[Observation]],
Generator[Iterable[Observation], CallbackOptions, None],
]
PROCESS_CONTEXT_SWITCHES: Final = "process.context_switches"
"""
Number of times the process has been context switched
Instrument: counter
Unit: {context_switch}
"""
def create_process_context_switches(meter: Meter) -> Counter:
"""Number of times the process has been context switched"""
return meter.create_counter(
name=PROCESS_CONTEXT_SWITCHES,
description="Number of times the process has been context switched.",
unit="{context_switch}",
)
PROCESS_CPU_TIME: Final = "process.cpu.time"
"""
Total CPU seconds broken down by different states
Instrument: counter
Unit: s
"""
def create_process_cpu_time(meter: Meter) -> Counter:
"""Total CPU seconds broken down by different states"""
return meter.create_counter(
name=PROCESS_CPU_TIME,
description="Total CPU seconds broken down by different states.",
unit="s",
)
PROCESS_CPU_UTILIZATION: Final = "process.cpu.utilization"
"""
Difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs available to the process
Instrument: gauge
Unit: 1
"""
def create_process_cpu_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs available to the process"""
return meter.create_observable_gauge(
name=PROCESS_CPU_UTILIZATION,
callbacks=callbacks,
description="Difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs available to the process.",
unit="1",
)
PROCESS_DISK_IO: Final = "process.disk.io"
"""
Disk bytes transferred
Instrument: counter
Unit: By
"""
def create_process_disk_io(meter: Meter) -> Counter:
"""Disk bytes transferred"""
return meter.create_counter(
name=PROCESS_DISK_IO,
description="Disk bytes transferred.",
unit="By",
)
PROCESS_MEMORY_USAGE: Final = "process.memory.usage"
"""
The amount of physical memory in use
Instrument: updowncounter
Unit: By
"""
def create_process_memory_usage(meter: Meter) -> UpDownCounter:
"""The amount of physical memory in use"""
return meter.create_up_down_counter(
name=PROCESS_MEMORY_USAGE,
description="The amount of physical memory in use.",
unit="By",
)
PROCESS_MEMORY_VIRTUAL: Final = "process.memory.virtual"
"""
The amount of committed virtual memory
Instrument: updowncounter
Unit: By
"""
def create_process_memory_virtual(meter: Meter) -> UpDownCounter:
"""The amount of committed virtual memory"""
return meter.create_up_down_counter(
name=PROCESS_MEMORY_VIRTUAL,
description="The amount of committed virtual memory.",
unit="By",
)
PROCESS_NETWORK_IO: Final = "process.network.io"
"""
Network bytes transferred
Instrument: counter
Unit: By
"""
def create_process_network_io(meter: Meter) -> Counter:
"""Network bytes transferred"""
return meter.create_counter(
name=PROCESS_NETWORK_IO,
description="Network bytes transferred.",
unit="By",
)
PROCESS_OPEN_FILE_DESCRIPTOR_COUNT: Final = (
"process.open_file_descriptor.count"
)
"""
Number of file descriptors in use by the process
Instrument: updowncounter
Unit: {file_descriptor}
"""
def create_process_open_file_descriptor_count(meter: Meter) -> UpDownCounter:
"""Number of file descriptors in use by the process"""
return meter.create_up_down_counter(
name=PROCESS_OPEN_FILE_DESCRIPTOR_COUNT,
description="Number of file descriptors in use by the process.",
unit="{file_descriptor}",
)
PROCESS_PAGING_FAULTS: Final = "process.paging.faults"
"""
Number of page faults the process has made
Instrument: counter
Unit: {fault}
"""
def create_process_paging_faults(meter: Meter) -> Counter:
"""Number of page faults the process has made"""
return meter.create_counter(
name=PROCESS_PAGING_FAULTS,
description="Number of page faults the process has made.",
unit="{fault}",
)
PROCESS_THREAD_COUNT: Final = "process.thread.count"
"""
Process threads count
Instrument: updowncounter
Unit: {thread}
"""
def create_process_thread_count(meter: Meter) -> UpDownCounter:
"""Process threads count"""
return meter.create_up_down_counter(
name=PROCESS_THREAD_COUNT,
description="Process threads count.",
unit="{thread}",
)
PROCESS_UPTIME: Final = "process.uptime"
"""
The time the process has been running
Instrument: gauge
Unit: s
Note: Instrumentations SHOULD use a gauge with type `double` and measure uptime in seconds as a floating point number with the highest precision available.
The actual accuracy would depend on the instrumentation and operating system.
"""
def create_process_uptime(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""The time the process has been running"""
return meter.create_observable_gauge(
name=PROCESS_UPTIME,
callbacks=callbacks,
description="The time the process has been running.",
unit="s",
)

View File

@@ -0,0 +1,211 @@
# 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
from opentelemetry.metrics import Histogram, Meter
RPC_CLIENT_DURATION: Final = "rpc.client.duration"
"""
Measures the duration of outbound RPC
Instrument: histogram
Unit: ms
Note: While streaming RPCs may record this metric as start-of-batch
to end-of-batch, it's hard to interpret in practice.
**Streaming**: N/A.
"""
def create_rpc_client_duration(meter: Meter) -> Histogram:
"""Measures the duration of outbound RPC"""
return meter.create_histogram(
name=RPC_CLIENT_DURATION,
description="Measures the duration of outbound RPC.",
unit="ms",
)
RPC_CLIENT_REQUEST_SIZE: Final = "rpc.client.request.size"
"""
Measures the size of RPC request messages (uncompressed)
Instrument: histogram
Unit: By
Note: **Streaming**: Recorded per message in a streaming batch.
"""
def create_rpc_client_request_size(meter: Meter) -> Histogram:
"""Measures the size of RPC request messages (uncompressed)"""
return meter.create_histogram(
name=RPC_CLIENT_REQUEST_SIZE,
description="Measures the size of RPC request messages (uncompressed).",
unit="By",
)
RPC_CLIENT_REQUESTS_PER_RPC: Final = "rpc.client.requests_per_rpc"
"""
Measures the number of messages received per RPC
Instrument: histogram
Unit: {count}
Note: Should be 1 for all non-streaming RPCs.
**Streaming**: This metric is required for server and client streaming RPCs.
"""
def create_rpc_client_requests_per_rpc(meter: Meter) -> Histogram:
"""Measures the number of messages received per RPC"""
return meter.create_histogram(
name=RPC_CLIENT_REQUESTS_PER_RPC,
description="Measures the number of messages received per RPC.",
unit="{count}",
)
RPC_CLIENT_RESPONSE_SIZE: Final = "rpc.client.response.size"
"""
Measures the size of RPC response messages (uncompressed)
Instrument: histogram
Unit: By
Note: **Streaming**: Recorded per response in a streaming batch.
"""
def create_rpc_client_response_size(meter: Meter) -> Histogram:
"""Measures the size of RPC response messages (uncompressed)"""
return meter.create_histogram(
name=RPC_CLIENT_RESPONSE_SIZE,
description="Measures the size of RPC response messages (uncompressed).",
unit="By",
)
RPC_CLIENT_RESPONSES_PER_RPC: Final = "rpc.client.responses_per_rpc"
"""
Measures the number of messages sent per RPC
Instrument: histogram
Unit: {count}
Note: Should be 1 for all non-streaming RPCs.
**Streaming**: This metric is required for server and client streaming RPCs.
"""
def create_rpc_client_responses_per_rpc(meter: Meter) -> Histogram:
"""Measures the number of messages sent per RPC"""
return meter.create_histogram(
name=RPC_CLIENT_RESPONSES_PER_RPC,
description="Measures the number of messages sent per RPC.",
unit="{count}",
)
RPC_SERVER_DURATION: Final = "rpc.server.duration"
"""
Measures the duration of inbound RPC
Instrument: histogram
Unit: ms
Note: While streaming RPCs may record this metric as start-of-batch
to end-of-batch, it's hard to interpret in practice.
**Streaming**: N/A.
"""
def create_rpc_server_duration(meter: Meter) -> Histogram:
"""Measures the duration of inbound RPC"""
return meter.create_histogram(
name=RPC_SERVER_DURATION,
description="Measures the duration of inbound RPC.",
unit="ms",
)
RPC_SERVER_REQUEST_SIZE: Final = "rpc.server.request.size"
"""
Measures the size of RPC request messages (uncompressed)
Instrument: histogram
Unit: By
Note: **Streaming**: Recorded per message in a streaming batch.
"""
def create_rpc_server_request_size(meter: Meter) -> Histogram:
"""Measures the size of RPC request messages (uncompressed)"""
return meter.create_histogram(
name=RPC_SERVER_REQUEST_SIZE,
description="Measures the size of RPC request messages (uncompressed).",
unit="By",
)
RPC_SERVER_REQUESTS_PER_RPC: Final = "rpc.server.requests_per_rpc"
"""
Measures the number of messages received per RPC
Instrument: histogram
Unit: {count}
Note: Should be 1 for all non-streaming RPCs.
**Streaming** : This metric is required for server and client streaming RPCs.
"""
def create_rpc_server_requests_per_rpc(meter: Meter) -> Histogram:
"""Measures the number of messages received per RPC"""
return meter.create_histogram(
name=RPC_SERVER_REQUESTS_PER_RPC,
description="Measures the number of messages received per RPC.",
unit="{count}",
)
RPC_SERVER_RESPONSE_SIZE: Final = "rpc.server.response.size"
"""
Measures the size of RPC response messages (uncompressed)
Instrument: histogram
Unit: By
Note: **Streaming**: Recorded per response in a streaming batch.
"""
def create_rpc_server_response_size(meter: Meter) -> Histogram:
"""Measures the size of RPC response messages (uncompressed)"""
return meter.create_histogram(
name=RPC_SERVER_RESPONSE_SIZE,
description="Measures the size of RPC response messages (uncompressed).",
unit="By",
)
RPC_SERVER_RESPONSES_PER_RPC: Final = "rpc.server.responses_per_rpc"
"""
Measures the number of messages sent per RPC
Instrument: histogram
Unit: {count}
Note: Should be 1 for all non-streaming RPCs.
**Streaming**: This metric is required for server and client streaming RPCs.
"""
def create_rpc_server_responses_per_rpc(meter: Meter) -> Histogram:
"""Measures the number of messages sent per RPC"""
return meter.create_histogram(
name=RPC_SERVER_RESPONSES_PER_RPC,
description="Measures the number of messages sent per RPC.",
unit="{count}",
)

View File

@@ -0,0 +1,651 @@
# 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 (
Callable,
Final,
Generator,
Iterable,
Optional,
Sequence,
Union,
)
from opentelemetry.metrics import (
CallbackOptions,
Counter,
Meter,
ObservableGauge,
Observation,
UpDownCounter,
)
# pylint: disable=invalid-name
CallbackT = Union[
Callable[[CallbackOptions], Iterable[Observation]],
Generator[Iterable[Observation], CallbackOptions, None],
]
SYSTEM_CPU_FREQUENCY: Final = "system.cpu.frequency"
"""
Operating frequency of the logical CPU in Hertz
Instrument: gauge
Unit: Hz
"""
def create_system_cpu_frequency(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Operating frequency of the logical CPU in Hertz"""
return meter.create_observable_gauge(
name=SYSTEM_CPU_FREQUENCY,
callbacks=callbacks,
description="Operating frequency of the logical CPU in Hertz.",
unit="Hz",
)
SYSTEM_CPU_LOGICAL_COUNT: Final = "system.cpu.logical.count"
"""
Reports the number of logical (virtual) processor cores created by the operating system to manage multitasking
Instrument: updowncounter
Unit: {cpu}
Note: Calculated by multiplying the number of sockets by the number of cores per socket, and then by the number of threads per core.
"""
def create_system_cpu_logical_count(meter: Meter) -> UpDownCounter:
"""Reports the number of logical (virtual) processor cores created by the operating system to manage multitasking"""
return meter.create_up_down_counter(
name=SYSTEM_CPU_LOGICAL_COUNT,
description="Reports the number of logical (virtual) processor cores created by the operating system to manage multitasking.",
unit="{cpu}",
)
SYSTEM_CPU_PHYSICAL_COUNT: Final = "system.cpu.physical.count"
"""
Reports the number of actual physical processor cores on the hardware
Instrument: updowncounter
Unit: {cpu}
Note: Calculated by multiplying the number of sockets by the number of cores per socket.
"""
def create_system_cpu_physical_count(meter: Meter) -> UpDownCounter:
"""Reports the number of actual physical processor cores on the hardware"""
return meter.create_up_down_counter(
name=SYSTEM_CPU_PHYSICAL_COUNT,
description="Reports the number of actual physical processor cores on the hardware.",
unit="{cpu}",
)
SYSTEM_CPU_TIME: Final = "system.cpu.time"
"""
Seconds each logical CPU spent on each mode
Instrument: counter
Unit: s
"""
def create_system_cpu_time(meter: Meter) -> Counter:
"""Seconds each logical CPU spent on each mode"""
return meter.create_counter(
name=SYSTEM_CPU_TIME,
description="Seconds each logical CPU spent on each mode.",
unit="s",
)
SYSTEM_CPU_UTILIZATION: Final = "system.cpu.utilization"
"""
For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time
Instrument: gauge
Unit: 1
"""
def create_system_cpu_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time"""
return meter.create_observable_gauge(
name=SYSTEM_CPU_UTILIZATION,
callbacks=callbacks,
description="For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time.",
unit="1",
)
SYSTEM_DISK_IO: Final = "system.disk.io"
"""
TODO
Instrument: counter
Unit: By
"""
def create_system_disk_io(meter: Meter) -> Counter:
"""TODO"""
return meter.create_counter(
name=SYSTEM_DISK_IO,
description="TODO.",
unit="By",
)
SYSTEM_DISK_IO_TIME: Final = "system.disk.io_time"
"""
Time disk spent activated
Instrument: counter
Unit: s
Note: The real elapsed time ("wall clock") used in the I/O path (time from operations running in parallel are not counted). Measured as:
- Linux: Field 13 from [procfs-diskstats](https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats)
- Windows: The complement of
["Disk\\% Idle Time"](https://learn.microsoft.com/archive/blogs/askcore/windows-performance-monitor-disk-counters-explained#windows-performance-monitor-disk-counters-explained)
performance counter: `uptime * (100 - "Disk\\% Idle Time") / 100`.
"""
def create_system_disk_io_time(meter: Meter) -> Counter:
"""Time disk spent activated"""
return meter.create_counter(
name=SYSTEM_DISK_IO_TIME,
description="Time disk spent activated.",
unit="s",
)
SYSTEM_DISK_LIMIT: Final = "system.disk.limit"
"""
The total storage capacity of the disk
Instrument: updowncounter
Unit: By
"""
def create_system_disk_limit(meter: Meter) -> UpDownCounter:
"""The total storage capacity of the disk"""
return meter.create_up_down_counter(
name=SYSTEM_DISK_LIMIT,
description="The total storage capacity of the disk.",
unit="By",
)
SYSTEM_DISK_MERGED: Final = "system.disk.merged"
"""
TODO
Instrument: counter
Unit: {operation}
"""
def create_system_disk_merged(meter: Meter) -> Counter:
"""TODO"""
return meter.create_counter(
name=SYSTEM_DISK_MERGED,
description="TODO.",
unit="{operation}",
)
SYSTEM_DISK_OPERATION_TIME: Final = "system.disk.operation_time"
"""
Sum of the time each operation took to complete
Instrument: counter
Unit: s
Note: Because it is the sum of time each request took, parallel-issued requests each contribute to make the count grow. Measured as:
- Linux: Fields 7 & 11 from [procfs-diskstats](https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats)
- Windows: "Avg. Disk sec/Read" perf counter multiplied by "Disk Reads/sec" perf counter (similar for Writes).
"""
def create_system_disk_operation_time(meter: Meter) -> Counter:
"""Sum of the time each operation took to complete"""
return meter.create_counter(
name=SYSTEM_DISK_OPERATION_TIME,
description="Sum of the time each operation took to complete.",
unit="s",
)
SYSTEM_DISK_OPERATIONS: Final = "system.disk.operations"
"""
TODO
Instrument: counter
Unit: {operation}
"""
def create_system_disk_operations(meter: Meter) -> Counter:
"""TODO"""
return meter.create_counter(
name=SYSTEM_DISK_OPERATIONS,
description="TODO.",
unit="{operation}",
)
SYSTEM_FILESYSTEM_LIMIT: Final = "system.filesystem.limit"
"""
The total storage capacity of the filesystem
Instrument: updowncounter
Unit: By
"""
def create_system_filesystem_limit(meter: Meter) -> UpDownCounter:
"""The total storage capacity of the filesystem"""
return meter.create_up_down_counter(
name=SYSTEM_FILESYSTEM_LIMIT,
description="The total storage capacity of the filesystem.",
unit="By",
)
SYSTEM_FILESYSTEM_USAGE: Final = "system.filesystem.usage"
"""
Reports a filesystem's space usage across different states
Instrument: updowncounter
Unit: By
Note: The sum of all `system.filesystem.usage` values over the different `system.filesystem.state` attributes
SHOULD equal the total storage capacity of the filesystem, that is `system.filesystem.limit`.
"""
def create_system_filesystem_usage(meter: Meter) -> UpDownCounter:
"""Reports a filesystem's space usage across different states"""
return meter.create_up_down_counter(
name=SYSTEM_FILESYSTEM_USAGE,
description="Reports a filesystem's space usage across different states.",
unit="By",
)
SYSTEM_FILESYSTEM_UTILIZATION: Final = "system.filesystem.utilization"
"""
TODO
Instrument: gauge
Unit: 1
"""
def create_system_filesystem_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""TODO"""
return meter.create_observable_gauge(
name=SYSTEM_FILESYSTEM_UTILIZATION,
callbacks=callbacks,
description="TODO.",
unit="1",
)
SYSTEM_LINUX_MEMORY_AVAILABLE: Final = "system.linux.memory.available"
"""
An estimate of how much memory is available for starting new applications, without causing swapping
Instrument: updowncounter
Unit: By
Note: This is an alternative to `system.memory.usage` metric with `state=free`.
Linux starting from 3.14 exports "available" memory. It takes "free" memory as a baseline, and then factors in kernel-specific values.
This is supposed to be more accurate than just "free" memory.
For reference, see the calculations [here](https://superuser.com/a/980821).
See also `MemAvailable` in [/proc/meminfo](https://man7.org/linux/man-pages/man5/proc.5.html).
"""
def create_system_linux_memory_available(meter: Meter) -> UpDownCounter:
"""An estimate of how much memory is available for starting new applications, without causing swapping"""
return meter.create_up_down_counter(
name=SYSTEM_LINUX_MEMORY_AVAILABLE,
description="An estimate of how much memory is available for starting new applications, without causing swapping.",
unit="By",
)
SYSTEM_LINUX_MEMORY_SLAB_USAGE: Final = "system.linux.memory.slab.usage"
"""
Reports the memory used by the Linux kernel for managing caches of frequently used objects
Instrument: updowncounter
Unit: By
Note: The sum over the `reclaimable` and `unreclaimable` state values in `linux.memory.slab.usage` SHOULD be equal to the total slab memory available on the system.
Note that the total slab memory is not constant and may vary over time.
See also the [Slab allocator](https://blogs.oracle.com/linux/post/understanding-linux-kernel-memory-statistics) and `Slab` in [/proc/meminfo](https://man7.org/linux/man-pages/man5/proc.5.html).
"""
def create_system_linux_memory_slab_usage(meter: Meter) -> UpDownCounter:
"""Reports the memory used by the Linux kernel for managing caches of frequently used objects"""
return meter.create_up_down_counter(
name=SYSTEM_LINUX_MEMORY_SLAB_USAGE,
description="Reports the memory used by the Linux kernel for managing caches of frequently used objects.",
unit="By",
)
SYSTEM_MEMORY_LIMIT: Final = "system.memory.limit"
"""
Total virtual memory available in the system
Instrument: updowncounter
Unit: By
"""
def create_system_memory_limit(meter: Meter) -> UpDownCounter:
"""Total virtual memory available in the system"""
return meter.create_up_down_counter(
name=SYSTEM_MEMORY_LIMIT,
description="Total virtual memory available in the system.",
unit="By",
)
SYSTEM_MEMORY_SHARED: Final = "system.memory.shared"
"""
Shared memory used (mostly by tmpfs)
Instrument: updowncounter
Unit: By
Note: Equivalent of `shared` from [`free` command](https://man7.org/linux/man-pages/man1/free.1.html) or
`Shmem` from [`/proc/meminfo`](https://man7.org/linux/man-pages/man5/proc.5.html)".
"""
def create_system_memory_shared(meter: Meter) -> UpDownCounter:
"""Shared memory used (mostly by tmpfs)"""
return meter.create_up_down_counter(
name=SYSTEM_MEMORY_SHARED,
description="Shared memory used (mostly by tmpfs).",
unit="By",
)
SYSTEM_MEMORY_USAGE: Final = "system.memory.usage"
"""
Reports memory in use by state
Instrument: updowncounter
Unit: By
"""
def create_system_memory_usage(meter: Meter) -> UpDownCounter:
"""Reports memory in use by state"""
return meter.create_up_down_counter(
name=SYSTEM_MEMORY_USAGE,
description="Reports memory in use by state.",
unit="By",
)
SYSTEM_MEMORY_UTILIZATION: Final = "system.memory.utilization"
"""
TODO
Instrument: gauge
Unit: 1
"""
def create_system_memory_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""TODO"""
return meter.create_observable_gauge(
name=SYSTEM_MEMORY_UTILIZATION,
callbacks=callbacks,
description="TODO.",
unit="1",
)
SYSTEM_NETWORK_CONNECTION_COUNT: Final = "system.network.connection.count"
"""
TODO
Instrument: updowncounter
Unit: {connection}
"""
def create_system_network_connection_count(meter: Meter) -> UpDownCounter:
"""TODO"""
return meter.create_up_down_counter(
name=SYSTEM_NETWORK_CONNECTION_COUNT,
description="TODO.",
unit="{connection}",
)
SYSTEM_NETWORK_CONNECTIONS: Final = "system.network.connections"
"""
Deprecated: Replaced by `system.network.connection.count`.
"""
def create_system_network_connections(meter: Meter) -> UpDownCounter:
"""Deprecated, use `system.network.connection.count` instead"""
return meter.create_up_down_counter(
name=SYSTEM_NETWORK_CONNECTIONS,
description="Deprecated, use `system.network.connection.count` instead.",
unit="{connection}",
)
SYSTEM_NETWORK_ERRORS: Final = "system.network.errors"
"""
Count of network errors detected
Instrument: counter
Unit: {error}
Note: Measured as:
- Linux: the `errs` column in `/proc/net/dev` ([source](https://web.archive.org/web/20180321091318/http://www.onlamp.com/pub/a/linux/2000/11/16/LinuxAdmin.html)).
- Windows: [`InErrors`/`OutErrors`](https://docs.microsoft.com/windows/win32/api/netioapi/ns-netioapi-mib_if_row2)
from [`GetIfEntry2`](https://docs.microsoft.com/windows/win32/api/netioapi/nf-netioapi-getifentry2).
"""
def create_system_network_errors(meter: Meter) -> Counter:
"""Count of network errors detected"""
return meter.create_counter(
name=SYSTEM_NETWORK_ERRORS,
description="Count of network errors detected.",
unit="{error}",
)
SYSTEM_NETWORK_IO: Final = "system.network.io"
"""
TODO
Instrument: counter
Unit: By
"""
def create_system_network_io(meter: Meter) -> Counter:
"""TODO"""
return meter.create_counter(
name=SYSTEM_NETWORK_IO,
description="TODO.",
unit="By",
)
SYSTEM_NETWORK_PACKET_COUNT: Final = "system.network.packet.count"
"""
TODO
Instrument: counter
Unit: {packet}
"""
def create_system_network_packet_count(meter: Meter) -> Counter:
"""TODO"""
return meter.create_counter(
name=SYSTEM_NETWORK_PACKET_COUNT,
description="TODO.",
unit="{packet}",
)
SYSTEM_NETWORK_PACKET_DROPPED: Final = "system.network.packet.dropped"
"""
Count of packets that are dropped or discarded even though there was no error
Instrument: counter
Unit: {packet}
Note: Measured as:
- Linux: the `drop` column in `/proc/net/dev` ([source](https://web.archive.org/web/20180321091318/http://www.onlamp.com/pub/a/linux/2000/11/16/LinuxAdmin.html))
- Windows: [`InDiscards`/`OutDiscards`](https://docs.microsoft.com/windows/win32/api/netioapi/ns-netioapi-mib_if_row2)
from [`GetIfEntry2`](https://docs.microsoft.com/windows/win32/api/netioapi/nf-netioapi-getifentry2).
"""
def create_system_network_packet_dropped(meter: Meter) -> Counter:
"""Count of packets that are dropped or discarded even though there was no error"""
return meter.create_counter(
name=SYSTEM_NETWORK_PACKET_DROPPED,
description="Count of packets that are dropped or discarded even though there was no error.",
unit="{packet}",
)
SYSTEM_PAGING_FAULTS: Final = "system.paging.faults"
"""
TODO
Instrument: counter
Unit: {fault}
"""
def create_system_paging_faults(meter: Meter) -> Counter:
"""TODO"""
return meter.create_counter(
name=SYSTEM_PAGING_FAULTS,
description="TODO.",
unit="{fault}",
)
SYSTEM_PAGING_OPERATIONS: Final = "system.paging.operations"
"""
TODO
Instrument: counter
Unit: {operation}
"""
def create_system_paging_operations(meter: Meter) -> Counter:
"""TODO"""
return meter.create_counter(
name=SYSTEM_PAGING_OPERATIONS,
description="TODO.",
unit="{operation}",
)
SYSTEM_PAGING_USAGE: Final = "system.paging.usage"
"""
Unix swap or windows pagefile usage
Instrument: updowncounter
Unit: By
"""
def create_system_paging_usage(meter: Meter) -> UpDownCounter:
"""Unix swap or windows pagefile usage"""
return meter.create_up_down_counter(
name=SYSTEM_PAGING_USAGE,
description="Unix swap or windows pagefile usage.",
unit="By",
)
SYSTEM_PAGING_UTILIZATION: Final = "system.paging.utilization"
"""
TODO
Instrument: gauge
Unit: 1
"""
def create_system_paging_utilization(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""TODO"""
return meter.create_observable_gauge(
name=SYSTEM_PAGING_UTILIZATION,
callbacks=callbacks,
description="TODO.",
unit="1",
)
SYSTEM_PROCESS_COUNT: Final = "system.process.count"
"""
Total number of processes in each state
Instrument: updowncounter
Unit: {process}
"""
def create_system_process_count(meter: Meter) -> UpDownCounter:
"""Total number of processes in each state"""
return meter.create_up_down_counter(
name=SYSTEM_PROCESS_COUNT,
description="Total number of processes in each state.",
unit="{process}",
)
SYSTEM_PROCESS_CREATED: Final = "system.process.created"
"""
Total number of processes created over uptime of the host
Instrument: counter
Unit: {process}
"""
def create_system_process_created(meter: Meter) -> Counter:
"""Total number of processes created over uptime of the host"""
return meter.create_counter(
name=SYSTEM_PROCESS_CREATED,
description="Total number of processes created over uptime of the host.",
unit="{process}",
)
SYSTEM_UPTIME: Final = "system.uptime"
"""
The time the system has been running
Instrument: gauge
Unit: s
Note: Instrumentations SHOULD use a gauge with type `double` and measure uptime in seconds as a floating point number with the highest precision available.
The actual accuracy would depend on the instrumentation and operating system.
"""
def create_system_uptime(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""The time the system has been running"""
return meter.create_observable_gauge(
name=SYSTEM_UPTIME,
callbacks=callbacks,
description="The time the system has been running.",
unit="s",
)

View File

@@ -0,0 +1,233 @@
# 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 (
Callable,
Final,
Generator,
Iterable,
Optional,
Sequence,
Union,
)
from opentelemetry.metrics import (
CallbackOptions,
Meter,
ObservableGauge,
Observation,
UpDownCounter,
)
# pylint: disable=invalid-name
CallbackT = Union[
Callable[[CallbackOptions], Iterable[Observation]],
Generator[Iterable[Observation], CallbackOptions, None],
]
VCS_CHANGE_COUNT: Final = "vcs.change.count"
"""
The number of changes (pull requests/merge requests/changelists) in a repository, categorized by their state (e.g. open or merged)
Instrument: updowncounter
Unit: {change}
"""
def create_vcs_change_count(meter: Meter) -> UpDownCounter:
"""The number of changes (pull requests/merge requests/changelists) in a repository, categorized by their state (e.g. open or merged)"""
return meter.create_up_down_counter(
name=VCS_CHANGE_COUNT,
description="The number of changes (pull requests/merge requests/changelists) in a repository, categorized by their state (e.g. open or merged).",
unit="{change}",
)
VCS_CHANGE_DURATION: Final = "vcs.change.duration"
"""
The time duration a change (pull request/merge request/changelist) has been in a given state
Instrument: gauge
Unit: s
"""
def create_vcs_change_duration(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""The time duration a change (pull request/merge request/changelist) has been in a given state"""
return meter.create_observable_gauge(
name=VCS_CHANGE_DURATION,
callbacks=callbacks,
description="The time duration a change (pull request/merge request/changelist) has been in a given state.",
unit="s",
)
VCS_CHANGE_TIME_TO_APPROVAL: Final = "vcs.change.time_to_approval"
"""
The amount of time since its creation it took a change (pull request/merge request/changelist) to get the first approval
Instrument: gauge
Unit: s
"""
def create_vcs_change_time_to_approval(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""The amount of time since its creation it took a change (pull request/merge request/changelist) to get the first approval"""
return meter.create_observable_gauge(
name=VCS_CHANGE_TIME_TO_APPROVAL,
callbacks=callbacks,
description="The amount of time since its creation it took a change (pull request/merge request/changelist) to get the first approval.",
unit="s",
)
VCS_CHANGE_TIME_TO_MERGE: Final = "vcs.change.time_to_merge"
"""
The amount of time since its creation it took a change (pull request/merge request/changelist) to get merged into the target(base) ref
Instrument: gauge
Unit: s
"""
def create_vcs_change_time_to_merge(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""The amount of time since its creation it took a change (pull request/merge request/changelist) to get merged into the target(base) ref"""
return meter.create_observable_gauge(
name=VCS_CHANGE_TIME_TO_MERGE,
callbacks=callbacks,
description="The amount of time since its creation it took a change (pull request/merge request/changelist) to get merged into the target(base) ref.",
unit="s",
)
VCS_CONTRIBUTOR_COUNT: Final = "vcs.contributor.count"
"""
The number of unique contributors to a repository
Instrument: gauge
Unit: {contributor}
"""
def create_vcs_contributor_count(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""The number of unique contributors to a repository"""
return meter.create_observable_gauge(
name=VCS_CONTRIBUTOR_COUNT,
callbacks=callbacks,
description="The number of unique contributors to a repository.",
unit="{contributor}",
)
VCS_REF_COUNT: Final = "vcs.ref.count"
"""
The number of refs of type branch or tag in a repository
Instrument: updowncounter
Unit: {ref}
"""
def create_vcs_ref_count(meter: Meter) -> UpDownCounter:
"""The number of refs of type branch or tag in a repository"""
return meter.create_up_down_counter(
name=VCS_REF_COUNT,
description="The number of refs of type branch or tag in a repository.",
unit="{ref}",
)
VCS_REF_LINES_DELTA: Final = "vcs.ref.lines_delta"
"""
The number of lines added/removed in a ref (branch) relative to the ref from the `vcs.ref.base.name` attribute
Instrument: gauge
Unit: {line}
Note: This metric should be reported for each `vcs.line_change.type` value. For example if a ref added 3 lines and removed 2 lines,
instrumentation SHOULD report two measurements: 3 and 2 (both positive numbers).
If number of lines added/removed should be calculated from the start of time, then `vcs.ref.base.name` SHOULD be set to an empty string.
"""
def create_vcs_ref_lines_delta(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""The number of lines added/removed in a ref (branch) relative to the ref from the `vcs.ref.base.name` attribute"""
return meter.create_observable_gauge(
name=VCS_REF_LINES_DELTA,
callbacks=callbacks,
description="The number of lines added/removed in a ref (branch) relative to the ref from the `vcs.ref.base.name` attribute.",
unit="{line}",
)
VCS_REF_REVISIONS_DELTA: Final = "vcs.ref.revisions_delta"
"""
The number of revisions (commits) a ref (branch) is ahead/behind the branch from the `vcs.ref.base.name` attribute
Instrument: gauge
Unit: {revision}
Note: This metric should be reported for each `vcs.revision_delta.direction` value. For example if branch `a` is 3 commits behind and 2 commits ahead of `trunk`,
instrumentation SHOULD report two measurements: 3 and 2 (both positive numbers) and `vcs.ref.base.name` is set to `trunk`.
"""
def create_vcs_ref_revisions_delta(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""The number of revisions (commits) a ref (branch) is ahead/behind the branch from the `vcs.ref.base.name` attribute"""
return meter.create_observable_gauge(
name=VCS_REF_REVISIONS_DELTA,
callbacks=callbacks,
description="The number of revisions (commits) a ref (branch) is ahead/behind the branch from the `vcs.ref.base.name` attribute.",
unit="{revision}",
)
VCS_REF_TIME: Final = "vcs.ref.time"
"""
Time a ref (branch) created from the default branch (trunk) has existed. The `ref.type` attribute will always be `branch`
Instrument: gauge
Unit: s
"""
def create_vcs_ref_time(
meter: Meter, callbacks: Optional[Sequence[CallbackT]]
) -> ObservableGauge:
"""Time a ref (branch) created from the default branch (trunk) has existed. The `ref.type` attribute will always be `branch`"""
return meter.create_observable_gauge(
name=VCS_REF_TIME,
callbacks=callbacks,
description="Time a ref (branch) created from the default branch (trunk) has existed. The `ref.type` attribute will always be `branch`.",
unit="s",
)
VCS_REPOSITORY_COUNT: Final = "vcs.repository.count"
"""
The number of repositories in an organization
Instrument: updowncounter
Unit: {repository}
"""
def create_vcs_repository_count(meter: Meter) -> UpDownCounter:
"""The number of repositories in an organization"""
return meter.create_up_down_counter(
name=VCS_REPOSITORY_COUNT,
description="The number of repositories in an organization.",
unit="{repository}",
)

View File

@@ -0,0 +1,27 @@
# 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
CLIENT_ADDRESS: Final = "client.address"
"""
Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name.
Note: When observed from the server side, and when communicating through an intermediary, `client.address` SHOULD represent the client address behind any intermediaries, for example proxies, if it's available.
"""
CLIENT_PORT: Final = "client.port"
"""
Client port number.
Note: When observed from the server side, and when communicating through an intermediary, `client.port` SHOULD represent the client port behind any intermediaries, for example proxies, if it's available.
"""

View File

@@ -0,0 +1,55 @@
# 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
CODE_COLUMN_NUMBER: Final = "code.column.number"
"""
The column number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. This attribute MUST NOT be used on the Profile signal since the data is already captured in 'message Line'. This constraint is imposed to prevent redundancy and maintain data integrity.
"""
CODE_FILE_PATH: Final = "code.file.path"
"""
The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). This attribute MUST NOT be used on the Profile signal since the data is already captured in 'message Function'. This constraint is imposed to prevent redundancy and maintain data integrity.
"""
CODE_FUNCTION_NAME: Final = "code.function.name"
"""
The method or function fully-qualified name without arguments. The value should fit the natural representation of the language runtime, which is also likely the same used within `code.stacktrace` attribute value. This attribute MUST NOT be used on the Profile signal since the data is already captured in 'message Function'. This constraint is imposed to prevent redundancy and maintain data integrity.
Note: Values and format depends on each language runtime, thus it is impossible to provide an exhaustive list of examples.
The values are usually the same (or prefixes of) the ones found in native stack trace representation stored in
`code.stacktrace` without information on arguments.
Examples:
* 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`
* Go function: `github.com/my/repo/pkg.foo.func5`
* Elixir: `OpenTelemetry.Ctx.new`
* Erlang: `opentelemetry_ctx:new`
* Rust: `playground::my_module::my_cool_func`
* C function: `fopen`.
"""
CODE_LINE_NUMBER: Final = "code.line.number"
"""
The line number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. This attribute MUST NOT be used on the Profile signal since the data is already captured in 'message Line'. This constraint is imposed to prevent redundancy and maintain data integrity.
"""
CODE_STACKTRACE: Final = "code.stacktrace"
"""
A stacktrace as a string in the natural representation for the language runtime. The representation is identical to [`exception.stacktrace`](/docs/exceptions/exceptions-spans.md#stacktrace-representation). This attribute MUST NOT be used on the Profile signal since the data is already captured in 'message Location'. This constraint is imposed to prevent redundancy and maintain data integrity.
"""

View File

@@ -0,0 +1,119 @@
# 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
DB_COLLECTION_NAME: Final = "db.collection.name"
"""
The name of a collection (table, container) within the database.
Note: It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.
The collection name SHOULD NOT be extracted from `db.query.text`,
when the database system supports query text with multiple collections
in non-batch operations.
For batch operations, if the individual operations are known to have the same
collection name then that collection name SHOULD be used.
"""
DB_NAMESPACE: Final = "db.namespace"
"""
The name of the database, fully qualified within the server address and port.
Note: If a database system has multiple namespace components, they SHOULD be concatenated from the most general to the most specific namespace component, using `|` as a separator between the components. Any missing components (and their associated separators) SHOULD be omitted.
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.
"""
DB_OPERATION_BATCH_SIZE: Final = "db.operation.batch.size"
"""
The number of queries included in a batch operation.
Note: Operations are only considered batches when they contain two or more operations, and so `db.operation.batch.size` SHOULD never be `1`.
"""
DB_OPERATION_NAME: Final = "db.operation.name"
"""
The name of the operation or command being executed.
Note: It is RECOMMENDED to capture the value as provided by the application
without attempting to do any case normalization.
The operation name SHOULD NOT be extracted from `db.query.text`,
when the database system supports query text with multiple operations
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
system specific term if more applicable.
"""
DB_QUERY_SUMMARY: Final = "db.query.summary"
"""
Low cardinality summary of a database query.
Note: The query summary describes a class of database queries and is useful
as a grouping key, especially when analyzing telemetry for database
calls involving complex queries.
Summary may be available to the instrumentation through
instrumentation hooks or other means. If it is not available, instrumentations
that support query parsing SHOULD generate a summary following
[Generating query summary](/docs/database/database-spans.md#generating-a-summary-of-the-query)
section.
"""
DB_QUERY_TEXT: Final = "db.query.text"
"""
The database query being executed.
Note: For sanitization see [Sanitization of `db.query.text`](/docs/database/database-spans.md#sanitization-of-dbquerytext).
For batch operations, if the individual operations are known to have the same query text then that query text SHOULD be used, otherwise all of the individual query texts SHOULD be concatenated with separator `; ` or some other database system specific separator if more applicable.
Parameterized query text SHOULD NOT be sanitized. Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk.
"""
DB_RESPONSE_STATUS_CODE: Final = "db.response.status_code"
"""
Database response status code.
Note: The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes.
Semantic conventions for individual database systems SHOULD document what `db.response.status_code` means in the context of that system.
"""
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_NAME: Final = "db.system.name"
"""
The database management system (DBMS) product as identified by the client instrumentation.
Note: The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system.name` is set to `postgresql` based on the instrumentation's best knowledge.
"""
class DbSystemNameValues(Enum):
MARIADB = "mariadb"
"""[MariaDB](https://mariadb.org/)."""
MICROSOFT_SQL_SERVER = "microsoft.sql_server"
"""[Microsoft SQL Server](https://www.microsoft.com/sql-server)."""
MYSQL = "mysql"
"""[MySQL](https://www.mysql.com/)."""
POSTGRESQL = "postgresql"
"""[PostgreSQL](https://www.postgresql.org/)."""

Some files were not shown because too many files have changed in this diff Show More