Skip to content

Commit 0f6699d

Browse files
authored
Generate semconv constants update for OTel Spec 1.5.0 (#1946)
1 parent 12fe4c9 commit 0f6699d

File tree

4 files changed

+304
-68
lines changed

4 files changed

+304
-68
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.3.0-0.22b0...HEAD)
8+
- `opentelemetry-semantic-conventions` Generate semconv constants update for OTel Spec 1.5.0
9+
([#1946](https://github.com/open-telemetry/opentelemetry-python/pull/1946))
810

911
### Added
1012
- Dropped attributes/events/links count available exposed on ReadableSpans.

opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py

Lines changed: 99 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class ResourceAttributes:
3737
Note: Availability zones are called "zones" on Google Cloud.
3838
"""
3939

40-
CLOUD_INFRASTRUCTURE_SERVICE = "cloud.infrastructure_service"
40+
CLOUD_PLATFORM = "cloud.platform"
4141
"""
42-
The cloud infrastructure resource in use.
42+
The cloud platform in use.
4343
Note: The prefix of the service SHOULD match the one specified in `cloud.provider`.
4444
"""
4545

@@ -68,6 +68,11 @@ class ResourceAttributes:
6868
The task definition family this task definition is a member of.
6969
"""
7070

71+
AWS_ECS_TASK_REVISION = "aws.ecs.task.revision"
72+
"""
73+
The revision for this task definition.
74+
"""
75+
7176
AWS_EKS_CLUSTER_ARN = "aws.eks.cluster.arn"
7277
"""
7378
The ARN of an EKS cluster.
@@ -126,25 +131,67 @@ class ResourceAttributes:
126131
Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka deployment tier).
127132
"""
128133

134+
DEVICE_ID = "device.id"
135+
"""
136+
A unique identifier representing the device.
137+
Note: The device identifier MUST only be defined using the values outlined below. This value is not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation ID or a globally unique UUID which is persisted across sessions in your application. More information can be found [here](https://developer.android.com/training/articles/user-data-ids) on best practices and exact implementation details. Caution should be taken when storing personal data or anything which can identify a user. GDPR and data protection laws may apply, ensure you do your own due diligence.
138+
"""
139+
140+
DEVICE_MODEL_IDENTIFIER = "device.model.identifier"
141+
"""
142+
The model identifier for the device.
143+
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.
144+
"""
145+
146+
DEVICE_MODEL_NAME = "device.model.name"
147+
"""
148+
The marketing name for the device model.
149+
Note: It's recommended this value represents a human readable version of the device model rather than a machine readable alternative.
150+
"""
151+
129152
FAAS_NAME = "faas.name"
130153
"""
131-
The name of the function being executed.
154+
The name of the single function that this runtime instance executes.
155+
Note: This is the name of the function as configured/deployed on the FaaS platform and is usually different from the name of the callback function (which may be stored in the [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) span attributes).
132156
"""
133157

134158
FAAS_ID = "faas.id"
135159
"""
136-
The unique ID of the function being executed.
137-
Note: For example, in AWS Lambda this field corresponds to the [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) value, in GCP to the URI of the resource, and in Azure to the [FunctionDirectory](https://github.com/Azure/azure-functions-host/wiki/Retrieving-information-about-the-currently-running-function) field.
160+
The unique ID of the single function that this runtime instance executes.
161+
Note: Depending on the cloud provider, use:
162+
163+
* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).
164+
Take care not to use the "invoked ARN" directly but replace any
165+
[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) with the resolved function version, as the same runtime instance may be invokable with multiple
166+
different aliases.
167+
* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names)
168+
* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id).
169+
170+
On some providers, it may not be possible to determine the full ID at startup,
171+
which is why this field cannot be made required. For example, on AWS the account ID
172+
part of the ARN is not available without calling another AWS API
173+
which may be deemed too slow for a short-running lambda function.
174+
As an alternative, consider setting `faas.id` as a span attribute instead.
138175
"""
139176

140177
FAAS_VERSION = "faas.version"
141178
"""
142-
The version string of the function being executed as defined in [Version Attributes](../../resource/semantic_conventions/README.md#version-attributes).
179+
The immutable version of the function being executed.
180+
Note: Depending on the cloud provider and platform, use:
181+
182+
* **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html)
183+
(an integer represented as a decimal string).
184+
* **Google Cloud Run:** The [revision](https://cloud.google.com/run/docs/managing/revisions)
185+
(i.e., the function name plus the revision suffix).
186+
* **Google Cloud Functions:** The value of the
187+
[`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically).
188+
* **Azure Functions:** Not applicable. Do not set this attribute.
143189
"""
144190

145191
FAAS_INSTANCE = "faas.instance"
146192
"""
147-
The execution environment ID as a string.
193+
The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version.
194+
Note: * **AWS Lambda:** Use the (full) log stream name.
148195
"""
149196

150197
FAAS_MAX_MEMORY = "faas.max_memory"
@@ -293,6 +340,16 @@ class ResourceAttributes:
293340
Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands.
294341
"""
295342

343+
OS_NAME = "os.name"
344+
"""
345+
Human readable operating system name.
346+
"""
347+
348+
OS_VERSION = "os.version"
349+
"""
350+
The version string of the operating system as defined in [Version Attributes](../../resource/semantic_conventions/README.md#version-attributes).
351+
"""
352+
296353
PROCESS_PID = "process.pid"
297354
"""
298355
Process identifier (PID).
@@ -386,6 +443,21 @@ class ResourceAttributes:
386443
The version string of the auto instrumentation agent, if used.
387444
"""
388445

446+
WEBENGINE_NAME = "webengine.name"
447+
"""
448+
The name of the web engine.
449+
"""
450+
451+
WEBENGINE_VERSION = "webengine.version"
452+
"""
453+
The version of the web engine.
454+
"""
455+
456+
WEBENGINE_DESCRIPTION = "webengine.description"
457+
"""
458+
Additional description of the web engine (e.g. detailed version and edition information).
459+
"""
460+
389461

390462
class CloudProviderValues(Enum):
391463
AWS = "aws"
@@ -398,7 +470,7 @@ class CloudProviderValues(Enum):
398470
"""Google Cloud Platform."""
399471

400472

401-
class CloudInfrastructureServiceValues(Enum):
473+
class CloudPlatformValues(Enum):
402474
AWS_EC2 = "aws_ec2"
403475
"""AWS Elastic Compute Cloud."""
404476

@@ -411,13 +483,13 @@ class CloudInfrastructureServiceValues(Enum):
411483
AWS_LAMBDA = "aws_lambda"
412484
"""AWS Lambda."""
413485

414-
AWS_ELASTICBEANSTALK = "aws_elastic_beanstalk"
486+
AWS_ELASTIC_BEANSTALK = "aws_elastic_beanstalk"
415487
"""AWS Elastic Beanstalk."""
416488

417489
AZURE_VM = "azure_vm"
418490
"""Azure Virtual Machines."""
419491

420-
AZURE_CONTAINERINSTANCES = "azure_container_instances"
492+
AZURE_CONTAINER_INSTANCES = "azure_container_instances"
421493
"""Azure Container Instances."""
422494

423495
AZURE_AKS = "azure_aks"
@@ -426,22 +498,22 @@ class CloudInfrastructureServiceValues(Enum):
426498
AZURE_FUNCTIONS = "azure_functions"
427499
"""Azure Functions."""
428500

429-
AZURE_APPSERVICE = "azure_app_service"
501+
AZURE_APP_SERVICE = "azure_app_service"
430502
"""Azure App Service."""
431503

432-
GCP_COMPUTEENGINE = "gcp_compute_engine"
504+
GCP_COMPUTE_ENGINE = "gcp_compute_engine"
433505
"""Google Cloud Compute Engine (GCE)."""
434506

435-
GCP_CLOUDRUN = "gcp_cloud_run"
507+
GCP_CLOUD_RUN = "gcp_cloud_run"
436508
"""Google Cloud Run."""
437509

438-
GCP_KUBERNETESENGINE = "gcp_kubernetes_engine"
510+
GCP_KUBERNETES_ENGINE = "gcp_kubernetes_engine"
439511
"""Google Cloud Kubernetes Engine (GKE)."""
440512

441-
GCP_CLOUDFUNCTIONS = "gcp_cloud_functions"
513+
GCP_CLOUD_FUNCTIONS = "gcp_cloud_functions"
442514
"""Google Cloud Functions (GCF)."""
443515

444-
GCP_APPENGINE = "gcp_app_engine"
516+
GCP_APP_ENGINE = "gcp_app_engine"
445517
"""Google Cloud App Engine (GAE)."""
446518

447519

@@ -477,37 +549,37 @@ class HostArchValues(Enum):
477549

478550

479551
class OsTypeValues(Enum):
480-
WINDOWS = "WINDOWS"
552+
WINDOWS = "windows"
481553
"""Microsoft Windows."""
482554

483-
LINUX = "LINUX"
555+
LINUX = "linux"
484556
"""Linux."""
485557

486-
DARWIN = "DARWIN"
558+
DARWIN = "darwin"
487559
"""Apple Darwin."""
488560

489-
FREEBSD = "FREEBSD"
561+
FREEBSD = "freebsd"
490562
"""FreeBSD."""
491563

492-
NETBSD = "NETBSD"
564+
NETBSD = "netbsd"
493565
"""NetBSD."""
494566

495-
OPENBSD = "OPENBSD"
567+
OPENBSD = "openbsd"
496568
"""OpenBSD."""
497569

498-
DRAGONFLYBSD = "DRAGONFLYBSD"
570+
DRAGONFLYBSD = "dragonflybsd"
499571
"""DragonFly BSD."""
500572

501-
HPUX = "HPUX"
573+
HPUX = "hpux"
502574
"""HP-UX (Hewlett Packard Unix)."""
503575

504-
AIX = "AIX"
576+
AIX = "aix"
505577
"""AIX (Advanced Interactive eXecutive)."""
506578

507-
SOLARIS = "SOLARIS"
579+
SOLARIS = "solaris"
508580
"""Oracle Solaris."""
509581

510-
ZOS = "ZOS"
582+
Z_OS = "z_os"
511583
"""IBM z/OS."""
512584

513585

0 commit comments

Comments
 (0)