Skip to content

Commit 2447fb0

Browse files
authored
Expand scope of faas.id to cloud.resource_id (open-telemetry#3188)
## Changes As per the discussion on open-telemetry#3188, we determined it is better to move rather than remove as this attribute is still important for some systems despite it containing duplicated information.
1 parent 12481fe commit 2447fb0

File tree

9 files changed

+89
-67
lines changed

9 files changed

+89
-67
lines changed

schemas/1.19.0

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ versions:
88
- rename_attributes:
99
attribute_map:
1010
faas.execution: faas.invocation_id
11+
# https://github.com/open-telemetry/opentelemetry-specification/pull/3188
12+
- rename_attributes:
13+
attribute_map:
14+
faas.id: cloud.resource_id
1115
1.18.0:
1216
1.17.0:
1317
spans:

semantic_conventions/resource/cloud.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,35 @@ groups:
5050
[Google Cloud regions](https://cloud.google.com/about/locations),
5151
or [Tencent Cloud regions](https://www.tencentcloud.com/document/product/213/6091).
5252
examples: ['us-central1', 'us-east-1']
53+
- id: resource_id
54+
type: string
55+
brief: >
56+
Cloud provider-specific native identifier of the monitored cloud resource
57+
(e.g. an [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) on AWS,
58+
a [fully qualified resource ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) on Azure,
59+
a [full resource name](https://cloud.google.com/apis/design/resource_names#full_resource_name) on GCP)
60+
note: |
61+
On some cloud providers, it may not be possible to determine the full ID at startup,
62+
so it may be necessary to set `cloud.resource_id` as a span attribute instead.
63+
64+
The exact value to use for `cloud.resource_id` depends on the cloud provider.
65+
The following well-known definitions MUST be used if you set this attribute and they apply:
66+
67+
* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).
68+
Take care not to use the "invoked ARN" directly but replace any
69+
[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html)
70+
with the resolved function version, as the same runtime instance may be invokable with
71+
multiple different aliases.
72+
* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names)
73+
* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) of the invoked function,
74+
*not* the function app, having the form
75+
`/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>`.
76+
This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share
77+
a TracerProvider.
78+
examples:
79+
- 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function'
80+
- '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID'
81+
- '/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>'
5382
- id: availability_zone
5483
type: string
5584
brief: >

semantic_conventions/resource/faas.yaml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,8 @@ groups:
2626
can also be seen in the resource JSON for the function).
2727
This means that a span attribute MUST be used, as an Azure function
2828
app can host multiple functions that would usually share
29-
a TracerProvider (see also the `faas.id` attribute).
29+
a TracerProvider (see also the `cloud.resource_id` attribute).
3030
examples: ['my-function', 'myazurefunctionapp/some-function-name']
31-
- id: id
32-
type: string
33-
brief: >
34-
The unique ID of the single function that this runtime instance executes.
35-
note: |
36-
On some cloud providers, it may not be possible to determine the full ID at startup,
37-
so consider setting `faas.id` as a span attribute instead.
38-
39-
The exact value to use for `faas.id` depends on the cloud provider:
40-
41-
* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).
42-
Take care not to use the "invoked ARN" directly but replace any
43-
[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html)
44-
with the resolved function version, as the same runtime instance may be invokable with
45-
multiple different aliases.
46-
* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names)
47-
* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) of the invoked function,
48-
*not* the function app, having the form
49-
`/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>`.
50-
This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share
51-
a TracerProvider.
52-
examples: ['arn:aws:lambda:us-west-2:123456789012:function:my-function']
5331
- id: version
5432
type: string
5533
brief: The immutable version of the function being executed.

semantic_conventions/trace/aws/lambda.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ groups:
1010
brief: >
1111
The full invoked ARN as provided on the `Context` passed to the function
1212
(`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable).
13-
note: This may be different from `faas.id` if an alias is involved.
13+
note: This may be different from `cloud.resource_id` if an alias is involved.
1414
examples: ['arn:aws:lambda:us-east-1:123456:function:myfunction:myalias']

semantic_conventions/trace/faas.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ groups:
4141
type: string
4242
brief: 'The invocation ID of the current function invocation.'
4343
examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28'
44-
44+
- ref: cloud.resource_id
4545
- id: faas_span.datasource
4646
prefix: faas.document
4747
type: span

specification/resource/semantic_conventions/cloud.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,33 @@
1212
| `cloud.provider` | string | Name of the cloud provider. | `alibaba_cloud` | Recommended |
1313
| `cloud.account.id` | string | The cloud account ID the resource is assigned to. | `111111111111`; `opentelemetry` | Recommended |
1414
| `cloud.region` | string | The geographical region the resource is running. [1] | `us-central1`; `us-east-1` | Recommended |
15-
| `cloud.availability_zone` | string | Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running. [2] | `us-east-1c` | Recommended |
16-
| `cloud.platform` | string | The cloud platform in use. [3] | `alibaba_cloud_ecs` | Recommended |
15+
| `cloud.resource_id` | string | 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) [2] | `arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function`; `//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID`; `/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>` | Recommended |
16+
| `cloud.availability_zone` | string | Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running. [3] | `us-east-1c` | Recommended |
17+
| `cloud.platform` | string | The cloud platform in use. [4] | `alibaba_cloud_ecs` | Recommended |
1718

1819
**[1]:** 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).
1920

20-
**[2]:** Availability zones are called "zones" on Alibaba Cloud and Google Cloud.
21+
**[2]:** On some cloud providers, it may not be possible to determine the full ID at startup,
22+
so it may be necessary to set `cloud.resource_id` as a span attribute instead.
2123

22-
**[3]:** The prefix of the service SHOULD match the one specified in `cloud.provider`.
24+
The exact value to use for `cloud.resource_id` depends on the cloud provider.
25+
The following well-known definitions MUST be used if you set this attribute and they apply:
26+
27+
* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).
28+
Take care not to use the "invoked ARN" directly but replace any
29+
[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html)
30+
with the resolved function version, as the same runtime instance may be invokable with
31+
multiple different aliases.
32+
* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names)
33+
* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) of the invoked function,
34+
*not* the function app, having the form
35+
`/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>`.
36+
This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share
37+
a TracerProvider.
38+
39+
**[3]:** Availability zones are called "zones" on Alibaba Cloud and Google Cloud.
40+
41+
**[4]:** The prefix of the service SHOULD match the one specified in `cloud.provider`.
2342

2443
`cloud.provider` has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.
2544

specification/resource/semantic_conventions/faas.md

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ See also:
1717
| Attribute | Type | Description | Examples | Requirement Level |
1818
|---|---|---|---|---|
1919
| `faas.name` | string | The name of the single function that this runtime instance executes. [1] | `my-function`; `myazurefunctionapp/some-function-name` | Required |
20-
| `faas.id` | string | The unique ID of the single function that this runtime instance executes. [2] | `arn:aws:lambda:us-west-2:123456789012:function:my-function` | Recommended |
21-
| `faas.version` | string | The immutable version of the function being executed. [3] | `26`; `pinkfroid-00002` | Recommended |
22-
| `faas.instance` | string | The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version. [4] | `2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de` | Recommended |
23-
| `faas.max_memory` | int | The amount of memory available to the serverless function converted to Bytes. [5] | `134217728` | Recommended |
20+
| `faas.version` | string | The immutable version of the function being executed. [2] | `26`; `pinkfroid-00002` | Recommended |
21+
| `faas.instance` | string | The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version. [3] | `2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de` | Recommended |
22+
| `faas.max_memory` | int | The amount of memory available to the serverless function converted to Bytes. [4] | `134217728` | Recommended |
2423

2524
**[1]:** This is the name of the function as configured/deployed on the FaaS
2625
platform and is usually different from the name of the callback
@@ -37,26 +36,9 @@ definition of function name MUST be used for this attribute
3736
can also be seen in the resource JSON for the function).
3837
This means that a span attribute MUST be used, as an Azure function
3938
app can host multiple functions that would usually share
40-
a TracerProvider (see also the `faas.id` attribute).
39+
a TracerProvider (see also the `cloud.resource_id` attribute).
4140

42-
**[2]:** On some cloud providers, it may not be possible to determine the full ID at startup,
43-
so consider setting `faas.id` as a span attribute instead.
44-
45-
The exact value to use for `faas.id` depends on the cloud provider:
46-
47-
* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).
48-
Take care not to use the "invoked ARN" directly but replace any
49-
[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html)
50-
with the resolved function version, as the same runtime instance may be invokable with
51-
multiple different aliases.
52-
* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names)
53-
* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) of the invoked function,
54-
*not* the function app, having the form
55-
`/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>`.
56-
This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share
57-
a TracerProvider.
58-
59-
**[3]:** Depending on the cloud provider and platform, use:
41+
**[2]:** Depending on the cloud provider and platform, use:
6042

6143
* **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html)
6244
(an integer represented as a decimal string).
@@ -66,9 +48,9 @@ The exact value to use for `faas.id` depends on the cloud provider:
6648
[`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically).
6749
* **Azure Functions:** Not applicable. Do not set this attribute.
6850

69-
**[4]:** * **AWS Lambda:** Use the (full) log stream name.
51+
**[3]:** * **AWS Lambda:** Use the (full) log stream name.
7052

71-
**[5]:** 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).
53+
**[4]:** 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).
7254
<!-- endsemconv -->
7355

7456
Note: The resource attribute `faas.instance` differs from the span attribute `faas.invocation_id`. For more information see the [Semantic conventions for FaaS spans](../../trace/semantic_conventions/faas.md#difference-between-invocation-and-instance).

specification/trace/semantic_conventions/faas.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ If Spans following this convention are produced, a Resource of type `faas` MUST
3939
|---|---|---|---|---|
4040
| `faas.trigger` | string | Type of the trigger which caused this function invocation. [1] | `datasource` | Recommended |
4141
| `faas.invocation_id` | string | The invocation ID of the current function invocation. | `af9d5aa4-a685-4c5f-a22b-444f80b3cc28` | Recommended |
42+
| [`cloud.resource_id`](../../resource/semantic_conventions/cloud.md) | string | 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) [2] | `arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function`; `//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID`; `/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>` | Recommended |
4243

4344
**[1]:** For the server/consumer span on the incoming side,
4445
`faas.trigger` MUST be set.
@@ -50,6 +51,24 @@ trigger that corresponding incoming would have (i.e., this has
5051
nothing to do with the underlying transport used to make the API
5152
call to invoke the lambda, which is often HTTP).
5253

54+
**[2]:** On some cloud providers, it may not be possible to determine the full ID at startup,
55+
so it may be necessary to set `cloud.resource_id` as a span attribute instead.
56+
57+
The exact value to use for `cloud.resource_id` depends on the cloud provider.
58+
The following well-known definitions MUST be used if you set this attribute and they apply:
59+
60+
* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html).
61+
Take care not to use the "invoked ARN" directly but replace any
62+
[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html)
63+
with the resolved function version, as the same runtime instance may be invokable with
64+
multiple different aliases.
65+
* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names)
66+
* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) of the invoked function,
67+
*not* the function app, having the form
68+
`/subscriptions/<SUBSCIPTION_GUID>/resourceGroups/<RG>/providers/Microsoft.Web/sites/<FUNCAPP>/functions/<FUNC>`.
69+
This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share
70+
a TracerProvider.
71+
5372
`faas.trigger` MUST be one of the following:
5473

5574
| Value | Description |
@@ -121,7 +140,7 @@ FaaS environments some of the information required for resource
121140
attributes is only readily available in the context of an invocation (e.g. as part of a "request context" argument)
122141
and while a separate API call to look up the resource information is often possible, it
123142
may be prohibitively expensive due to cold start duration concerns.
124-
The `faas.id` and `cloud.account.id` attributes on AWS are some examples.
143+
The `cloud.resource_id` and `cloud.account.id` attributes on AWS are some examples.
125144
In principle, the above considerations apply to any resource attribute that fulfills the criteria above
126145
(not being readily available without some extra effort that could be expensive).
127146

@@ -233,6 +252,5 @@ This example shows the FaaS attributes for a (non-FaaS) process hosted on Google
233252
| Span | `faas.invocation_id` | n/a | `"af9d5aa4-a685-4c5f-a22b-444f80b3cc28"` |
234253
| Span | `faas.coldstart` | n/a | `true` |
235254
| Resource | `faas.name` | n/a | `"my-lambda-function"` |
236-
| Resource | `faas.id` | n/a | `"arn:aws:lambda:us-west-2:123456789012:function:my-lambda-function"` |
237255
| Resource | `faas.version` | n/a | `"semver:2.0.0"` |
238256
| Resource | `faas.instance` | n/a | `"my-lambda-function:instance-0001"` |

0 commit comments

Comments
 (0)