diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 92788c7b1f..c9c72e7a15 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,13 +1,13 @@ { - "detectors/node/opentelemetry-resource-detector-alibaba-cloud": "0.29.7", - "detectors/node/opentelemetry-resource-detector-aws": "1.10.0", - "detectors/node/opentelemetry-resource-detector-azure": "0.5.0", - "detectors/node/opentelemetry-resource-detector-container": "0.5.3", - "detectors/node/opentelemetry-resource-detector-gcp": "0.32.0", - "detectors/node/opentelemetry-resource-detector-github": "0.29.0", - "detectors/node/opentelemetry-resource-detector-instana": "0.17.0", + "detectors/node/opentelemetry-resource-detector-alibaba-cloud": "0.30.0", + "detectors/node/opentelemetry-resource-detector-aws": "1.11.0", + "detectors/node/opentelemetry-resource-detector-azure": "0.6.0", + "detectors/node/opentelemetry-resource-detector-container": "0.6.0", + "detectors/node/opentelemetry-resource-detector-gcp": "0.33.0", + "detectors/node/opentelemetry-resource-detector-github": "0.30.0", + "detectors/node/opentelemetry-resource-detector-instana": "0.18.0", "metapackages/auto-configuration-propagators": "0.3.2", - "metapackages/auto-instrumentations-node": "0.55.2", + "metapackages/auto-instrumentations-node": "0.55.3", "metapackages/auto-instrumentations-web": "0.45.0", "packages/baggage-span-processor": "0.3.1", "packages/opentelemetry-host-metrics": "0.35.5", @@ -28,14 +28,14 @@ "plugins/node/instrumentation-socket.io": "0.46.0", "plugins/node/instrumentation-tedious": "0.18.0", "plugins/node/instrumentation-undici": "0.10.0", - "plugins/node/opentelemetry-instrumentation-aws-lambda": "0.50.1", + "plugins/node/opentelemetry-instrumentation-aws-lambda": "0.50.2", "plugins/node/opentelemetry-instrumentation-aws-sdk": "0.49.0", "plugins/node/opentelemetry-instrumentation-bunyan": "0.45.0", "plugins/node/opentelemetry-instrumentation-cassandra": "0.45.0", "plugins/node/opentelemetry-instrumentation-connect": "0.43.0", "plugins/node/opentelemetry-instrumentation-dns": "0.43.0", "plugins/node/opentelemetry-instrumentation-express": "0.47.0", - "plugins/node/opentelemetry-instrumentation-fastify": "0.44.0", + "plugins/node/opentelemetry-instrumentation-fastify": "0.44.1", "plugins/node/opentelemetry-instrumentation-generic-pool": "0.43.0", "plugins/node/opentelemetry-instrumentation-graphql": "0.47.0", "plugins/node/opentelemetry-instrumentation-hapi": "0.45.1", diff --git a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/CHANGELOG.md b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/CHANGELOG.md index ccc06ed649..daa4e8bcb0 100644 --- a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/CHANGELOG.md +++ b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.30.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-alibaba-cloud-v0.29.7...resource-detector-alibaba-cloud-v0.30.0) (2025-01-20) + + +### Features + +* **detectors:** generate esm build files too ([#2636](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2636)) ([c2ad0af](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/c2ad0af34e1570f3609beefc4a8d41ddfb7f8f77)) +* **detectors:** mark as side effect free ([#2663](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2663)) ([e9263a3](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/e9263a36255c0016cca78bf16c4598f23519d5f1)) + ## [0.29.7](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-alibaba-cloud-v0.29.6...resource-detector-alibaba-cloud-v0.29.7) (2024-12-18) diff --git a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json index 8f3254afc9..609db889a1 100644 --- a/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json +++ b/detectors/node/opentelemetry-resource-detector-alibaba-cloud/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-alibaba-cloud", - "version": "0.29.7", + "version": "0.30.0", "description": "OpenTelemetry resource detector for Alibaba Cloud", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/detectors/node/opentelemetry-resource-detector-aws/CHANGELOG.md b/detectors/node/opentelemetry-resource-detector-aws/CHANGELOG.md index 4ecb55261d..b84551d208 100644 --- a/detectors/node/opentelemetry-resource-detector-aws/CHANGELOG.md +++ b/detectors/node/opentelemetry-resource-detector-aws/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [1.11.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-aws-v1.10.0...resource-detector-aws-v1.11.0) (2025-01-20) + + +### Features + +* **detectors:** generate esm build files too ([#2636](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2636)) ([c2ad0af](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/c2ad0af34e1570f3609beefc4a8d41ddfb7f8f77)) +* **detectors:** mark as side effect free ([#2663](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2663)) ([e9263a3](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/e9263a36255c0016cca78bf16c4598f23519d5f1)) + + +### Bug Fixes + +* **detector-aws:** remove all deprecation warnings ([#2642](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2642)) ([f97bd70](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/f97bd7099ed6ec4e99af98157608040708de15c6)) +* **detector-aws:** remove semconv incubating import ([#2668](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2668)) ([3e95995](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/3e95995fcdaa7aecdc47bf52f01fa2e48e4f98ce)) + ## [1.10.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-aws-v1.9.0...resource-detector-aws-v1.10.0) (2024-12-18) diff --git a/detectors/node/opentelemetry-resource-detector-aws/package.json b/detectors/node/opentelemetry-resource-detector-aws/package.json index c27ac5a67f..f34c951628 100644 --- a/detectors/node/opentelemetry-resource-detector-aws/package.json +++ b/detectors/node/opentelemetry-resource-detector-aws/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-aws", - "version": "1.10.0", + "version": "1.11.0", "description": "OpenTelemetry SDK resource detector for AWS", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsBeanstalkDetectorSync.ts b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsBeanstalkDetectorSync.ts index 1716c97a49..47b279738a 100644 --- a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsBeanstalkDetectorSync.ts +++ b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsBeanstalkDetectorSync.ts @@ -24,16 +24,18 @@ import { ResourceAttributes, ResourceDetectionConfig, } from '@opentelemetry/resources'; +import { + ATTR_SERVICE_NAME, + ATTR_SERVICE_VERSION, +} from '@opentelemetry/semantic-conventions'; import { ATTR_CLOUD_PROVIDER, ATTR_CLOUD_PLATFORM, - ATTR_SERVICE_NAME, ATTR_SERVICE_NAMESPACE, - ATTR_SERVICE_VERSION, ATTR_SERVICE_INSTANCE_ID, CLOUD_PROVIDER_VALUE_AWS, CLOUD_PLATFORM_VALUE_AWS_ELASTIC_BEANSTALK, -} from '@opentelemetry/semantic-conventions/incubating'; +} from '../semconv'; import * as fs from 'fs'; import * as util from 'util'; diff --git a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEc2DetectorSync.ts b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEc2DetectorSync.ts index 471b2b9085..5b91d51b10 100644 --- a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEc2DetectorSync.ts +++ b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEc2DetectorSync.ts @@ -34,7 +34,7 @@ import { ATTR_HOST_NAME, CLOUD_PROVIDER_VALUE_AWS, CLOUD_PLATFORM_VALUE_AWS_EC2, -} from '@opentelemetry/semantic-conventions/incubating'; +} from '../semconv'; import * as http from 'http'; /** diff --git a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEcsDetectorSync.ts b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEcsDetectorSync.ts index 5b4f4ccd09..d7ccaf8465 100644 --- a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEcsDetectorSync.ts +++ b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEcsDetectorSync.ts @@ -42,7 +42,7 @@ import { ATTR_AWS_LOG_STREAM_ARNS, CLOUD_PROVIDER_VALUE_AWS, CLOUD_PLATFORM_VALUE_AWS_ECS, -} from '@opentelemetry/semantic-conventions/incubating'; +} from '../semconv'; // Patch until the OpenTelemetry SDK is updated to ship this attribute import { SemanticResourceAttributes as AdditionalSemanticResourceAttributes } from './SemanticResourceAttributes'; import * as http from 'http'; @@ -166,8 +166,7 @@ export class AwsEcsDetectorSync implements DetectorSync { const accountId: string = AwsEcsDetectorSync._getAccountFromArn(taskArn); const region: string = AwsEcsDetectorSync._getRegionFromArn(taskArn); - const availabilityZone: string | undefined = - taskMetadata?.['AvailabilityZone']; + const availabilityZone: string | undefined = taskMetadata?.AvailabilityZone; const clusterArn = cluster.startsWith('arn:') ? cluster diff --git a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEksDetectorSync.ts b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEksDetectorSync.ts index 857fb2f217..244bf50247 100644 --- a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEksDetectorSync.ts +++ b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsEksDetectorSync.ts @@ -30,7 +30,7 @@ import { ATTR_CONTAINER_ID, CLOUD_PROVIDER_VALUE_AWS, CLOUD_PLATFORM_VALUE_AWS_EKS, -} from '@opentelemetry/semantic-conventions/incubating'; +} from '../semconv'; import * as https from 'https'; import * as fs from 'fs'; import * as util from 'util'; diff --git a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsLambdaDetectorSync.ts b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsLambdaDetectorSync.ts index da7187e565..66fe94ee2a 100644 --- a/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsLambdaDetectorSync.ts +++ b/detectors/node/opentelemetry-resource-detector-aws/src/detectors/AwsLambdaDetectorSync.ts @@ -29,7 +29,7 @@ import { ATTR_FAAS_NAME, CLOUD_PROVIDER_VALUE_AWS, CLOUD_PLATFORM_VALUE_AWS_LAMBDA, -} from '@opentelemetry/semantic-conventions/incubating'; +} from '../semconv'; /** * The AwsLambdaDetector can be used to detect if a process is running in AWS Lambda diff --git a/detectors/node/opentelemetry-resource-detector-aws/src/semconv.ts b/detectors/node/opentelemetry-resource-detector-aws/src/semconv.ts new file mode 100644 index 0000000000..3d34526643 --- /dev/null +++ b/detectors/node/opentelemetry-resource-detector-aws/src/semconv.ts @@ -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 + * + * https://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. + */ + +/* + * This file contains a copy of unstable semantic convention definitions + * used by this package. + * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv + */ + +/** + * The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + * + * @example arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_ECS_CLUSTER_ARN = 'aws.ecs.cluster.arn'; + +/** + * The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + * + * @example arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9 + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_ECS_CONTAINER_ARN = 'aws.ecs.container.arn'; + +/** + * The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_ECS_LAUNCHTYPE = 'aws.ecs.launchtype'; + +/** + * The ARN of a running [ECS task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids). + * + * @example arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b + * @example arn:aws:ecs:us-west-1:123456789123:task/my-cluster/task-id/23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_ECS_TASK_ARN = 'aws.ecs.task.arn'; + +/** + * 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. + * + * @example opentelemetry-family + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_ECS_TASK_FAMILY = 'aws.ecs.task.family'; + +/** + * The revision for the task definition used to create the ECS task. + * + * @example 8 + * @example 26 + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_ECS_TASK_REVISION = 'aws.ecs.task.revision'; + +/** + * The Amazon Resource Name(s) (ARN) of the AWS log group(s). + * + * @example ["arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*"] + * + * @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). + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_LOG_GROUP_ARNS = 'aws.log.group.arns'; + +/** + * The name(s) of the AWS log group(s) an application is writing to. + * + * @example ["/aws/lambda/my-function", "opentelemetry-service"] + * + * @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. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_LOG_GROUP_NAMES = 'aws.log.group.names'; + +/** + * The ARN(s) of the AWS log stream(s). + * + * @example ["arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b"] + * + * @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. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_LOG_STREAM_ARNS = 'aws.log.stream.arns'; + +/** + * The name(s) of the AWS log stream(s) an application is writing to. + * + * @example ["logs/main/10838bed-421f-43ef-870a-f43feacbbb5b"] + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_AWS_LOG_STREAM_NAMES = 'aws.log.stream.names'; + +/** + * The cloud account ID the resource is assigned to. + * + * @example 111111111111 + * @example opentelemetry + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_CLOUD_ACCOUNT_ID = 'cloud.account.id'; + +/** + * Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running. + * + * @example us-east-1c + * + * @note Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_CLOUD_AVAILABILITY_ZONE = 'cloud.availability_zone'; + +/** + * The cloud platform in use. + * + * @note The prefix of the service **SHOULD** match the one specified in `cloud.provider`. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_CLOUD_PLATFORM = 'cloud.platform'; + +/** + * Name of the cloud provider. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_CLOUD_PROVIDER = 'cloud.provider'; + +/** + * The geographical region the resource is running. + * + * @example us-central1 + * @example us-east-1 + * + * @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). + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_CLOUD_REGION = 'cloud.region'; + +/** + * 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. + * + * @example a3bf90e006b2 + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_CONTAINER_ID = 'container.id'; + +/** + * Container name used by container runtime. + * + * @example opentelemetry-autoconf + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_CONTAINER_NAME = 'container.name'; + +/** + * The name of the single function that this runtime instance executes. + * + * @example my-function + * @example myazurefunctionapp/some-function-name + * + * @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`](/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 `/`, 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). + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_FAAS_NAME = 'faas.name'; + +/** + * The immutable version of the function being executed. + * + * @example 26 + * @example pinkfroid-00002 + * + * @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. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_FAAS_VERSION = 'faas.version'; + +/** + * 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. + * + * @example fdbf79e8af94cb7f9e8df36789187052 + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_HOST_ID = 'host.id'; + +/** + * 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. + * + * @example opentelemetry-test + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_HOST_NAME = 'host.name'; + +/** + * Type of host. For Cloud, this must be the machine type. + * + * @example n1-standard-1 + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_HOST_TYPE = 'host.type'; + +/** + * The name of the cluster. + * + * @example opentelemetry-cluster + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_K8S_CLUSTER_NAME = 'k8s.cluster.name'; + +/** + * The string ID of the service instance. + * + * @example 627cc493-f310-47de-96bd-71410b7dec09 + * + * @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/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. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_SERVICE_INSTANCE_ID = 'service.instance.id'; + +/** + * A namespace for `service.name`. + * + * @example Shop + * + * @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. + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_SERVICE_NAMESPACE = 'service.namespace'; + +/** + * Enum value "aws_ec2" for attribute {@link ATTR_CLOUD_PLATFORM}. + */ +export const CLOUD_PLATFORM_VALUE_AWS_EC2 = 'aws_ec2'; + +/** + * Enum value "aws_ecs" for attribute {@link ATTR_CLOUD_PLATFORM}. + */ +export const CLOUD_PLATFORM_VALUE_AWS_ECS = 'aws_ecs'; + +/** + * Enum value "aws_eks" for attribute {@link ATTR_CLOUD_PLATFORM}. + */ +export const CLOUD_PLATFORM_VALUE_AWS_EKS = 'aws_eks'; + +/** + * Enum value "aws_elastic_beanstalk" for attribute {@link ATTR_CLOUD_PLATFORM}. + */ +export const CLOUD_PLATFORM_VALUE_AWS_ELASTIC_BEANSTALK = + 'aws_elastic_beanstalk'; + +/** + * Enum value "aws_lambda" for attribute {@link ATTR_CLOUD_PLATFORM}. + */ +export const CLOUD_PLATFORM_VALUE_AWS_LAMBDA = 'aws_lambda'; + +/** + * Enum value "aws" for attribute {@link ATTR_CLOUD_PROVIDER}. + */ +export const CLOUD_PROVIDER_VALUE_AWS = 'aws'; diff --git a/detectors/node/opentelemetry-resource-detector-azure/CHANGELOG.md b/detectors/node/opentelemetry-resource-detector-azure/CHANGELOG.md index 6ed23ed8de..d38ffa1c70 100644 --- a/detectors/node/opentelemetry-resource-detector-azure/CHANGELOG.md +++ b/detectors/node/opentelemetry-resource-detector-azure/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.6.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-azure-v0.5.0...resource-detector-azure-v0.6.0) (2025-01-20) + + +### Features + +* **detectors:** generate esm build files too ([#2636](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2636)) ([c2ad0af](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/c2ad0af34e1570f3609beefc4a8d41ddfb7f8f77)) +* **detectors:** mark as side effect free ([#2663](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2663)) ([e9263a3](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/e9263a36255c0016cca78bf16c4598f23519d5f1)) + ## [0.5.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-azure-v0.4.0...resource-detector-azure-v0.5.0) (2024-12-18) diff --git a/detectors/node/opentelemetry-resource-detector-azure/package.json b/detectors/node/opentelemetry-resource-detector-azure/package.json index 04b7ee668b..176affec50 100644 --- a/detectors/node/opentelemetry-resource-detector-azure/package.json +++ b/detectors/node/opentelemetry-resource-detector-azure/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-azure", - "version": "0.5.0", + "version": "0.6.0", "description": "OpenTelemetry SDK resource detector for Azure", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/detectors/node/opentelemetry-resource-detector-container/CHANGELOG.md b/detectors/node/opentelemetry-resource-detector-container/CHANGELOG.md index 18de726c8b..f979533c6a 100644 --- a/detectors/node/opentelemetry-resource-detector-container/CHANGELOG.md +++ b/detectors/node/opentelemetry-resource-detector-container/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.6.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-container-v0.5.3...resource-detector-container-v0.6.0) (2025-01-20) + + +### Features + +* **detectors:** generate esm build files too ([#2636](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2636)) ([c2ad0af](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/c2ad0af34e1570f3609beefc4a8d41ddfb7f8f77)) +* **detectors:** mark as side effect free ([#2663](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2663)) ([e9263a3](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/e9263a36255c0016cca78bf16c4598f23519d5f1)) + ## [0.5.3](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-container-v0.5.2...resource-detector-container-v0.5.3) (2024-12-18) diff --git a/detectors/node/opentelemetry-resource-detector-container/package.json b/detectors/node/opentelemetry-resource-detector-container/package.json index 7e65aef46a..37d1514d03 100644 --- a/detectors/node/opentelemetry-resource-detector-container/package.json +++ b/detectors/node/opentelemetry-resource-detector-container/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-container", - "version": "0.5.3", + "version": "0.6.0", "description": "Opentelemetry resource detector to get container resource attributes", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/detectors/node/opentelemetry-resource-detector-gcp/CHANGELOG.md b/detectors/node/opentelemetry-resource-detector-gcp/CHANGELOG.md index 74ab3b4a4c..be92a6ddd9 100644 --- a/detectors/node/opentelemetry-resource-detector-gcp/CHANGELOG.md +++ b/detectors/node/opentelemetry-resource-detector-gcp/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.33.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-gcp-v0.32.0...resource-detector-gcp-v0.33.0) (2025-01-20) + + +### Features + +* **detectors:** generate esm build files too ([#2636](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2636)) ([c2ad0af](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/c2ad0af34e1570f3609beefc4a8d41ddfb7f8f77)) +* **detectors:** mark as side effect free ([#2663](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2663)) ([e9263a3](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/e9263a36255c0016cca78bf16c4598f23519d5f1)) + ## [0.32.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-gcp-v0.31.0...resource-detector-gcp-v0.32.0) (2024-12-18) diff --git a/detectors/node/opentelemetry-resource-detector-gcp/package.json b/detectors/node/opentelemetry-resource-detector-gcp/package.json index 260fcd9222..0bc946d66d 100644 --- a/detectors/node/opentelemetry-resource-detector-gcp/package.json +++ b/detectors/node/opentelemetry-resource-detector-gcp/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-gcp", - "version": "0.32.0", + "version": "0.33.0", "description": "OpenTelemetry SDK resource detector for GCP", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/detectors/node/opentelemetry-resource-detector-github/CHANGELOG.md b/detectors/node/opentelemetry-resource-detector-github/CHANGELOG.md index 0e0a9866d2..95d3defee3 100644 --- a/detectors/node/opentelemetry-resource-detector-github/CHANGELOG.md +++ b/detectors/node/opentelemetry-resource-detector-github/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.30.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-github-v0.29.0...resource-detector-github-v0.30.0) (2025-01-20) + + +### Features + +* **detectors:** generate esm build files too ([#2636](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2636)) ([c2ad0af](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/c2ad0af34e1570f3609beefc4a8d41ddfb7f8f77)) +* **detectors:** mark as side effect free ([#2663](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2663)) ([e9263a3](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/e9263a36255c0016cca78bf16c4598f23519d5f1)) + ## [0.29.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-github-v0.28.2...resource-detector-github-v0.29.0) (2024-08-05) diff --git a/detectors/node/opentelemetry-resource-detector-github/package.json b/detectors/node/opentelemetry-resource-detector-github/package.json index b873ae89af..34a5540c7e 100644 --- a/detectors/node/opentelemetry-resource-detector-github/package.json +++ b/detectors/node/opentelemetry-resource-detector-github/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-github", - "version": "0.29.0", + "version": "0.30.0", "description": "OpenTelemetry SDK resource detector for GitHub", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/detectors/node/opentelemetry-resource-detector-instana/CHANGELOG.md b/detectors/node/opentelemetry-resource-detector-instana/CHANGELOG.md index 329a0e5cf6..7b54a399e7 100644 --- a/detectors/node/opentelemetry-resource-detector-instana/CHANGELOG.md +++ b/detectors/node/opentelemetry-resource-detector-instana/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.18.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-instana-v0.17.0...resource-detector-instana-v0.18.0) (2025-01-20) + + +### Features + +* **detectors:** generate esm build files too ([#2636](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2636)) ([c2ad0af](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/c2ad0af34e1570f3609beefc4a8d41ddfb7f8f77)) +* **detectors:** mark as side effect free ([#2663](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2663)) ([e9263a3](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/e9263a36255c0016cca78bf16c4598f23519d5f1)) + ## [0.17.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/resource-detector-instana-v0.16.0...resource-detector-instana-v0.17.0) (2024-12-18) diff --git a/detectors/node/opentelemetry-resource-detector-instana/package.json b/detectors/node/opentelemetry-resource-detector-instana/package.json index 9e12ab749d..eabbe7e2ab 100644 --- a/detectors/node/opentelemetry-resource-detector-instana/package.json +++ b/detectors/node/opentelemetry-resource-detector-instana/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/resource-detector-instana", - "version": "0.17.0", + "version": "0.18.0", "description": "OpenTelemetry SDK resource detector for Instana", "main": "build/src/index.js", "module": "build/esm/index.js", diff --git a/metapackages/auto-instrumentations-node/CHANGELOG.md b/metapackages/auto-instrumentations-node/CHANGELOG.md index 52b287e091..b1e5df017f 100644 --- a/metapackages/auto-instrumentations-node/CHANGELOG.md +++ b/metapackages/auto-instrumentations-node/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [0.55.3](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/auto-instrumentations-node-v0.55.2...auto-instrumentations-node-v0.55.3) (2025-01-20) + + +### Bug Fixes + +* **auto-instrumentations-node:** correct typo ([#2666](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2666)) ([4cf7e6f](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/4cf7e6f80640538c9b5fd36135329e050c8ab8ba)) +* **auto-instrumentations-node:** make SIGTERM shutdown test more reliable ([#2667](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2667)) ([94414a1](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/94414a1515c5c3b35ada2ec5370c196d8cbc03bc)) + + +### Dependencies + +* The following workspace dependencies were updated + * dependencies + * @opentelemetry/instrumentation-aws-lambda bumped from ^0.50.1 to ^0.50.2 + * @opentelemetry/instrumentation-fastify bumped from ^0.44.0 to ^0.44.1 + * @opentelemetry/resource-detector-alibaba-cloud bumped from ^0.29.7 to ^0.30.0 + * @opentelemetry/resource-detector-aws bumped from ^1.10.0 to ^1.11.0 + * @opentelemetry/resource-detector-azure bumped from ^0.5.0 to ^0.6.0 + * @opentelemetry/resource-detector-container bumped from ^0.5.3 to ^0.6.0 + * @opentelemetry/resource-detector-gcp bumped from ^0.32.0 to ^0.33.0 + ## [0.55.2](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/auto-instrumentations-node-v0.55.1...auto-instrumentations-node-v0.55.2) (2025-01-09) diff --git a/metapackages/auto-instrumentations-node/package.json b/metapackages/auto-instrumentations-node/package.json index 563bde3ea5..6748cfa3e0 100644 --- a/metapackages/auto-instrumentations-node/package.json +++ b/metapackages/auto-instrumentations-node/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/auto-instrumentations-node", - "version": "0.55.2", + "version": "0.55.3", "description": "Metapackage which bundles opentelemetry node core and contrib instrumentations", "author": "OpenTelemetry Authors", "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-node#readme", @@ -48,7 +48,7 @@ "dependencies": { "@opentelemetry/instrumentation": "^0.57.0", "@opentelemetry/instrumentation-amqplib": "^0.46.0", - "@opentelemetry/instrumentation-aws-lambda": "^0.50.1", + "@opentelemetry/instrumentation-aws-lambda": "^0.50.2", "@opentelemetry/instrumentation-aws-sdk": "^0.49.0", "@opentelemetry/instrumentation-bunyan": "^0.45.0", "@opentelemetry/instrumentation-cassandra-driver": "^0.45.0", @@ -57,7 +57,7 @@ "@opentelemetry/instrumentation-dataloader": "^0.16.0", "@opentelemetry/instrumentation-dns": "^0.43.0", "@opentelemetry/instrumentation-express": "^0.47.0", - "@opentelemetry/instrumentation-fastify": "^0.44.0", + "@opentelemetry/instrumentation-fastify": "^0.44.1", "@opentelemetry/instrumentation-fs": "^0.19.0", "@opentelemetry/instrumentation-generic-pool": "^0.43.0", "@opentelemetry/instrumentation-graphql": "^0.47.0", @@ -87,11 +87,11 @@ "@opentelemetry/instrumentation-tedious": "^0.18.0", "@opentelemetry/instrumentation-undici": "^0.10.0", "@opentelemetry/instrumentation-winston": "^0.44.0", - "@opentelemetry/resource-detector-alibaba-cloud": "^0.29.7", - "@opentelemetry/resource-detector-aws": "^1.10.0", - "@opentelemetry/resource-detector-azure": "^0.5.0", - "@opentelemetry/resource-detector-container": "^0.5.3", - "@opentelemetry/resource-detector-gcp": "^0.32.0", + "@opentelemetry/resource-detector-alibaba-cloud": "^0.30.0", + "@opentelemetry/resource-detector-aws": "^1.11.0", + "@opentelemetry/resource-detector-azure": "^0.6.0", + "@opentelemetry/resource-detector-container": "^0.6.0", + "@opentelemetry/resource-detector-gcp": "^0.33.0", "@opentelemetry/resources": "^1.24.0", "@opentelemetry/sdk-node": "^0.57.0" }, diff --git a/metapackages/auto-instrumentations-node/test/test-app/app-server.js b/metapackages/auto-instrumentations-node/test/test-app/app-server.js index 786cf0f175..61e12b089e 100644 --- a/metapackages/auto-instrumentations-node/test/test-app/app-server.js +++ b/metapackages/auto-instrumentations-node/test/test-app/app-server.js @@ -17,22 +17,34 @@ //Used in register.test.ts to mimic a JS app that stays alive like a server. const http = require('http'); -const options = { - hostname: 'example.com', - port: 80, - path: '/', - method: 'GET', -}; +// Create a local server that responds immediately +const server = http.createServer((req, res) => { + res.end('ok'); +}); + +server.listen(0, () => { + const port = server.address().port; + const req = http.request({ + hostname: 'localhost', + port: port, + path: '/', + method: 'GET', + }); -const req = http.request(options); -req.end(); -req.on('close', () => { - console.log('Finished request'); + req.end(); + req.on('response', res => { + res.on('end', () => { + console.log('Finished request'); + }); + res.resume(); + }); }); // Make sure there is work on the event loop const handle = setInterval(() => {}, 1); + // Gracefully shut down process.on('SIGTERM', () => { clearInterval(handle); + server.close(); }); diff --git a/package-lock.json b/package-lock.json index b3ab4896d1..3ef1359ee6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ }, "detectors/node/opentelemetry-resource-detector-alibaba-cloud": { "name": "@opentelemetry/resource-detector-alibaba-cloud", - "version": "0.29.7", + "version": "0.30.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.26.0", @@ -92,7 +92,7 @@ }, "detectors/node/opentelemetry-resource-detector-aws": { "name": "@opentelemetry/resource-detector-aws", - "version": "1.10.0", + "version": "1.11.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.0.0", @@ -144,7 +144,7 @@ }, "detectors/node/opentelemetry-resource-detector-azure": { "name": "@opentelemetry/resource-detector-azure", - "version": "0.5.0", + "version": "0.6.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.25.1", @@ -194,7 +194,7 @@ }, "detectors/node/opentelemetry-resource-detector-container": { "name": "@opentelemetry/resource-detector-container", - "version": "0.5.3", + "version": "0.6.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.26.0", @@ -246,7 +246,7 @@ }, "detectors/node/opentelemetry-resource-detector-gcp": { "name": "@opentelemetry/resource-detector-gcp", - "version": "0.32.0", + "version": "0.33.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.0.0", @@ -297,7 +297,7 @@ }, "detectors/node/opentelemetry-resource-detector-github": { "name": "@opentelemetry/resource-detector-github", - "version": "0.29.0", + "version": "0.30.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/resources": "^1.10.0" @@ -343,7 +343,7 @@ }, "detectors/node/opentelemetry-resource-detector-instana": { "name": "@opentelemetry/resource-detector-instana", - "version": "0.17.0", + "version": "0.18.0", "license": "Apache-2.0", "dependencies": { "@opentelemetry/resources": "^1.10.0", @@ -449,12 +449,12 @@ }, "metapackages/auto-instrumentations-node": { "name": "@opentelemetry/auto-instrumentations-node", - "version": "0.55.2", + "version": "0.55.3", "license": "Apache-2.0", "dependencies": { "@opentelemetry/instrumentation": "^0.57.0", "@opentelemetry/instrumentation-amqplib": "^0.46.0", - "@opentelemetry/instrumentation-aws-lambda": "^0.50.1", + "@opentelemetry/instrumentation-aws-lambda": "^0.50.2", "@opentelemetry/instrumentation-aws-sdk": "^0.49.0", "@opentelemetry/instrumentation-bunyan": "^0.45.0", "@opentelemetry/instrumentation-cassandra-driver": "^0.45.0", @@ -463,7 +463,7 @@ "@opentelemetry/instrumentation-dataloader": "^0.16.0", "@opentelemetry/instrumentation-dns": "^0.43.0", "@opentelemetry/instrumentation-express": "^0.47.0", - "@opentelemetry/instrumentation-fastify": "^0.44.0", + "@opentelemetry/instrumentation-fastify": "^0.44.1", "@opentelemetry/instrumentation-fs": "^0.19.0", "@opentelemetry/instrumentation-generic-pool": "^0.43.0", "@opentelemetry/instrumentation-graphql": "^0.47.0", @@ -493,11 +493,11 @@ "@opentelemetry/instrumentation-tedious": "^0.18.0", "@opentelemetry/instrumentation-undici": "^0.10.0", "@opentelemetry/instrumentation-winston": "^0.44.0", - "@opentelemetry/resource-detector-alibaba-cloud": "^0.29.7", - "@opentelemetry/resource-detector-aws": "^1.10.0", - "@opentelemetry/resource-detector-azure": "^0.5.0", - "@opentelemetry/resource-detector-container": "^0.5.3", - "@opentelemetry/resource-detector-gcp": "^0.32.0", + "@opentelemetry/resource-detector-alibaba-cloud": "^0.30.0", + "@opentelemetry/resource-detector-aws": "^1.11.0", + "@opentelemetry/resource-detector-azure": "^0.6.0", + "@opentelemetry/resource-detector-container": "^0.6.0", + "@opentelemetry/resource-detector-gcp": "^0.33.0", "@opentelemetry/resources": "^1.24.0", "@opentelemetry/sdk-node": "^0.57.0" }, @@ -37434,7 +37434,7 @@ }, "plugins/node/opentelemetry-instrumentation-aws-lambda": { "name": "@opentelemetry/instrumentation-aws-lambda", - "version": "0.50.1", + "version": "0.50.2", "license": "Apache-2.0", "dependencies": { "@opentelemetry/instrumentation": "^0.57.0", @@ -37851,7 +37851,7 @@ }, "plugins/node/opentelemetry-instrumentation-fastify": { "name": "@opentelemetry/instrumentation-fastify", - "version": "0.44.0", + "version": "0.44.1", "license": "Apache-2.0", "dependencies": { "@opentelemetry/core": "^1.8.0", @@ -46995,7 +46995,7 @@ "@opentelemetry/api": "^1.4.1", "@opentelemetry/instrumentation": "^0.57.0", "@opentelemetry/instrumentation-amqplib": "^0.46.0", - "@opentelemetry/instrumentation-aws-lambda": "^0.50.1", + "@opentelemetry/instrumentation-aws-lambda": "^0.50.2", "@opentelemetry/instrumentation-aws-sdk": "^0.49.0", "@opentelemetry/instrumentation-bunyan": "^0.45.0", "@opentelemetry/instrumentation-cassandra-driver": "^0.45.0", @@ -47004,7 +47004,7 @@ "@opentelemetry/instrumentation-dataloader": "^0.16.0", "@opentelemetry/instrumentation-dns": "^0.43.0", "@opentelemetry/instrumentation-express": "^0.47.0", - "@opentelemetry/instrumentation-fastify": "^0.44.0", + "@opentelemetry/instrumentation-fastify": "^0.44.1", "@opentelemetry/instrumentation-fs": "^0.19.0", "@opentelemetry/instrumentation-generic-pool": "^0.43.0", "@opentelemetry/instrumentation-graphql": "^0.47.0", @@ -47034,11 +47034,11 @@ "@opentelemetry/instrumentation-tedious": "^0.18.0", "@opentelemetry/instrumentation-undici": "^0.10.0", "@opentelemetry/instrumentation-winston": "^0.44.0", - "@opentelemetry/resource-detector-alibaba-cloud": "^0.29.7", - "@opentelemetry/resource-detector-aws": "^1.10.0", - "@opentelemetry/resource-detector-azure": "^0.5.0", - "@opentelemetry/resource-detector-container": "^0.5.3", - "@opentelemetry/resource-detector-gcp": "^0.32.0", + "@opentelemetry/resource-detector-alibaba-cloud": "^0.30.0", + "@opentelemetry/resource-detector-aws": "^1.11.0", + "@opentelemetry/resource-detector-azure": "^0.6.0", + "@opentelemetry/resource-detector-container": "^0.6.0", + "@opentelemetry/resource-detector-gcp": "^0.33.0", "@opentelemetry/resources": "^1.24.0", "@opentelemetry/sdk-node": "^0.57.0", "@types/mocha": "7.0.2", diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-aws-lambda/CHANGELOG.md index e7a85d8e91..1be266e30d 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.50.2](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-lambda-v0.50.1...instrumentation-aws-lambda-v0.50.2) (2025-01-20) + + +### Bug Fixes + +* **instrumentation-aws-lambda:** do not import from semantic-conventions incubating entry-point ([#2670](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2670)) ([0db649f](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/0db649f8c59b6b4df455dd0012d735ce9b0118af)) + ## [0.50.1](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-aws-lambda-v0.50.0...instrumentation-aws-lambda-v0.50.1) (2025-01-09) diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json b/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json index 90a9617f6d..554575601b 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-aws-lambda", - "version": "0.50.1", + "version": "0.50.2", "description": "OpenTelemetry instrumentation for AWS Lambda function invocations", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts index efc336d0f1..352cb64ae5 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts @@ -45,7 +45,7 @@ import { SEMRESATTRS_CLOUD_ACCOUNT_ID, SEMRESATTRS_FAAS_ID, } from '@opentelemetry/semantic-conventions'; -import { ATTR_FAAS_COLDSTART } from '@opentelemetry/semantic-conventions/incubating'; +import { ATTR_FAAS_COLDSTART } from './semconv'; import { APIGatewayProxyEventHeaders, diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/src/semconv.ts b/plugins/node/opentelemetry-instrumentation-aws-lambda/src/semconv.ts new file mode 100644 index 0000000000..0bff224acd --- /dev/null +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/src/semconv.ts @@ -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 + * + * https://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. + */ + +/* + * This file contains a copy of unstable semantic convention definitions + * used by this package. + * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv + */ + +/** + * A boolean that is true if the serverless function is executed for the first time (aka cold-start). + * + * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`. + */ +export const ATTR_FAAS_COLDSTART = 'faas.coldstart'; diff --git a/plugins/node/opentelemetry-instrumentation-fastify/CHANGELOG.md b/plugins/node/opentelemetry-instrumentation-fastify/CHANGELOG.md index 522434efbc..8c6caadf64 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/CHANGELOG.md +++ b/plugins/node/opentelemetry-instrumentation-fastify/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.44.1](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-fastify-v0.44.0...instrumentation-fastify-v0.44.1) (2025-01-20) + + +### Bug Fixes + +* **instrumentation-fastify:** add missing module export ([#2633](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2633)) ([1a6839b](https://github.com/open-telemetry/opentelemetry-js-contrib/commit/1a6839b00bfb116528e620c19f118d0a920c987f)) + ## [0.44.0](https://github.com/open-telemetry/opentelemetry-js-contrib/compare/instrumentation-fastify-v0.43.0...instrumentation-fastify-v0.44.0) (2024-12-18) diff --git a/plugins/node/opentelemetry-instrumentation-fastify/package.json b/plugins/node/opentelemetry-instrumentation-fastify/package.json index dade9ea581..2cdf4f2069 100644 --- a/plugins/node/opentelemetry-instrumentation-fastify/package.json +++ b/plugins/node/opentelemetry-instrumentation-fastify/package.json @@ -1,6 +1,6 @@ { "name": "@opentelemetry/instrumentation-fastify", - "version": "0.44.0", + "version": "0.44.1", "description": "OpenTelemetry instrumentation for `fastify` http web application framework", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/plugins/node/opentelemetry-instrumentation-pg/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-pg/src/instrumentation.ts index b7cd5d3406..56029e568e 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-pg/src/instrumentation.ts @@ -18,6 +18,7 @@ import { InstrumentationBase, InstrumentationNodeModuleDefinition, safeExecuteInTheMiddle, + InstrumentationNodeModuleFile, } from '@opentelemetry/instrumentation'; import { context, @@ -67,6 +68,12 @@ import { ATTR_DB_OPERATION_NAME, } from './semconv'; +function extractModuleExports(module: any) { + return module[Symbol.toStringTag] === 'Module' + ? module.default // ESM + : module; // CommonJS +} + export class PgInstrumentation extends InstrumentationBase { private _operationDuration!: Histogram; private _connectionsCount!: UpDownCounter; @@ -125,45 +132,38 @@ export class PgInstrumentation extends InstrumentationBase=8.0.3 <9'], - (module: any) => { - const moduleExports: typeof pgTypes = - module[Symbol.toStringTag] === 'Module' - ? module.default // ESM - : module; // CommonJS - if (isWrapped(moduleExports.Client.prototype.query)) { - this._unwrap(moduleExports.Client.prototype, 'query'); - } + const SUPPORTED_PG_VERSIONS = ['>=8.0.3 <9']; - if (isWrapped(moduleExports.Client.prototype.connect)) { - this._unwrap(moduleExports.Client.prototype, 'connect'); - } + const modulePgNativeClient = new InstrumentationNodeModuleFile( + 'pg/lib/native/client.js', + SUPPORTED_PG_VERSIONS, + this._patchPgClient.bind(this), + this._unpatchPgClient.bind(this) + ); - this._wrap( - moduleExports.Client.prototype, - 'query', - this._getClientQueryPatch() as any - ); + const modulePgClient = new InstrumentationNodeModuleFile( + 'pg/lib/client.js', + SUPPORTED_PG_VERSIONS, + this._patchPgClient.bind(this), + this._unpatchPgClient.bind(this) + ); - this._wrap( - moduleExports.Client.prototype, - 'connect', - this._getClientConnectPatch() as any - ); + const modulePG = new InstrumentationNodeModuleDefinition( + 'pg', + SUPPORTED_PG_VERSIONS, + (module: any) => { + const moduleExports = extractModuleExports(module); + this._patchPgClient(moduleExports.Client); return module; }, (module: any) => { - const moduleExports: typeof pgTypes = - module[Symbol.toStringTag] === 'Module' - ? module.default // ESM - : module; // CommonJS - if (isWrapped(moduleExports.Client.prototype.query)) { - this._unwrap(moduleExports.Client.prototype, 'query'); - } - } + const moduleExports = extractModuleExports(module); + + this._unpatchPgClient(moduleExports.Client); + return module; + }, + [modulePgClient, modulePgNativeClient] ); const modulePGPool = new InstrumentationNodeModuleDefinition( @@ -190,6 +190,50 @@ export class PgInstrumentation extends InstrumentationBase { diff --git a/plugins/node/opentelemetry-instrumentation-pg/test/fixtures/use-pg.mjs b/plugins/node/opentelemetry-instrumentation-pg/test/fixtures/use-pg.mjs new file mode 100644 index 0000000000..a9c8c5a6a4 --- /dev/null +++ b/plugins/node/opentelemetry-instrumentation-pg/test/fixtures/use-pg.mjs @@ -0,0 +1,57 @@ +/* + * 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 + * + * https://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. + */ + +// Use postgres from an ES module: +// node --experimental-loader=@opentelemetry/instrumentation/hook.mjs use-pg.mjs + +import { trace } from '@opentelemetry/api'; +import { createTestNodeSdk } from '@opentelemetry/contrib-test-utils'; +import assert from 'assert'; + +import { PgInstrumentation } from '../../build/src/index.js'; + +const CONFIG = { + user: process.env.POSTGRES_USER || 'postgres', + password: process.env.POSTGRES_PASSWORD || 'postgres', + database: process.env.POSTGRES_DB || 'postgres', + host: process.env.POSTGRES_HOST || 'localhost', + port: process.env.POSTGRES_PORT + ? parseInt(process.env.POSTGRES_PORT, 10) + : 54320, +}; + +const sdk = createTestNodeSdk({ + serviceName: 'use-pg', + instrumentations: [new PgInstrumentation()], +}); +sdk.start(); + +import pg from 'pg'; +const client = new pg.Client(CONFIG); + +await client.connect(); + +const tracer = trace.getTracer(); + +await tracer.startActiveSpan('test-span', async span => { + const res = await client.query('SELECT NOW()'); + + assert.ok(res); + span.end(); + + await client.end(); + await sdk.shutdown(); +}); diff --git a/plugins/node/opentelemetry-instrumentation-pg/test/pg-pool.test.ts b/plugins/node/opentelemetry-instrumentation-pg/test/pg-pool.test.ts index 98d9a1b7c8..0e4f71d42c 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/test/pg-pool.test.ts +++ b/plugins/node/opentelemetry-instrumentation-pg/test/pg-pool.test.ts @@ -114,6 +114,10 @@ describe('pg-pool', () => { function create(config: PgInstrumentationConfig = {}) { instrumentation.setConfig(config); instrumentation.enable(); + + // Disable and enable the instrumentation to visit unwrap calls + instrumentation.disable(); + instrumentation.enable(); } let pool: pgPool; diff --git a/plugins/node/opentelemetry-instrumentation-pg/test/pg.test.ts b/plugins/node/opentelemetry-instrumentation-pg/test/pg.test.ts index 8fda8a8fb8..8dd33aa55f 100644 --- a/plugins/node/opentelemetry-instrumentation-pg/test/pg.test.ts +++ b/plugins/node/opentelemetry-instrumentation-pg/test/pg.test.ts @@ -108,6 +108,10 @@ describe('pg', () => { function create(config: PgInstrumentationConfig = {}) { instrumentation.setConfig(config); instrumentation.enable(); + + // Disable and enable the instrumentation to visit unwrap calls + instrumentation.disable(); + instrumentation.enable(); } let postgres: typeof pg; @@ -152,6 +156,7 @@ describe('pg', () => { postgres = require('pg'); client = new postgres.Client(CONFIG); + await client.connect(); }); @@ -159,6 +164,7 @@ describe('pg', () => { if (testPostgresLocally) { testUtils.cleanUpDocker('postgres'); } + await client.end(); }); @@ -1087,3 +1093,32 @@ describe('pg', () => { }); }); }); + +describe('pg (ESM)', () => { + it('should work with ESM usage', async () => { + await testUtils.runTestFixture({ + cwd: __dirname, + argv: ['fixtures/use-pg.mjs'], + env: { + NODE_OPTIONS: + '--experimental-loader=@opentelemetry/instrumentation/hook.mjs', + NODE_NO_WARNINGS: '1', + }, + checkResult: (err, stdout, stderr) => { + assert.ifError(err); + }, + checkCollector: (collector: testUtils.TestCollector) => { + const spans = collector.sortedSpans; + + assert.strictEqual(spans.length, 3); + + assert.strictEqual(spans[0].name, 'pg.connect'); + assert.strictEqual(spans[0].kind, 3); + assert.strictEqual(spans[1].name, 'test-span'); + assert.strictEqual(spans[1].kind, 1); + assert.strictEqual(spans[2].name, 'pg.query:SELECT otel_pg_database'); + assert.strictEqual(spans[2].kind, 3); + }, + }); + }); +});