Skip to content

Commit 0d5ff66

Browse files
committed
Import SNS and Lambda attributes from @sentry/conventions
1 parent 0f76cd4 commit 0d5ff66

3 files changed

Lines changed: 17 additions & 24 deletions

File tree

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/**
22
* AWS-specific span constants used by the aws-sdk channel integration that are NOT covered by
33
* `@sentry/conventions/attributes` (attribute names that exist there are imported from there
4-
* directly). Per-service files append their own such constants below.
4+
* directly). These are either Sentry-specific (the span origin), attribute *values* (not keys), or
5+
* obsolete OTel conventions with no `@sentry/conventions` export.
56
*/
67

78
/** The span origin every aws-sdk channel span carries, mirroring the uniform OTel `auto.otel.aws`. */
@@ -10,16 +11,6 @@ export const AWS_SDK_ORIGIN = 'auto.aws.orchestrion.aws_sdk';
1011
/** DynamoDB `db.system` value (an attribute value, not a key, so not covered by conventions). */
1112
export const DB_SYSTEM_VALUE_DYNAMODB = 'dynamodb';
1213

13-
// SNS
14-
export const ATTR_AWS_SNS_TOPIC_ARN = 'aws.sns.topic.arn';
15-
16-
// Lambda (faas)
17-
export const ATTR_FAAS_INVOKED_NAME = 'faas.invoked_name';
18-
export const ATTR_FAAS_INVOKED_PROVIDER = 'faas.invoked_provider';
19-
export const ATTR_FAAS_INVOKED_REGION = 'faas.invoked_region';
20-
export const ATTR_FAAS_EXECUTION = 'faas.execution';
21-
22-
// Messaging (obsolete OTel conventions kept for parity with the OTel integration)
23-
export const ATTR_MESSAGING_DESTINATION = 'messaging.destination';
14+
// Messaging (obsolete OTel convention with no `@sentry/conventions` export, kept for parity)
2415
export const ATTR_MESSAGING_DESTINATION_KIND = 'messaging.destination_kind';
2516
export const MESSAGING_DESTINATION_KIND_VALUE_TOPIC = 'topic';

packages/server-utils/src/integrations/tracing-channel/aws-sdk/services/lambda.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { Span } from '@sentry/core';
22
import { debug, getTraceData, SPAN_KIND } from '@sentry/core';
3-
import { DEBUG_BUILD } from '../../../../debug-build';
43
import {
5-
ATTR_FAAS_EXECUTION,
6-
ATTR_FAAS_INVOKED_NAME,
7-
ATTR_FAAS_INVOKED_PROVIDER,
8-
ATTR_FAAS_INVOKED_REGION,
9-
} from '../constants';
4+
FAAS_EXECUTION as ATTR_FAAS_EXECUTION,
5+
FAAS_INVOKED_NAME as ATTR_FAAS_INVOKED_NAME,
6+
FAAS_INVOKED_PROVIDER as ATTR_FAAS_INVOKED_PROVIDER,
7+
FAAS_INVOKED_REGION as ATTR_FAAS_INVOKED_REGION,
8+
} from '@sentry/conventions/attributes';
9+
import { DEBUG_BUILD } from '../../../../debug-build';
1010
import type { NormalizedRequest, NormalizedResponse } from '../types';
1111
import type { RequestMetadata, ServiceExtension } from './ServiceExtension';
1212

@@ -43,6 +43,7 @@ export class LambdaServiceExtension implements ServiceExtension {
4343

4444
public responseHook(response: NormalizedResponse, span: Span): void {
4545
if (response.request.commandName === INVOKE_COMMAND) {
46+
// oxlint-disable-next-line typescript/no-deprecated -- old-semconv faas.execution, matched to the OTel aws-sdk integration
4647
span.setAttribute(ATTR_FAAS_EXECUTION, response.requestId);
4748
// Region resolves asynchronously after `requestPreSpanHook`, so it's backfilled onto the
4849
// normalized request and read here (same timing as `cloud.region`).

packages/server-utils/src/integrations/tracing-channel/aws-sdk/services/sns.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { Span, SpanKindValue } from '@sentry/core';
22
import { getTraceData, SPAN_KIND } from '@sentry/core';
3-
import { MESSAGING_DESTINATION_NAME, MESSAGING_SYSTEM } from '@sentry/conventions/attributes';
43
import {
5-
ATTR_AWS_SNS_TOPIC_ARN,
6-
ATTR_MESSAGING_DESTINATION,
7-
ATTR_MESSAGING_DESTINATION_KIND,
8-
MESSAGING_DESTINATION_KIND_VALUE_TOPIC,
9-
} from '../constants';
4+
AWS_SNS_TOPIC_ARN as ATTR_AWS_SNS_TOPIC_ARN,
5+
MESSAGING_DESTINATION as ATTR_MESSAGING_DESTINATION,
6+
MESSAGING_DESTINATION_NAME,
7+
MESSAGING_SYSTEM,
8+
} from '@sentry/conventions/attributes';
9+
import { ATTR_MESSAGING_DESTINATION_KIND, MESSAGING_DESTINATION_KIND_VALUE_TOPIC } from '../constants';
1010
import type { NormalizedRequest, NormalizedResponse } from '../types';
1111
import { injectPropagationContext } from './MessageAttributes';
1212
import type { RequestMetadata, ServiceExtension } from './ServiceExtension';
@@ -25,6 +25,7 @@ export class SnsServiceExtension implements ServiceExtension {
2525
spanAttributes[ATTR_MESSAGING_DESTINATION_KIND] = MESSAGING_DESTINATION_KIND_VALUE_TOPIC;
2626
const { TopicArn, TargetArn, PhoneNumber } = request.commandInput;
2727
const destinationName = extractDestinationName(TopicArn, TargetArn, PhoneNumber);
28+
// oxlint-disable-next-line typescript/no-deprecated -- old-semconv messaging.destination, matched to the OTel aws-sdk integration
2829
spanAttributes[ATTR_MESSAGING_DESTINATION] = destinationName;
2930
spanAttributes[MESSAGING_DESTINATION_NAME] = TopicArn || TargetArn || PhoneNumber || 'unknown';
3031

0 commit comments

Comments
 (0)