From 18e74be8b6e3822c805477333ddc39b6c13ff11b Mon Sep 17 00:00:00 2001 From: Francesco Gringl-Novy Date: Fri, 12 Jun 2026 12:00:20 +0200 Subject: [PATCH] ref(aws-serverless): Use `@sentry/conventions` Source span/attribute keys from `@sentry/conventions` as a regular dependency (externalized at build time, resolved at runtime). No functional change. Maps the `@sentry/conventions/attributes` subpath in the shared TS config for the repo's `node` moduleResolution type builds. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/aws-serverless/package.json | 2 +- .../src/integration/aws/vendored/aws-sdk.ts | 11 +- .../src/integration/aws/vendored/semconv.ts | 213 ------------------ .../aws/vendored/services/bedrock-runtime.ts | 168 +++++++------- .../aws/vendored/services/dynamodb.ts | 36 +-- .../integration/aws/vendored/services/sns.ts | 5 +- .../integration/aws/vendored/services/sqs.ts | 30 +-- .../src/integration/aws/vendored/utils.ts | 7 +- .../instrumentation.ts | 19 +- .../instrumentation-aws-lambda/semconv.ts | 13 +- packages/typescript/tsconfig.json | 5 +- yarn.lock | 5 + 12 files changed, 157 insertions(+), 357 deletions(-) diff --git a/packages/aws-serverless/package.json b/packages/aws-serverless/package.json index 3b12bb1807ad..4415eae2dec2 100644 --- a/packages/aws-serverless/package.json +++ b/packages/aws-serverless/package.json @@ -69,7 +69,7 @@ "@opentelemetry/api": "^1.9.1", "@opentelemetry/core": "^2.6.1", "@opentelemetry/instrumentation": "^0.214.0", - "@opentelemetry/semantic-conventions": "^1.40.0", + "@sentry/conventions": "^0.11.0", "@sentry/core": "10.57.0", "@sentry/node": "10.57.0", "@sentry/node-core": "10.57.0", diff --git a/packages/aws-serverless/src/integration/aws/vendored/aws-sdk.ts b/packages/aws-serverless/src/integration/aws/vendored/aws-sdk.ts index b20c1387d72a..0a4b6ee1cd0d 100644 --- a/packages/aws-serverless/src/integration/aws/vendored/aws-sdk.ts +++ b/packages/aws-serverless/src/integration/aws/vendored/aws-sdk.ts @@ -19,6 +19,7 @@ */ /* eslint-disable */ +import { HTTP_RESPONSE_STATUS_CODE, HTTP_STATUS_CODE } from '@sentry/conventions/attributes'; import { Span, SpanKind, context, trace, diag, SpanStatusCode } from '@opentelemetry/api'; import { suppressTracing } from '@opentelemetry/core'; import { AttributeNames } from './enums'; @@ -55,8 +56,6 @@ import { } from './utils'; import { propwrap } from './propwrap'; import { RequestMetadata } from './services/ServiceExtension'; -import { ATTR_HTTP_STATUS_CODE } from './semconv'; -import { ATTR_HTTP_RESPONSE_STATUS_CODE } from '@opentelemetry/semantic-conventions'; import { SDK_VERSION, timestampInSeconds } from '@sentry/core'; const PACKAGE_NAME = '@sentry/instrumentation-aws-sdk'; @@ -332,10 +331,10 @@ export class AwsInstrumentation extends InstrumentationBase { switch (response.request.commandName) { case 'SendMessage': - span.setAttribute(ATTR_MESSAGING_MESSAGE_ID, response?.data?.MessageId); + span.setAttribute(MESSAGING_MESSAGE_ID, response?.data?.MessageId); break; case 'SendMessageBatch': @@ -120,7 +120,7 @@ export class SqsServiceExtension implements ServiceExtension { case 'ReceiveMessage': { const messages: SQS.Message[] = response?.data?.Messages || []; - span.setAttribute(ATTR_MESSAGING_BATCH_MESSAGE_COUNT, messages.length); + span.setAttribute(MESSAGING_BATCH_MESSAGE_COUNT, messages.length); for (const message of messages) { const propagatedContext = propagation.extract( @@ -135,7 +135,7 @@ export class SqsServiceExtension implements ServiceExtension { span.addLink({ context: spanContext, attributes: { - [ATTR_MESSAGING_MESSAGE_ID]: message.MessageId, + [MESSAGING_MESSAGE_ID]: message.MessageId, }, }); } diff --git a/packages/aws-serverless/src/integration/aws/vendored/utils.ts b/packages/aws-serverless/src/integration/aws/vendored/utils.ts index 2ebefcbe2745..d316b852a1d3 100644 --- a/packages/aws-serverless/src/integration/aws/vendored/utils.ts +++ b/packages/aws-serverless/src/integration/aws/vendored/utils.ts @@ -19,8 +19,9 @@ */ /* eslint-disable */ +import { RPC_METHOD, RPC_SERVICE } from '@sentry/conventions/attributes'; import { Attributes, Context, context } from '@opentelemetry/api'; -import { ATTR_RPC_METHOD, ATTR_RPC_SERVICE, ATTR_RPC_SYSTEM } from './semconv'; +import { ATTR_RPC_SYSTEM } from './semconv'; import { AttributeNames } from './enums'; import { NormalizedRequest } from './types'; @@ -46,8 +47,8 @@ export const normalizeV3Request = ( export const extractAttributesFromNormalizedRequest = (normalizedRequest: NormalizedRequest): Attributes => { return { [ATTR_RPC_SYSTEM]: 'aws-api', - [ATTR_RPC_METHOD]: normalizedRequest.commandName, - [ATTR_RPC_SERVICE]: normalizedRequest.serviceName, + [RPC_METHOD]: normalizedRequest.commandName, + [RPC_SERVICE]: normalizedRequest.serviceName, [AttributeNames.CLOUD_REGION]: normalizedRequest.region, }; }; diff --git a/packages/aws-serverless/src/integration/instrumentation-aws-lambda/instrumentation.ts b/packages/aws-serverless/src/integration/instrumentation-aws-lambda/instrumentation.ts index c564a8dc583a..8241ee1f9dbc 100644 --- a/packages/aws-serverless/src/integration/instrumentation-aws-lambda/instrumentation.ts +++ b/packages/aws-serverless/src/integration/instrumentation-aws-lambda/instrumentation.ts @@ -45,17 +45,12 @@ import { isWrapped, safeExecuteInTheMiddle, } from '@opentelemetry/instrumentation'; -import { - ATTR_URL_FULL, - SEMATTRS_FAAS_EXECUTION, - SEMRESATTRS_CLOUD_ACCOUNT_ID, - SEMRESATTRS_FAAS_ID, -} from '@opentelemetry/semantic-conventions'; +import { CLOUD_ACCOUNT_ID, FAAS_COLDSTART, URL_FULL } from '@sentry/conventions/attributes'; import type { APIGatewayProxyEventHeaders, Callback, Context, Handler, StreamifyHandler } from 'aws-lambda'; import * as fs from 'fs'; import * as path from 'path'; import type { LambdaModule } from './internal-types'; -import { ATTR_FAAS_COLDSTART } from './semconv'; +import { ATTR_FAAS_EXECUTION, ATTR_FAAS_ID } from './semconv'; import type { AwsLambdaInstrumentationConfig, EventContextExtractor } from './types'; import { wrapHandler } from '../../sdk'; import { SDK_VERSION } from '@sentry/core'; @@ -338,10 +333,10 @@ export class AwsLambdaInstrumentation extends InstrumentationBase