Skip to content

Commit 0ac7ca1

Browse files
committed
use gen-semconv-ts.js script from open-telemetry#2669 to generate semconv.ts file
1 parent fe0895f commit 0ac7ca1

File tree

2 files changed

+292
-17
lines changed

2 files changed

+292
-17
lines changed

detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsBeanstalkDetectorSync.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ import {
2424
ResourceAttributes,
2525
ResourceDetectionConfig,
2626
} from '@opentelemetry/resources';
27+
import {
28+
ATTR_SERVICE_NAME,
29+
ATTR_SERVICE_VERSION,
30+
} from '@opentelemetry/semantic-conventions';
2731
import {
2832
ATTR_CLOUD_PROVIDER,
2933
ATTR_CLOUD_PLATFORM,
30-
ATTR_SERVICE_NAME,
3134
ATTR_SERVICE_NAMESPACE,
32-
ATTR_SERVICE_VERSION,
3335
ATTR_SERVICE_INSTANCE_ID,
3436
CLOUD_PROVIDER_VALUE_AWS,
3537
CLOUD_PLATFORM_VALUE_AWS_ELASTIC_BEANSTALK,

detectors/node/opentelemetry-resource-detector-aws/src/semconv.ts

Lines changed: 288 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,59 +14,332 @@
1414
* limitations under the License.
1515
*/
1616

17-
/**
18-
* Following OpenTelemetry semantic conventions best practices, we copy the incubating
19-
* semantic conventions into our codebase rather than importing them directly.
20-
* This prevents breaking changes in minor versions and reduces disk usage from multiple versions.
17+
/*
18+
* This file contains a copy of unstable semantic convention definitions
19+
* used by this package.
2120
* @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
2221
*/
2322

24-
// AWS attributes
23+
/**
24+
* The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html).
25+
*
26+
* @example arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster
27+
*
28+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
29+
*/
2530
export const ATTR_AWS_ECS_CLUSTER_ARN = 'aws.ecs.cluster.arn';
31+
32+
/**
33+
* The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html).
34+
*
35+
* @example arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9
36+
*
37+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
38+
*/
2639
export const ATTR_AWS_ECS_CONTAINER_ARN = 'aws.ecs.container.arn';
40+
41+
/**
42+
* The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task.
43+
*
44+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
45+
*/
2746
export const ATTR_AWS_ECS_LAUNCHTYPE = 'aws.ecs.launchtype';
47+
48+
/**
49+
* The ARN of a running [ECS task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids).
50+
*
51+
* @example arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b
52+
* @example arn:aws:ecs:us-west-1:123456789123:task/my-cluster/task-id/23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd
53+
*
54+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
55+
*/
2856
export const ATTR_AWS_ECS_TASK_ARN = 'aws.ecs.task.arn';
57+
58+
/**
59+
* 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.
60+
*
61+
* @example opentelemetry-family
62+
*
63+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
64+
*/
2965
export const ATTR_AWS_ECS_TASK_FAMILY = 'aws.ecs.task.family';
66+
67+
/**
68+
* The revision for the task definition used to create the ECS task.
69+
*
70+
* @example 8
71+
* @example 26
72+
*
73+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
74+
*/
3075
export const ATTR_AWS_ECS_TASK_REVISION = 'aws.ecs.task.revision';
76+
77+
/**
78+
* The Amazon Resource Name(s) (ARN) of the AWS log group(s).
79+
*
80+
* @example ["arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*"]
81+
*
82+
* @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).
83+
*
84+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
85+
*/
3186
export const ATTR_AWS_LOG_GROUP_ARNS = 'aws.log.group.arns';
87+
88+
/**
89+
* The name(s) of the AWS log group(s) an application is writing to.
90+
*
91+
* @example ["/aws/lambda/my-function", "opentelemetry-service"]
92+
*
93+
* @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.
94+
*
95+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
96+
*/
3297
export const ATTR_AWS_LOG_GROUP_NAMES = 'aws.log.group.names';
98+
99+
/**
100+
* The ARN(s) of the AWS log stream(s).
101+
*
102+
* @example ["arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b"]
103+
*
104+
* @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.
105+
*
106+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
107+
*/
33108
export const ATTR_AWS_LOG_STREAM_ARNS = 'aws.log.stream.arns';
109+
110+
/**
111+
* The name(s) of the AWS log stream(s) an application is writing to.
112+
*
113+
* @example ["logs/main/10838bed-421f-43ef-870a-f43feacbbb5b"]
114+
*
115+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
116+
*/
34117
export const ATTR_AWS_LOG_STREAM_NAMES = 'aws.log.stream.names';
35118

36-
// Cloud attributes
119+
/**
120+
* The cloud account ID the resource is assigned to.
121+
*
122+
* @example 111111111111
123+
* @example opentelemetry
124+
*
125+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
126+
*/
37127
export const ATTR_CLOUD_ACCOUNT_ID = 'cloud.account.id';
128+
129+
/**
130+
* Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running.
131+
*
132+
* @example us-east-1c
133+
*
134+
* @note Availability zones are called "zones" on Alibaba Cloud and Google Cloud.
135+
*
136+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
137+
*/
38138
export const ATTR_CLOUD_AVAILABILITY_ZONE = 'cloud.availability_zone';
139+
140+
/**
141+
* The cloud platform in use.
142+
*
143+
* @note The prefix of the service **SHOULD** match the one specified in `cloud.provider`.
144+
*
145+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
146+
*/
39147
export const ATTR_CLOUD_PLATFORM = 'cloud.platform';
148+
149+
/**
150+
* Name of the cloud provider.
151+
*
152+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
153+
*/
40154
export const ATTR_CLOUD_PROVIDER = 'cloud.provider';
155+
156+
/**
157+
* The geographical region the resource is running.
158+
*
159+
* @example us-central1
160+
* @example us-east-1
161+
*
162+
* @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).
163+
*
164+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
165+
*/
41166
export const ATTR_CLOUD_REGION = 'cloud.region';
42167

43-
// Container attributes
168+
/**
169+
* 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.
170+
*
171+
* @example a3bf90e006b2
172+
*
173+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
174+
*/
44175
export const ATTR_CONTAINER_ID = 'container.id';
176+
177+
/**
178+
* Container name used by container runtime.
179+
*
180+
* @example opentelemetry-autoconf
181+
*
182+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
183+
*/
45184
export const ATTR_CONTAINER_NAME = 'container.name';
46185

47-
// FaaS attributes
186+
/**
187+
* The name of the single function that this runtime instance executes.
188+
*
189+
* @example my-function
190+
* @example myazurefunctionapp/some-function-name
191+
*
192+
* @note This is the name of the function as configured/deployed on the FaaS
193+
* platform and is usually different from the name of the callback
194+
* function (which may be stored in the
195+
* [`code.namespace`/`code.function`](/docs/general/attributes.md#source-code-attributes)
196+
* span attributes).
197+
*
198+
* For some cloud providers, the above definition is ambiguous. The following
199+
* definition of function name **MUST** be used for this attribute
200+
* (and consequently the span name) for the listed cloud providers/products:
201+
*
202+
* - **Azure:** The full name `<FUNCAPP>/<FUNC>`, i.e., function app name
203+
* followed by a forward slash followed by the function name (this form
204+
* can also be seen in the resource JSON for the function).
205+
* This means that a span attribute **MUST** be used, as an Azure function
206+
* app can host multiple functions that would usually share
207+
* a TracerProvider (see also the `cloud.resource_id` attribute).
208+
*
209+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
210+
*/
48211
export const ATTR_FAAS_NAME = 'faas.name';
212+
213+
/**
214+
* The immutable version of the function being executed.
215+
*
216+
* @example 26
217+
* @example pinkfroid-00002
218+
*
219+
* @note Depending on the cloud provider and platform, use:
220+
*
221+
* - **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html)
222+
* (an integer represented as a decimal string).
223+
* - **Google Cloud Run (Services):** The [revision](https://cloud.google.com/run/docs/managing/revisions)
224+
* (i.e., the function name plus the revision suffix).
225+
* - **Google Cloud Functions:** The value of the
226+
* [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically).
227+
* - **Azure Functions:** Not applicable. Do not set this attribute.
228+
*
229+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
230+
*/
49231
export const ATTR_FAAS_VERSION = 'faas.version';
50232

51-
// Host attributes
233+
/**
234+
* 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.
235+
*
236+
* @example fdbf79e8af94cb7f9e8df36789187052
237+
*
238+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
239+
*/
52240
export const ATTR_HOST_ID = 'host.id';
241+
242+
/**
243+
* 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.
244+
*
245+
* @example opentelemetry-test
246+
*
247+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
248+
*/
53249
export const ATTR_HOST_NAME = 'host.name';
250+
251+
/**
252+
* Type of host. For Cloud, this must be the machine type.
253+
*
254+
* @example n1-standard-1
255+
*
256+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
257+
*/
54258
export const ATTR_HOST_TYPE = 'host.type';
55259

56-
// Kubernetes attributes
260+
/**
261+
* The name of the cluster.
262+
*
263+
* @example opentelemetry-cluster
264+
*
265+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
266+
*/
57267
export const ATTR_K8S_CLUSTER_NAME = 'k8s.cluster.name';
58268

59-
// Service attributes
269+
/**
270+
* The string ID of the service instance.
271+
*
272+
* @example 627cc493-f310-47de-96bd-71410b7dec09
273+
*
274+
* @note **MUST** be unique for each instance of the same `service.namespace,service.name` pair (in other words
275+
* `service.namespace,service.name,service.instance.id` triplet **MUST** be globally unique). The ID helps to
276+
* distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled
277+
* service).
278+
*
279+
* Implementations, such as SDKs, are recommended to generate a random Version 1 or Version 4 [RFC
280+
* 4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an inherent unique ID as the source of
281+
* this value if stability is desirable. In that case, the ID **SHOULD** be used as source of a UUID Version 5 and
282+
* **SHOULD** use the following UUID as the namespace: `4d63009a-8d0f-11ee-aad7-4c796ed8e320`.
283+
*
284+
* UUIDs are typically recommended, as only an opaque value for the purposes of identifying a service instance is
285+
* needed. Similar to what can be seen in the man page for the
286+
* [`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/machine-id.html) file, the underlying
287+
* data, such as pod name and namespace should be treated as confidential, being the user's choice to expose it
288+
* or not via another resource attribute.
289+
*
290+
* For applications running behind an application server (like unicorn), we do not recommend using one identifier
291+
* for all processes participating in the application. Instead, it's recommended each division (e.g. a worker
292+
* thread in unicorn) to have its own instance.id.
293+
*
294+
* It's not recommended for a Collector to set `service.instance.id` if it can't unambiguously determine the
295+
* service instance that is generating that telemetry. For instance, creating an UUID based on `pod.name` will
296+
* likely be wrong, as the Collector might not know from which container within that pod the telemetry originated.
297+
* However, Collectors can set the `service.instance.id` if they can unambiguously determine the service instance
298+
* for that telemetry. This is typically the case for scraping receivers, as they know the target address and
299+
* port.
300+
*
301+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
302+
*/
60303
export const ATTR_SERVICE_INSTANCE_ID = 'service.instance.id';
61-
export const ATTR_SERVICE_NAME = 'service.name';
304+
305+
/**
306+
* A namespace for `service.name`.
307+
*
308+
* @example Shop
309+
*
310+
* @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.
311+
*
312+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
313+
*/
62314
export const ATTR_SERVICE_NAMESPACE = 'service.namespace';
63-
export const ATTR_SERVICE_VERSION = 'service.version';
64315

65-
// Cloud provider/platform values
66-
export const CLOUD_PROVIDER_VALUE_AWS = 'aws';
316+
/**
317+
* Enum value "aws_ec2" for attribute {@link ATTR_CLOUD_PLATFORM}.
318+
*/
67319
export const CLOUD_PLATFORM_VALUE_AWS_EC2 = 'aws_ec2';
320+
321+
/**
322+
* Enum value "aws_ecs" for attribute {@link ATTR_CLOUD_PLATFORM}.
323+
*/
68324
export const CLOUD_PLATFORM_VALUE_AWS_ECS = 'aws_ecs';
325+
326+
/**
327+
* Enum value "aws_eks" for attribute {@link ATTR_CLOUD_PLATFORM}.
328+
*/
69329
export const CLOUD_PLATFORM_VALUE_AWS_EKS = 'aws_eks';
330+
331+
/**
332+
* Enum value "aws_elastic_beanstalk" for attribute {@link ATTR_CLOUD_PLATFORM}.
333+
*/
70334
export const CLOUD_PLATFORM_VALUE_AWS_ELASTIC_BEANSTALK =
71335
'aws_elastic_beanstalk';
336+
337+
/**
338+
* Enum value "aws_lambda" for attribute {@link ATTR_CLOUD_PLATFORM}.
339+
*/
72340
export const CLOUD_PLATFORM_VALUE_AWS_LAMBDA = 'aws_lambda';
341+
342+
/**
343+
* Enum value "aws" for attribute {@link ATTR_CLOUD_PROVIDER}.
344+
*/
345+
export const CLOUD_PROVIDER_VALUE_AWS = 'aws';

0 commit comments

Comments
 (0)