Skip to content

Commit 8a0ff74

Browse files
committed
Import S3/Kinesis/DynamoDB/SecretsManager/StepFunctions attributes from @sentry/conventions
1 parent a73914b commit 8a0ff74

6 files changed

Lines changed: 38 additions & 69 deletions

File tree

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,11 @@
11
/**
2-
* AWS-specific span attribute names used by the aws-sdk channel integration.
3-
*
4-
* These mirror the constants the OTel `@opentelemetry/instrumentation-aws-sdk` emits (some are
5-
* unstable/obsolete OTel semantic conventions with no `ATTR_*` export in
6-
* `@opentelemetry/semantic-conventions`), inlined here so the integration stays free of OTel deps.
7-
* Attributes that exist in `@sentry/conventions/attributes` are imported from there instead;
8-
* TODO(aws-sdk): the active attributes below are being added to sentry-conventions and should move
9-
* to `@sentry/conventions/attributes` imports once a release containing them ships.
2+
* AWS-specific span constants used by the aws-sdk channel integration that are NOT covered by
3+
* `@sentry/conventions/attributes` (attribute names that exist there are imported from there
4+
* directly). Per-service files append their own such constants below.
105
*/
116

127
/** The span origin every aws-sdk channel span carries, mirroring the uniform OTel `auto.otel.aws`. */
138
export const AWS_SDK_ORIGIN = 'auto.aws.orchestrion.aws_sdk';
149

15-
export const ATTR_RPC_SYSTEM = 'rpc.system';
16-
export const AWS_REQUEST_ID = 'aws.request.id';
17-
export const AWS_REQUEST_EXTENDED_ID = 'aws.request.extended_id';
18-
export const AWS_S3_BUCKET = 'aws.s3.bucket';
19-
export const AWS_KINESIS_STREAM_NAME = 'aws.kinesis.stream.name';
20-
21-
// DynamoDB
22-
export const ATTR_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS = 'aws.dynamodb.attribute_definitions';
23-
export const ATTR_AWS_DYNAMODB_CONSISTENT_READ = 'aws.dynamodb.consistent_read';
24-
export const ATTR_AWS_DYNAMODB_CONSUMED_CAPACITY = 'aws.dynamodb.consumed_capacity';
25-
export const ATTR_AWS_DYNAMODB_COUNT = 'aws.dynamodb.count';
26-
export const ATTR_AWS_DYNAMODB_EXCLUSIVE_START_TABLE = 'aws.dynamodb.exclusive_start_table';
27-
export const ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = 'aws.dynamodb.global_secondary_indexes';
28-
export const ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = 'aws.dynamodb.global_secondary_index_updates';
29-
export const ATTR_AWS_DYNAMODB_INDEX_NAME = 'aws.dynamodb.index_name';
30-
export const ATTR_AWS_DYNAMODB_ITEM_COLLECTION_METRICS = 'aws.dynamodb.item_collection_metrics';
31-
export const ATTR_AWS_DYNAMODB_LIMIT = 'aws.dynamodb.limit';
32-
export const ATTR_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = 'aws.dynamodb.local_secondary_indexes';
33-
export const ATTR_AWS_DYNAMODB_PROJECTION = 'aws.dynamodb.projection';
34-
export const ATTR_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = 'aws.dynamodb.provisioned_read_capacity';
35-
export const ATTR_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = 'aws.dynamodb.provisioned_write_capacity';
36-
export const ATTR_AWS_DYNAMODB_SCANNED_COUNT = 'aws.dynamodb.scanned_count';
37-
export const ATTR_AWS_DYNAMODB_SCAN_FORWARD = 'aws.dynamodb.scan_forward';
38-
export const ATTR_AWS_DYNAMODB_SEGMENT = 'aws.dynamodb.segment';
39-
export const ATTR_AWS_DYNAMODB_SELECT = 'aws.dynamodb.select';
40-
export const ATTR_AWS_DYNAMODB_TABLE_COUNT = 'aws.dynamodb.table_count';
41-
export const ATTR_AWS_DYNAMODB_TABLE_NAMES = 'aws.dynamodb.table_names';
42-
export const ATTR_AWS_DYNAMODB_TOTAL_SEGMENTS = 'aws.dynamodb.total_segments';
10+
/** DynamoDB `db.system` value (an attribute value, not a key, so not covered by conventions). */
4311
export const DB_SYSTEM_VALUE_DYNAMODB = 'dynamodb';
44-
45-
// SecretsManager / StepFunctions
46-
export const ATTR_AWS_SECRETSMANAGER_SECRET_ARN = 'aws.secretsmanager.secret.arn';
47-
export const ATTR_AWS_STEP_FUNCTIONS_ACTIVITY_ARN = 'aws.step_functions.activity.arn';
48-
export const ATTR_AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN = 'aws.step_functions.state_machine.arn';

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

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
import type { Span } from '@sentry/core';
22
import { SPAN_KIND } from '@sentry/core';
3-
import { DB_NAME, DB_OPERATION, DB_SYSTEM } from '@sentry/conventions/attributes';
43
import {
5-
ATTR_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS,
6-
ATTR_AWS_DYNAMODB_CONSISTENT_READ,
7-
ATTR_AWS_DYNAMODB_CONSUMED_CAPACITY,
8-
ATTR_AWS_DYNAMODB_COUNT,
9-
ATTR_AWS_DYNAMODB_EXCLUSIVE_START_TABLE,
10-
ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES,
11-
ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES,
12-
ATTR_AWS_DYNAMODB_INDEX_NAME,
13-
ATTR_AWS_DYNAMODB_ITEM_COLLECTION_METRICS,
14-
ATTR_AWS_DYNAMODB_LIMIT,
15-
ATTR_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES,
16-
ATTR_AWS_DYNAMODB_PROJECTION,
17-
ATTR_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY,
18-
ATTR_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY,
19-
ATTR_AWS_DYNAMODB_SCAN_FORWARD,
20-
ATTR_AWS_DYNAMODB_SCANNED_COUNT,
21-
ATTR_AWS_DYNAMODB_SEGMENT,
22-
ATTR_AWS_DYNAMODB_SELECT,
23-
ATTR_AWS_DYNAMODB_TABLE_COUNT,
24-
ATTR_AWS_DYNAMODB_TABLE_NAMES,
25-
ATTR_AWS_DYNAMODB_TOTAL_SEGMENTS,
26-
DB_SYSTEM_VALUE_DYNAMODB,
27-
} from '../constants';
4+
AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS as ATTR_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS,
5+
AWS_DYNAMODB_CONSISTENT_READ as ATTR_AWS_DYNAMODB_CONSISTENT_READ,
6+
AWS_DYNAMODB_CONSUMED_CAPACITY as ATTR_AWS_DYNAMODB_CONSUMED_CAPACITY,
7+
AWS_DYNAMODB_COUNT as ATTR_AWS_DYNAMODB_COUNT,
8+
AWS_DYNAMODB_EXCLUSIVE_START_TABLE as ATTR_AWS_DYNAMODB_EXCLUSIVE_START_TABLE,
9+
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES as ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES,
10+
AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES as ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES,
11+
AWS_DYNAMODB_INDEX_NAME as ATTR_AWS_DYNAMODB_INDEX_NAME,
12+
AWS_DYNAMODB_ITEM_COLLECTION_METRICS as ATTR_AWS_DYNAMODB_ITEM_COLLECTION_METRICS,
13+
AWS_DYNAMODB_LIMIT as ATTR_AWS_DYNAMODB_LIMIT,
14+
AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES as ATTR_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES,
15+
AWS_DYNAMODB_PROJECTION as ATTR_AWS_DYNAMODB_PROJECTION,
16+
AWS_DYNAMODB_PROVISIONED_READ_CAPACITY as ATTR_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY,
17+
AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY as ATTR_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY,
18+
AWS_DYNAMODB_SCAN_FORWARD as ATTR_AWS_DYNAMODB_SCAN_FORWARD,
19+
AWS_DYNAMODB_SCANNED_COUNT as ATTR_AWS_DYNAMODB_SCANNED_COUNT,
20+
AWS_DYNAMODB_SEGMENT as ATTR_AWS_DYNAMODB_SEGMENT,
21+
AWS_DYNAMODB_SELECT as ATTR_AWS_DYNAMODB_SELECT,
22+
AWS_DYNAMODB_TABLE_COUNT as ATTR_AWS_DYNAMODB_TABLE_COUNT,
23+
AWS_DYNAMODB_TABLE_NAMES as ATTR_AWS_DYNAMODB_TABLE_NAMES,
24+
AWS_DYNAMODB_TOTAL_SEGMENTS as ATTR_AWS_DYNAMODB_TOTAL_SEGMENTS,
25+
DB_NAME,
26+
DB_OPERATION,
27+
DB_SYSTEM,
28+
} from '@sentry/conventions/attributes';
29+
import { DB_SYSTEM_VALUE_DYNAMODB } from '../constants';
2830
import type { NormalizedRequest, NormalizedResponse } from '../types';
2931
import type { RequestMetadata, ServiceExtension } from './ServiceExtension';
3032

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SPAN_KIND } from '@sentry/core';
2-
import { AWS_KINESIS_STREAM_NAME } from '../constants';
2+
import { _AWS_KINESIS_STREAM_NAME as AWS_KINESIS_STREAM_NAME } from '@sentry/conventions/attributes';
33
import type { NormalizedRequest } from '../types';
44
import type { RequestMetadata, ServiceExtension } from './ServiceExtension';
55

@@ -9,6 +9,7 @@ export class KinesisServiceExtension implements ServiceExtension {
99
const spanAttributes: Record<string, unknown> = {};
1010

1111
if (streamName) {
12+
// oxlint-disable-next-line typescript/no-deprecated -- old-semconv aws.kinesis.stream.name, matched to the OTel aws-sdk integration
1213
spanAttributes[AWS_KINESIS_STREAM_NAME] = streamName;
1314
}
1415

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { SPAN_KIND } from '@sentry/core';
2-
import { AWS_S3_BUCKET } from '../constants';
2+
import { AWS_S3_BUCKET } from '@sentry/conventions/attributes';
33
import type { NormalizedRequest } from '../types';
44
import type { RequestMetadata, ServiceExtension } from './ServiceExtension';
55

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Span } from '@sentry/core';
22
import { SPAN_KIND } from '@sentry/core';
3-
import { ATTR_AWS_SECRETSMANAGER_SECRET_ARN } from '../constants';
3+
import { AWS_SECRETSMANAGER_SECRET_ARN as ATTR_AWS_SECRETSMANAGER_SECRET_ARN } from '@sentry/conventions/attributes';
44
import type { NormalizedRequest, NormalizedResponse } from '../types';
55
import type { RequestMetadata, ServiceExtension } from './ServiceExtension';
66

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { SPAN_KIND } from '@sentry/core';
2-
import { ATTR_AWS_STEP_FUNCTIONS_ACTIVITY_ARN, ATTR_AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN } from '../constants';
2+
import {
3+
AWS_STEP_FUNCTIONS_ACTIVITY_ARN as ATTR_AWS_STEP_FUNCTIONS_ACTIVITY_ARN,
4+
AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN as ATTR_AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN,
5+
} from '@sentry/conventions/attributes';
36
import type { NormalizedRequest } from '../types';
47
import type { RequestMetadata, ServiceExtension } from './ServiceExtension';
58

0 commit comments

Comments
 (0)