Skip to content

Commit 4e49527

Browse files
mydeaclaude
andcommitted
ref(aws-serverless): Use @sentry/conventions
Source span/attribute keys from `@sentry/conventions` instead of the previous OpenTelemetry / vendored convention constants. No functional change. Includes the shared `vite/vite.config.ts` and `packages/typescript/tsconfig.json` infra changes needed for the vendored package across supported Node versions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent da5b10a commit 4e49527

13 files changed

Lines changed: 167 additions & 357 deletions

File tree

packages/aws-serverless/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@
6969
"@opentelemetry/api": "^1.9.1",
7070
"@opentelemetry/core": "^2.6.1",
7171
"@opentelemetry/instrumentation": "^0.214.0",
72-
"@opentelemetry/semantic-conventions": "^1.40.0",
7372
"@sentry/core": "10.57.0",
7473
"@sentry/node": "10.57.0",
7574
"@sentry/node-core": "10.57.0",
7675
"@types/aws-lambda": "^8.10.161"
7776
},
7877
"devDependencies": {
78+
"@sentry/conventions": "^0.11.0",
7979
"@types/node": "^18.19.1",
8080
"@vercel/nft": "^1.3.0"
8181
},

packages/aws-serverless/src/integration/aws/vendored/aws-sdk.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020
/* eslint-disable */
2121

22+
import { HTTP_RESPONSE_STATUS_CODE, HTTP_STATUS_CODE } from '@sentry/conventions/attributes';
2223
import { Span, SpanKind, context, trace, diag, SpanStatusCode } from '@opentelemetry/api';
2324
import { suppressTracing } from '@opentelemetry/core';
2425
import { AttributeNames } from './enums';
@@ -55,8 +56,6 @@ import {
5556
} from './utils';
5657
import { propwrap } from './propwrap';
5758
import { RequestMetadata } from './services/ServiceExtension';
58-
import { ATTR_HTTP_STATUS_CODE } from './semconv';
59-
import { ATTR_HTTP_RESPONSE_STATUS_CODE } from '@opentelemetry/semantic-conventions';
6059
import { SDK_VERSION, timestampInSeconds } from '@sentry/core';
6160

6261
const PACKAGE_NAME = '@sentry/instrumentation-aws-sdk';
@@ -332,10 +331,10 @@ export class AwsInstrumentation extends InstrumentationBase<AwsSdkInstrumentatio
332331
const httpStatusCode = response.output?.$metadata?.httpStatusCode;
333332
if (httpStatusCode) {
334333
if (self._httpSemconvStability & SemconvStability.OLD) {
335-
span.setAttribute(ATTR_HTTP_STATUS_CODE, httpStatusCode);
334+
span.setAttribute(HTTP_STATUS_CODE, httpStatusCode);
336335
}
337336
if (self._httpSemconvStability & SemconvStability.STABLE) {
338-
span.setAttribute(ATTR_HTTP_RESPONSE_STATUS_CODE, httpStatusCode);
337+
span.setAttribute(HTTP_RESPONSE_STATUS_CODE, httpStatusCode);
339338
}
340339
}
341340

@@ -372,10 +371,10 @@ export class AwsInstrumentation extends InstrumentationBase<AwsSdkInstrumentatio
372371
const httpStatusCode = err?.$metadata?.httpStatusCode;
373372
if (httpStatusCode) {
374373
if (self._httpSemconvStability & SemconvStability.OLD) {
375-
span.setAttribute(ATTR_HTTP_STATUS_CODE, httpStatusCode);
374+
span.setAttribute(HTTP_STATUS_CODE, httpStatusCode);
376375
}
377376
if (self._httpSemconvStability & SemconvStability.STABLE) {
378-
span.setAttribute(ATTR_HTTP_RESPONSE_STATUS_CODE, httpStatusCode);
377+
span.setAttribute(HTTP_RESPONSE_STATUS_CODE, httpStatusCode);
379378
}
380379
}
381380

packages/aws-serverless/src/integration/aws/vendored/semconv.ts

Lines changed: 0 additions & 213 deletions
Original file line numberDiff line numberDiff line change
@@ -252,52 +252,6 @@ export const ATTR_AWS_STEP_FUNCTIONS_ACTIVITY_ARN = 'aws.step_functions.activity
252252
*/
253253
export const ATTR_AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN = 'aws.step_functions.state_machine.arn' as const;
254254

255-
/**
256-
* Deprecated, use `db.namespace` instead.
257-
*
258-
* @example customers
259-
* @example main
260-
*
261-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
262-
*
263-
* @deprecated Replaced by `db.namespace`.
264-
*/
265-
export const ATTR_DB_NAME = 'db.name' as const;
266-
267-
/**
268-
* Deprecated, use `db.operation.name` instead.
269-
*
270-
* @example findAndModify
271-
* @example HMSET
272-
* @example SELECT
273-
*
274-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
275-
*
276-
* @deprecated Replaced by `db.operation.name`.
277-
*/
278-
export const ATTR_DB_OPERATION = 'db.operation' as const;
279-
280-
/**
281-
* The database statement being executed.
282-
*
283-
* @example SELECT * FROM wuser_table
284-
* @example SET mykey "WuValue"
285-
*
286-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
287-
*
288-
* @deprecated Replaced by `db.query.text`.
289-
*/
290-
export const ATTR_DB_STATEMENT = 'db.statement' as const;
291-
292-
/**
293-
* Deprecated, use `db.system.name` instead.
294-
*
295-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
296-
*
297-
* @deprecated Replaced by `db.system.name`.
298-
*/
299-
export const ATTR_DB_SYSTEM = 'db.system' as const;
300-
301255
/**
302256
* The name of the invoked function.
303257
*
@@ -329,33 +283,6 @@ export const ATTR_FAAS_INVOKED_PROVIDER = 'faas.invoked_provider' as const;
329283
*/
330284
export const ATTR_FAAS_INVOKED_REGION = 'faas.invoked_region' as const;
331285

332-
/**
333-
* The name of the operation being performed.
334-
*
335-
* @note If one of the predefined values applies, but specific system uses a different name it's **RECOMMENDED** to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries **SHOULD** use applicable predefined value.
336-
*
337-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
338-
*/
339-
export const ATTR_GEN_AI_OPERATION_NAME = 'gen_ai.operation.name' as const;
340-
341-
/**
342-
* The maximum number of tokens the model generates for a request.
343-
*
344-
* @example 100
345-
*
346-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
347-
*/
348-
export const ATTR_GEN_AI_REQUEST_MAX_TOKENS = 'gen_ai.request.max_tokens' as const;
349-
350-
/**
351-
* The name of the GenAI model a request is being made to.
352-
*
353-
* @example "gpt-4"
354-
*
355-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
356-
*/
357-
export const ATTR_GEN_AI_REQUEST_MODEL = 'gen_ai.request.model' as const;
358-
359286
/**
360287
* List of sequences that the model will use to stop generating further tokens.
361288
*
@@ -365,43 +292,6 @@ export const ATTR_GEN_AI_REQUEST_MODEL = 'gen_ai.request.model' as const;
365292
*/
366293
export const ATTR_GEN_AI_REQUEST_STOP_SEQUENCES = 'gen_ai.request.stop_sequences' as const;
367294

368-
/**
369-
* The temperature setting for the GenAI request.
370-
*
371-
* @example 0.0
372-
*
373-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
374-
*/
375-
export const ATTR_GEN_AI_REQUEST_TEMPERATURE = 'gen_ai.request.temperature' as const;
376-
377-
/**
378-
* The top_p sampling setting for the GenAI request.
379-
*
380-
* @example 1.0
381-
*
382-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
383-
*/
384-
export const ATTR_GEN_AI_REQUEST_TOP_P = 'gen_ai.request.top_p' as const;
385-
386-
/**
387-
* Array of reasons the model stopped generating tokens, corresponding to each generation received.
388-
*
389-
* @example ["stop"]
390-
* @example ["stop", "length"]
391-
*
392-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
393-
*/
394-
export const ATTR_GEN_AI_RESPONSE_FINISH_REASONS = 'gen_ai.response.finish_reasons' as const;
395-
396-
/**
397-
* Deprecated, use `gen_ai.provider.name` instead.
398-
*
399-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
400-
*
401-
* @deprecated Replaced by `gen_ai.provider.name`.
402-
*/
403-
export const ATTR_GEN_AI_SYSTEM = 'gen_ai.system' as const;
404-
405295
/**
406296
* The type of token being counted.
407297
*
@@ -412,70 +302,6 @@ export const ATTR_GEN_AI_SYSTEM = 'gen_ai.system' as const;
412302
*/
413303
export const ATTR_GEN_AI_TOKEN_TYPE = 'gen_ai.token.type' as const;
414304

415-
/**
416-
* The number of tokens used in the GenAI input (prompt).
417-
*
418-
* @example 100
419-
*
420-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
421-
*/
422-
export const ATTR_GEN_AI_USAGE_INPUT_TOKENS = 'gen_ai.usage.input_tokens' as const;
423-
424-
/**
425-
* The number of tokens used in the GenAI response (completion).
426-
*
427-
* @example 180
428-
*
429-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
430-
*/
431-
export const ATTR_GEN_AI_USAGE_OUTPUT_TOKENS = 'gen_ai.usage.output_tokens' as const;
432-
433-
/**
434-
* Deprecated, use `http.response.status_code` instead.
435-
*
436-
* @example 200
437-
*
438-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
439-
*
440-
* @deprecated Replaced by `http.response.status_code`.
441-
*/
442-
export const ATTR_HTTP_STATUS_CODE = 'http.status_code' as const;
443-
444-
/**
445-
* The number of messages sent, received, or processed in the scope of the batching operation.
446-
*
447-
* @example 0
448-
* @example 1
449-
* @example 2
450-
*
451-
* @note Instrumentations **SHOULD NOT** set `messaging.batch.message_count` on spans that operate with a single message. When a messaging client library supports both batch and single-message API for the same operation, instrumentations **SHOULD** use `messaging.batch.message_count` for batching APIs and **SHOULD NOT** use it for single-message APIs.
452-
*
453-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
454-
*/
455-
export const ATTR_MESSAGING_BATCH_MESSAGE_COUNT = 'messaging.batch.message_count' as const;
456-
457-
/**
458-
* The message destination name
459-
*
460-
* @example MyQueue
461-
* @example MyTopic
462-
*
463-
* @note Destination name **SHOULD** uniquely identify a specific queue, topic or other entity within the broker. If
464-
* the broker doesn't have such notion, the destination name **SHOULD** uniquely identify the broker.
465-
*
466-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
467-
*/
468-
export const ATTR_MESSAGING_DESTINATION_NAME = 'messaging.destination.name' as const;
469-
470-
/**
471-
* A value used by the messaging system as an identifier for the message, represented as a string.
472-
*
473-
* @example "452a7c7c7c7048c2f887f61572b18fc2"
474-
*
475-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
476-
*/
477-
export const ATTR_MESSAGING_MESSAGE_ID = 'messaging.message.id' as const;
478-
479305
/**
480306
* Deprecated, use `messaging.operation.type` instead.
481307
*
@@ -489,45 +315,6 @@ export const ATTR_MESSAGING_MESSAGE_ID = 'messaging.message.id' as const;
489315
*/
490316
export const ATTR_MESSAGING_OPERATION = 'messaging.operation' as const;
491317

492-
/**
493-
* A string identifying the type of the messaging operation.
494-
*
495-
* @note If a custom value is used, it **MUST** be of low cardinality.
496-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
497-
*/
498-
export const ATTR_MESSAGING_OPERATION_TYPE = 'messaging.operation.type' as const;
499-
500-
/**
501-
* The messaging system as identified by the client instrumentation.
502-
*
503-
* @note The actual messaging system may differ from the one known by the client. For example, when using Kafka client libraries to communicate with Azure Event Hubs, the `messaging.system` is set to `kafka` based on the instrumentation's best knowledge.
504-
*
505-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
506-
*/
507-
export const ATTR_MESSAGING_SYSTEM = 'messaging.system' as const;
508-
509-
/**
510-
* The name of the (logical) method being called, must be equal to the $method part in the span name.
511-
*
512-
* @example "exampleMethod"
513-
*
514-
* @note This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function.name` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side).
515-
*
516-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
517-
*/
518-
export const ATTR_RPC_METHOD = 'rpc.method' as const;
519-
520-
/**
521-
* The full (logical) name of the service being called, including its package name, if applicable.
522-
*
523-
* @example "myservice.EchoService"
524-
*
525-
* @note This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side).
526-
*
527-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
528-
*/
529-
export const ATTR_RPC_SERVICE = 'rpc.service' as const;
530-
531318
/**
532319
* A string identifying the remoting system. See below for a list of well-known identifiers.
533320
*

0 commit comments

Comments
 (0)