Skip to content

Commit 50020c6

Browse files
authored
chore(instrumentation-aws-sdk): update semconv usage to ATTR_ exports (#3065)
1 parent 8e1ca48 commit 50020c6

File tree

14 files changed

+579
-188
lines changed

14 files changed

+579
-188
lines changed

packages/instrumentation-aws-sdk/src/aws-sdk.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import {
5656
} from './utils';
5757
import { propwrap } from './propwrap';
5858
import { RequestMetadata } from './services/ServiceExtension';
59-
import { SEMATTRS_HTTP_STATUS_CODE } from '@opentelemetry/semantic-conventions';
59+
import { ATTR_HTTP_STATUS_CODE } from './semconv';
6060

6161
const V3_CLIENT_CONFIG_KEY = Symbol(
6262
'opentelemetry.instrumentation.aws-sdk.client.config'
@@ -406,10 +406,7 @@ export class AwsInstrumentation extends InstrumentationBase<AwsSdkInstrumentatio
406406
const httpStatusCode =
407407
response.output?.$metadata?.httpStatusCode;
408408
if (httpStatusCode) {
409-
span.setAttribute(
410-
SEMATTRS_HTTP_STATUS_CODE,
411-
httpStatusCode
412-
);
409+
span.setAttribute(ATTR_HTTP_STATUS_CODE, httpStatusCode);
413410
}
414411

415412
const extendedRequestId =
@@ -448,10 +445,7 @@ export class AwsInstrumentation extends InstrumentationBase<AwsSdkInstrumentatio
448445

449446
const httpStatusCode = err?.$metadata?.httpStatusCode;
450447
if (httpStatusCode) {
451-
span.setAttribute(
452-
SEMATTRS_HTTP_STATUS_CODE,
453-
httpStatusCode
454-
);
448+
span.setAttribute(ATTR_HTTP_STATUS_CODE, httpStatusCode);
455449
}
456450

457451
const extendedRequestId = err?.extendedRequestId;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
* This file contains constants for values that where replaced/removed from
19+
* Semantic Conventions long enough ago that they do not have `ATTR_*`
20+
* constants in the `@opentelemetry/semantic-conventions` package. Eventually
21+
* it is expected that this instrumention will be updated to emit telemetry
22+
* using modern Semantic Conventions, dropping the need for the constants in
23+
* this file.
24+
*/
25+
26+
/**
27+
* The execution ID of the current function execution.
28+
*
29+
* @deprecated Use ATTR_FAAS_INVOCATION_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}).
30+
*/
31+
export const ATTR_FAAS_EXECUTION = 'faas.execution' as const;
32+
33+
/**
34+
* The message destination name. This might be equal to the span name but is required nevertheless.
35+
*
36+
* @deprecated Use ATTR_MESSAGING_DESTINATION_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}).
37+
*/
38+
export const ATTR_MESSAGING_DESTINATION = 'messaging.destination' as const;
39+
40+
/**
41+
* The kind of message destination.
42+
*
43+
* @deprecated Removed in semconv v1.20.0.
44+
*/
45+
export const ATTR_MESSAGING_DESTINATION_KIND =
46+
'messaging.destination_kind' as const;
47+
48+
/**
49+
* The kind of message destination.
50+
*
51+
* @deprecated Removed in semconv v1.20.0.
52+
*/
53+
export const MESSAGING_DESTINATION_KIND_VALUE_TOPIC = 'topic' as const;
54+
55+
/**
56+
* A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is &#34;send&#34;, this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case.
57+
*
58+
* @deprecated Use MESSAGING_OPERATION_TYPE_VALUE_RECEIVE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}).
59+
*/
60+
export const MESSAGING_OPERATION_VALUE_RECEIVE = 'receive' as const;

0 commit comments

Comments
 (0)