Skip to content

Commit f40da84

Browse files
committed
fix(detector-aws): remove semconv incubating import
1 parent 4cf7e6f commit f40da84

File tree

13 files changed

+184
-25
lines changed

13 files changed

+184
-25
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
ATTR_SERVICE_INSTANCE_ID,
3434
CLOUD_PROVIDER_VALUE_AWS,
3535
CLOUD_PLATFORM_VALUE_AWS_ELASTIC_BEANSTALK,
36-
} from '@opentelemetry/semantic-conventions/incubating';
36+
} from '../lib/semconv';
3737
import * as fs from 'fs';
3838
import * as util from 'util';
3939

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
ATTR_HOST_NAME,
3535
CLOUD_PROVIDER_VALUE_AWS,
3636
CLOUD_PLATFORM_VALUE_AWS_EC2,
37-
} from '@opentelemetry/semantic-conventions/incubating';
37+
} from '../lib/semconv';
3838
import * as http from 'http';
3939

4040
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {
4242
ATTR_AWS_LOG_STREAM_ARNS,
4343
CLOUD_PROVIDER_VALUE_AWS,
4444
CLOUD_PLATFORM_VALUE_AWS_ECS,
45-
} from '@opentelemetry/semantic-conventions/incubating';
45+
} from '../lib/semconv';
4646
// Patch until the OpenTelemetry SDK is updated to ship this attribute
4747
import { SemanticResourceAttributes as AdditionalSemanticResourceAttributes } from './SemanticResourceAttributes';
4848
import * as http from 'http';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
ATTR_CONTAINER_ID,
3131
CLOUD_PROVIDER_VALUE_AWS,
3232
CLOUD_PLATFORM_VALUE_AWS_EKS,
33-
} from '@opentelemetry/semantic-conventions/incubating';
33+
} from '../lib/semconv';
3434
import * as https from 'https';
3535
import * as fs from 'fs';
3636
import * as util from 'util';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
ATTR_FAAS_NAME,
3030
CLOUD_PROVIDER_VALUE_AWS,
3131
CLOUD_PLATFORM_VALUE_AWS_LAMBDA,
32-
} from '@opentelemetry/semantic-conventions/incubating';
32+
} from '../lib/semconv';
3333

3434
/**
3535
* The AwsLambdaDetector can be used to detect if a process is running in AWS Lambda
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
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.
21+
* @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv
22+
*/
23+
24+
// AWS attributes
25+
export const ATTR_AWS_ECS_CLUSTER_ARN = 'aws.ecs.cluster.arn';
26+
export const ATTR_AWS_ECS_CONTAINER_ARN = 'aws.ecs.container.arn';
27+
export const ATTR_AWS_ECS_LAUNCHTYPE = 'aws.ecs.launchtype';
28+
export const ATTR_AWS_ECS_TASK_ARN = 'aws.ecs.task.arn';
29+
export const ATTR_AWS_ECS_TASK_FAMILY = 'aws.ecs.task.family';
30+
export const ATTR_AWS_ECS_TASK_REVISION = 'aws.ecs.task.revision';
31+
export const ATTR_AWS_LOG_GROUP_ARNS = 'aws.log.group.arns';
32+
export const ATTR_AWS_LOG_GROUP_NAMES = 'aws.log.group.names';
33+
export const ATTR_AWS_LOG_STREAM_ARNS = 'aws.log.stream.arns';
34+
export const ATTR_AWS_LOG_STREAM_NAMES = 'aws.log.stream.names';
35+
36+
// Cloud attributes
37+
export const ATTR_CLOUD_ACCOUNT_ID = 'cloud.account.id';
38+
export const ATTR_CLOUD_AVAILABILITY_ZONE = 'cloud.availability.zone';
39+
export const ATTR_CLOUD_PLATFORM = 'cloud.platform';
40+
export const ATTR_CLOUD_PROVIDER = 'cloud.provider';
41+
export const ATTR_CLOUD_REGION = 'cloud.region';
42+
43+
// Container attributes
44+
export const ATTR_CONTAINER_ID = 'container.id';
45+
export const ATTR_CONTAINER_NAME = 'container.name';
46+
47+
// FaaS attributes
48+
export const ATTR_FAAS_NAME = 'faas.name';
49+
export const ATTR_FAAS_VERSION = 'faas.version';
50+
51+
// Host attributes
52+
export const ATTR_HOST_ID = 'host.id';
53+
export const ATTR_HOST_NAME = 'host.name';
54+
export const ATTR_HOST_TYPE = 'host.type';
55+
56+
// Kubernetes attributes
57+
export const ATTR_K8S_CLUSTER_NAME = 'k8s.cluster.name';
58+
59+
// Service attributes
60+
export const ATTR_SERVICE_INSTANCE_ID = 'service.instance.id';
61+
export const ATTR_SERVICE_NAME = 'service.name';
62+
export const ATTR_SERVICE_NAMESPACE = 'service.namespace';
63+
export const ATTR_SERVICE_VERSION = 'service.version';
64+
65+
// Cloud provider/platform values
66+
export const CLOUD_PROVIDER_VALUE_AWS = 'aws';
67+
export const CLOUD_PLATFORM_VALUE_AWS_EC2 = 'aws_ec2';
68+
export const CLOUD_PLATFORM_VALUE_AWS_ECS = 'aws_ecs';
69+
export const CLOUD_PLATFORM_VALUE_AWS_EKS = 'aws_eks';
70+
export const CLOUD_PLATFORM_VALUE_AWS_ELASTIC_BEANSTALK =
71+
'aws_elastic_beanstalk';
72+
export const CLOUD_PLATFORM_VALUE_AWS_LAMBDA = 'aws_lambda';

package-lock.json

Lines changed: 2 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/node/opentelemetry-instrumentation-pg/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"dependencies": {
7272
"@opentelemetry/core": "^1.26.0",
7373
"@opentelemetry/instrumentation": "^0.57.0",
74-
"@opentelemetry/semantic-conventions": "1.27.0",
74+
"@opentelemetry/semantic-conventions": "^1.27.0",
7575
"@opentelemetry/sql-common": "^0.40.1",
7676
"@types/pg": "8.6.1",
7777
"@types/pg-pool": "2.0.6"

plugins/node/opentelemetry-instrumentation-pg/src/instrumentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ import {
6565
METRIC_DB_CLIENT_OPERATION_DURATION,
6666
ATTR_DB_NAMESPACE,
6767
ATTR_DB_OPERATION_NAME,
68-
} from '@opentelemetry/semantic-conventions/incubating';
68+
} from './semconv';
6969

7070
export class PgInstrumentation extends InstrumentationBase<PgInstrumentationConfig> {
7171
private _operationDuration!: Histogram;
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* The name of the connection pool; unique within the instrumented application. In case the connection pool implementation doesn't provide a name, instrumentation **SHOULD** use a combination of parameters that would make the name unique, for example, combining attributes `server.address`, `server.port`, and `db.namespace`, formatted as `server.address:server.port/db.namespace`. Instrumentations that generate connection pool name following different patterns **SHOULD** document it.
19+
*
20+
* @example myDataSource
21+
*
22+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
23+
*/
24+
export const ATTR_DB_CLIENT_CONNECTION_POOL_NAME =
25+
'db.client.connection.pool.name';
26+
27+
/**
28+
* The state of a connection in the pool
29+
*
30+
* @example idle
31+
*
32+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
33+
*/
34+
export const ATTR_DB_CLIENT_CONNECTION_STATE = 'db.client.connection.state';
35+
36+
/**
37+
* The name of the database, fully qualified within the server address and port.
38+
*
39+
* @example customers
40+
* @example test.users
41+
*
42+
* @note If a database system has multiple namespace components, they **SHOULD** be concatenated (potentially using database system specific conventions) from most general to most specific namespace component, and more specific namespaces **SHOULD NOT** be captured without the more general namespaces, to ensure that "startswith" queries for the more general namespaces will be valid.
43+
* Semantic conventions for individual database systems **SHOULD** document what `db.namespace` means in the context of that system.
44+
* It is **RECOMMENDED** to capture the value as provided by the application without attempting to do any case normalization.
45+
* This attribute has stability level RELEASE CANDIDATE.
46+
*
47+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
48+
*/
49+
export const ATTR_DB_NAMESPACE = 'db.namespace';
50+
51+
/**
52+
* The name of the operation or command being executed.
53+
*
54+
* @example findAndModify
55+
* @example HMSET
56+
* @example SELECT
57+
*
58+
* @note It is **RECOMMENDED** to capture the value as provided by the application without attempting to do any case normalization.
59+
* If the operation name is parsed from the query text, it **SHOULD** be the first operation name found in the query.
60+
* For batch operations, if the individual operations are known to have the same operation name then that operation name **SHOULD** be used prepended by `BATCH `, otherwise `db.operation.name` **SHOULD** be `BATCH` or some other database system specific term if more applicable.
61+
* This attribute has stability level RELEASE CANDIDATE.
62+
*
63+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
64+
*/
65+
export const ATTR_DB_OPERATION_NAME = 'db.operation.name';
66+
67+
/**
68+
* Enum value "used" for attribute {@link ATTR_DB_CLIENT_CONNECTION_STATE}.
69+
*/
70+
export const DB_CLIENT_CONNECTION_STATE_VALUE_USED = 'used';
71+
72+
/**
73+
* Enum value "idle" for attribute {@link ATTR_DB_CLIENT_CONNECTION_STATE}.
74+
*/
75+
export const DB_CLIENT_CONNECTION_STATE_VALUE_IDLE = 'idle';
76+
77+
/**
78+
* The number of connections that are currently in state described by the `state` attribute
79+
*
80+
* @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
81+
*/
82+
export const METRIC_DB_CLIENT_CONNECTION_COUNT = 'db.client.connection.count';
83+
84+
/**
85+
* The number of current pending requests for an open connection
86+
*
87+
* @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
88+
*/
89+
export const METRIC_DB_CLIENT_CONNECTION_PENDING_REQUESTS =
90+
'db.client.connection.pending_requests';
91+
92+
/**
93+
* Duration of database client operations.
94+
*
95+
* @note Batch operations **SHOULD** be recorded as a single operation.
96+
*
97+
* @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
98+
*/
99+
export const METRIC_DB_CLIENT_OPERATION_DURATION =
100+
'db.client.operation.duration';

0 commit comments

Comments
 (0)