Skip to content

Commit 28c1b83

Browse files
authored
Update to otel spec version v1.20.0 (#1039)
* Update to otel spec version v1.20.0 * Fix stackdriver usage
1 parent 93880e0 commit 28c1b83

File tree

7 files changed

+303
-134
lines changed

7 files changed

+303
-134
lines changed

opentelemetry-semantic-conventions/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Changed
6+
7+
- Update to v1.20.0 spec
8+
39
## v0.11.0
410
### Changed
511
- Update to `opentelemetry` v0.19.

opentelemetry-semantic-conventions/scripts/generate-consts-from-spec.sh

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55
CRATE_DIR="${SCRIPT_DIR}/../"
66

77
# freeze the spec version and generator version to make generation reproducible
8-
SPEC_VERSION=v1.17.0
9-
SEMCOVGEN_VERSION=0.15.1
8+
SPEC_VERSION=v1.20.0
9+
SEMCOVGEN_VERSION=0.18.0
1010

1111
cd "$CRATE_DIR"
1212

@@ -25,17 +25,18 @@ docker run --rm \
2525
-v "${CRATE_DIR}/scripts/templates:/templates" \
2626
-v "${CRATE_DIR}/src:/output" \
2727
otel/semconvgen:$SEMCOVGEN_VERSION \
28-
--exclude resource/** \
28+
--only span,event,attribute_group,scope \
2929
-f /source code \
3030
--template /templates/semantic_attributes.rs.j2 \
3131
--output /output/trace.rs \
3232
--parameters conventions=trace
3333

3434
docker run --rm \
35-
-v "${CRATE_DIR}/opentelemetry-specification/semantic_conventions/resource:/source" \
35+
-v "${CRATE_DIR}/opentelemetry-specification/semantic_conventions:/source" \
3636
-v "${CRATE_DIR}/scripts/templates:/templates" \
3737
-v "${CRATE_DIR}/src:/output" \
3838
otel/semconvgen:$SEMCOVGEN_VERSION \
39+
--only resource \
3940
-f /source code \
4041
--template /templates/semantic_attributes.rs.j2 \
4142
--output /output/resource.rs \

opentelemetry-semantic-conventions/scripts/templates/header_resource.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! ## Usage
99
//!
10-
//! ```rust,no_run
10+
//! ```
1111
//! use opentelemetry::sdk;
1212
//! use opentelemetry_semantic_conventions as semconv;
1313
//!

opentelemetry-semantic-conventions/scripts/templates/header_trace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! ## Usage
99
//!
10-
//! ```rust
10+
//! ```
1111
//! use opentelemetry::{global, trace::Tracer as _};
1212
//! use opentelemetry_semantic_conventions as semcov;
1313
//!

opentelemetry-semantic-conventions/src/resource.rs

+87-40
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//!
1414
//! ## Usage
1515
//!
16-
//! ```no_run
16+
//! ```
1717
//! use opentelemetry::sdk;
1818
//! use opentelemetry_semantic_conventions as semconv;
1919
//!
@@ -55,15 +55,6 @@ pub const BROWSER_PLATFORM: Key = Key::from_static_str("browser.platform");
5555
/// 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.
5656
pub const BROWSER_MOBILE: Key = Key::from_static_str("browser.mobile");
5757

58-
/// Full user-agent string provided by the browser.
59-
///
60-
/// The user-agent value SHOULD be provided only from browsers that do not have a mechanism to retrieve brands and platform individually from the User-Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` API can be used.
61-
///
62-
/// # Examples
63-
///
64-
/// - `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36`
65-
pub const BROWSER_USER_AGENT: Key = Key::from_static_str("browser.user_agent");
66-
6758
/// Preferred language of the user using the browser.
6859
///
6960
/// This value is intended to be taken from the Navigator API `navigator.language`.
@@ -89,14 +80,41 @@ pub const CLOUD_ACCOUNT_ID: Key = Key::from_static_str("cloud.account.id");
8980

9081
/// The geographical region the resource is running.
9182
///
92-
/// Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://intl.cloud.tencent.com/document/product/213/6091).
83+
/// Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), [Google Cloud regions](https://cloud.google.com/about/locations), or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091).
9384
///
9485
/// # Examples
9586
///
9687
/// - `us-central1`
9788
/// - `us-east-1`
9889
pub const CLOUD_REGION: Key = Key::from_static_str("cloud.region");
9990

91+
/// Cloud provider-specific native identifier of the monitored cloud resource (e.g. an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) on AWS, a [fully qualified resource ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) on Azure, a [full resource name](https://cloud.google.com/apis/design/resource_names#full_resource_name) on GCP).
92+
///
93+
/// On some cloud providers, it may not be possible to determine the full ID at startup,
94+
/// so it may be necessary to set `cloud.resource_id` as a span attribute instead.
95+
///
96+
/// The exact value to use for `cloud.resource_id` depends on the cloud provider.
97+
/// The following well-known definitions MUST be used if you set this attribute and they apply:
98+
///
99+
/// * **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).
100+
/// Take care not to use the "invoked ARN" directly but replace any
101+
/// [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html)
102+
/// with the resolved function version, as the same runtime instance may be invokable with
103+
/// multiple different aliases.
104+
/// * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names)
105+
/// * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) of the invoked function,
106+
/// *not* the function app, having the form
107+
/// `/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>`.
108+
/// This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share
109+
/// a TracerProvider.
110+
///
111+
/// # Examples
112+
///
113+
/// - `arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function`
114+
/// - `//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID`
115+
/// - `/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>`
116+
pub const CLOUD_RESOURCE_ID: Key = Key::from_static_str("cloud.resource_id");
117+
100118
/// Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.
101119
///
102120
/// Availability zones are called &#34;zones&#34; on Alibaba Cloud and Google Cloud.
@@ -192,6 +210,28 @@ pub const AWS_LOG_STREAM_NAMES: Key = Key::from_static_str("aws.log.stream.names
192210
/// - `arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b`
193211
pub const AWS_LOG_STREAM_ARNS: Key = Key::from_static_str("aws.log.stream.arns");
194212

213+
/// Time and date the release was created.
214+
///
215+
/// # Examples
216+
///
217+
/// - `2022-10-23T18:00:42Z`
218+
pub const HEROKU_RELEASE_CREATION_TIMESTAMP: Key =
219+
Key::from_static_str("heroku.release.creation_timestamp");
220+
221+
/// Commit hash for the current release.
222+
///
223+
/// # Examples
224+
///
225+
/// - `e6134959463efd8966b20e75b913cafe3f5ec`
226+
pub const HEROKU_RELEASE_COMMIT: Key = Key::from_static_str("heroku.release.commit");
227+
228+
/// Unique identifier for the application.
229+
///
230+
/// # Examples
231+
///
232+
/// - `2daa2797-e42b-4624-9322-ec3f968df4da`
233+
pub const HEROKU_APP_ID: Key = Key::from_static_str("heroku.app.id");
234+
195235
/// Container name used by container runtime.
196236
///
197237
/// # Examples
@@ -293,38 +333,14 @@ pub const DEVICE_MANUFACTURER: Key = Key::from_static_str("device.manufacturer")
293333
/// can also be seen in the resource JSON for the function).
294334
/// This means that a span attribute MUST be used, as an Azure function
295335
/// app can host multiple functions that would usually share
296-
/// a TracerProvider (see also the `faas.id` attribute).
336+
/// a TracerProvider (see also the `cloud.resource_id` attribute).
297337
///
298338
/// # Examples
299339
///
300340
/// - `my-function`
301341
/// - `myazurefunctionapp/some-function-name`
302342
pub const FAAS_NAME: Key = Key::from_static_str("faas.name");
303343

304-
/// The unique ID of the single function that this runtime instance executes.
305-
///
306-
/// On some cloud providers, it may not be possible to determine the full ID at startup,
307-
/// so consider setting `faas.id` as a span attribute instead.
308-
///
309-
/// The exact value to use for `faas.id` depends on the cloud provider:
310-
///
311-
/// * **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).
312-
/// Take care not to use the &#34;invoked ARN&#34; directly but replace any
313-
/// [alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html)
314-
/// with the resolved function version, as the same runtime instance may be invokable with
315-
/// multiple different aliases.
316-
/// * **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names)
317-
/// * **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) of the invoked function,
318-
/// *not* the function app, having the form
319-
/// `/subscriptions/&lt;SUBSCIPTION_GUID&gt;/resourceGroups/&lt;RG&gt;/providers/Microsoft.Web/sites/&lt;FUNCAPP&gt;/functions/&lt;FUNC&gt;`.
320-
/// This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share
321-
/// a TracerProvider.
322-
///
323-
/// # Examples
324-
///
325-
/// - `arn:aws:lambda:us-west-2:123456789012:function:my-function`
326-
pub const FAAS_ID: Key = Key::from_static_str("faas.id");
327-
328344
/// The immutable version of the function being executed.
329345
///
330346
/// Depending on the cloud provider and platform, use:
@@ -352,16 +368,16 @@ pub const FAAS_VERSION: Key = Key::from_static_str("faas.version");
352368
/// - `2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de`
353369
pub const FAAS_INSTANCE: Key = Key::from_static_str("faas.instance");
354370

355-
/// The amount of memory available to the serverless function in MiB.
371+
/// The amount of memory available to the serverless function converted to Bytes.
356372
///
357-
/// It&#39;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.
373+
/// It&#39;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).
358374
///
359375
/// # Examples
360376
///
361-
/// - `128`
377+
/// - `134217728`
362378
pub const FAAS_MAX_MEMORY: Key = Key::from_static_str("faas.max_memory");
363379

364-
/// Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized Linux systems, the `machine-id` located in `/etc/machine-id` or `/var/lib/dbus/machine-id` may be used.
380+
/// 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.
365381
///
366382
/// # Examples
367383
///
@@ -678,6 +694,7 @@ pub const SERVICE_NAMESPACE: Key = Key::from_static_str("service.namespace");
678694
///
679695
/// # Examples
680696
///
697+
/// - `my-k8s-pod-deployment-1`
681698
/// - `627cc493-f310-47de-96bd-71410b7dec09`
682699
pub const SERVICE_INSTANCE_ID: Key = Key::from_static_str("service.instance.id");
683700

@@ -732,3 +749,33 @@ pub const WEBENGINE_VERSION: Key = Key::from_static_str("webengine.version");
732749
///
733750
/// - `WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - 2.2.2.Final`
734751
pub const WEBENGINE_DESCRIPTION: Key = Key::from_static_str("webengine.description");
752+
753+
/// The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP).
754+
///
755+
/// # Examples
756+
///
757+
/// - `io.opentelemetry.contrib.mongodb`
758+
pub const OTEL_SCOPE_NAME: Key = Key::from_static_str("otel.scope.name");
759+
760+
/// The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP).
761+
///
762+
/// # Examples
763+
///
764+
/// - `1.0.0`
765+
pub const OTEL_SCOPE_VERSION: Key = Key::from_static_str("otel.scope.version");
766+
767+
/// Deprecated, use the `otel.scope.name` attribute.
768+
///
769+
/// # Examples
770+
///
771+
/// - `io.opentelemetry.contrib.mongodb`
772+
#[deprecated]
773+
pub const OTEL_LIBRARY_NAME: Key = Key::from_static_str("otel.library.name");
774+
775+
/// Deprecated, use the `otel.scope.version` attribute.
776+
///
777+
/// # Examples
778+
///
779+
/// - `1.0.0`
780+
#[deprecated]
781+
pub const OTEL_LIBRARY_VERSION: Key = Key::from_static_str("otel.library.version");

0 commit comments

Comments
 (0)