@opentelemetry/instrumentation-aws-sdk 0.64.0 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -56
- package/build/src/aws-sdk.d.ts +2 -1
- package/build/src/aws-sdk.js +9 -7
- package/build/src/aws-sdk.js.map +1 -1
- package/build/src/aws-sdk.types.d.ts +1 -0
- package/build/src/semconv.d.ts +10 -0
- package/build/src/semconv.js +11 -1
- package/build/src/semconv.js.map +1 -1
- package/build/src/services/ServiceExtension.d.ts +2 -1
- package/build/src/services/ServiceExtension.js.map +1 -1
- package/build/src/services/ServicesExtensions.d.ts +2 -1
- package/build/src/services/ServicesExtensions.js +2 -2
- package/build/src/services/ServicesExtensions.js.map +1 -1
- package/build/src/services/dynamodb.d.ts +2 -1
- package/build/src/services/dynamodb.js +25 -7
- package/build/src/services/dynamodb.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +5 -15
package/README.md
CHANGED
|
@@ -48,24 +48,25 @@ registerInstrumentations({
|
|
|
48
48
|
|
|
49
49
|
aws-sdk instrumentation has few options available to choose from. You can set the following:
|
|
50
50
|
|
|
51
|
-
| Options | Type
|
|
52
|
-
| ----------------------------------------- |
|
|
53
|
-
| `preRequestHook` | `AwsSdkRequestCustomAttributeFunction`
|
|
54
|
-
| `responseHook` | `AwsSdkResponseCustomAttributeFunction`
|
|
55
|
-
| `exceptionHook` | `AwsSdkExceptionCustomAttributeFunction`
|
|
56
|
-
| `suppressInternalInstrumentation` | `boolean`
|
|
57
|
-
| `sqsExtractContextPropagationFromPayload` | `boolean`
|
|
58
|
-
| `dynamoDBStatementSerializer` | `AwsSdkDynamoDBStatementSerializer`
|
|
51
|
+
| Options | Type | Description |
|
|
52
|
+
| ----------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
53
|
+
| `preRequestHook` | `AwsSdkRequestCustomAttributeFunction` | Hook called before request send, which allow to add custom attributes to span. |
|
|
54
|
+
| `responseHook` | `AwsSdkResponseCustomAttributeFunction` | Hook for adding custom attributes when response is received from aws. |
|
|
55
|
+
| `exceptionHook` | `AwsSdkExceptionCustomAttributeFunction` | Hook for adding custom attributes when exception is received from aws. |
|
|
56
|
+
| `suppressInternalInstrumentation` | `boolean` | Most aws operation use http requests under the hood. Set this to `true` to hide all underlying http spans. |
|
|
57
|
+
| `sqsExtractContextPropagationFromPayload` | `boolean` | Will parse and extract context propagation headers from SQS Payload, false by default. [When should it be used?](./doc/sns.md#integration-with-sqs) |
|
|
58
|
+
| `dynamoDBStatementSerializer` | `AwsSdkDynamoDBStatementSerializer` | AWS SDK instrumentation will serialize DynamoDB commands to the `db.statement` attribute using the specified function. Defaults to using a serializer that returns `undefined`. |
|
|
59
59
|
|
|
60
60
|
## Span Attributes
|
|
61
61
|
|
|
62
62
|
The instrumentations are collecting the following attributes:
|
|
63
|
-
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
| `rpc.
|
|
67
|
-
| `rpc.
|
|
68
|
-
| `
|
|
63
|
+
|
|
64
|
+
| Attribute Name | Type | Description | Example |
|
|
65
|
+
| -------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
|
|
66
|
+
| `rpc.system` | string | Always equals "aws-api" | |
|
|
67
|
+
| `rpc.method` | string | The name of the operation corresponding to the request, as returned by the AWS SDK. If the SDK does not provide a way to retrieve a name, the name of the command SHOULD be used, removing the suffix `Command` if present, resulting in a PascalCase name with no spaces. | `PutObject` |
|
|
68
|
+
| `rpc.service` | string | The name of the service to which a request is made, as returned by the AWS SDK. If the SDK does not provide a away to retrieve a name, the name of the SDK's client interface for a service SHOULD be used, removing the suffix `Client` if present, resulting in a PascalCase name with no spaces. | `S3`, `DynamoDB`, `Route53` |
|
|
69
|
+
| `cloud.region` | string | Region name for the request | "eu-west-1" |
|
|
69
70
|
|
|
70
71
|
### Custom User Attributes
|
|
71
72
|
|
|
@@ -109,48 +110,48 @@ This package emits telemetry using a mix of Semantic Convention versions. While
|
|
|
109
110
|
|
|
110
111
|
Attributes collected (this list is currently not exhaustive):
|
|
111
112
|
|
|
112
|
-
| Attribute
|
|
113
|
-
|
|
|
114
|
-
| `http.status_code` / `http.response.status_code` | (aws-sdk) HTTP response status code. See "HTTP Semantic Convention migration" note below.
|
|
115
|
-
| `rpc.method`
|
|
116
|
-
| `rpc.service`
|
|
117
|
-
| `rpc.system`
|
|
118
|
-
| `cloud.region`
|
|
119
|
-
| `aws.dynamodb.attribute_definitions`
|
|
120
|
-
| `aws.dynamodb.consistent_read`
|
|
121
|
-
| `aws.dynamodb.consumed_capacity`
|
|
122
|
-
| `aws.dynamodb.count`
|
|
123
|
-
| `aws.dynamodb.exclusive_start_table`
|
|
124
|
-
| `aws.dynamodb.global_secondary_index_updates`
|
|
125
|
-
| `aws.dynamodb.global_secondary_indexes`
|
|
126
|
-
| `aws.dynamodb.index_name`
|
|
127
|
-
| `aws.dynamodb.item_collection_metrics`
|
|
128
|
-
| `aws.dynamodb.limit`
|
|
129
|
-
| `aws.dynamodb.local_secondary_indexes`
|
|
130
|
-
| `aws.dynamodb.projection`
|
|
131
|
-
| `aws.dynamodb.provisioned_read_capacity`
|
|
132
|
-
| `aws.dynamodb.provisioned_write_capacity`
|
|
133
|
-
| `aws.dynamodb.scan_forward`
|
|
134
|
-
| `aws.dynamodb.scanned_count`
|
|
135
|
-
| `aws.dynamodb.segment`
|
|
136
|
-
| `aws.dynamodb.select`
|
|
137
|
-
| `aws.dynamodb.table_count`
|
|
138
|
-
| `aws.dynamodb.table_names`
|
|
139
|
-
| `aws.dynamodb.total_segments`
|
|
140
|
-
| `db.name`
|
|
141
|
-
| `db.operation`
|
|
142
|
-
| `db.statement`
|
|
143
|
-
| `db.system`
|
|
144
|
-
| `faas.execution`
|
|
145
|
-
| `faas.invoked_name`
|
|
146
|
-
| `faas.invoked_provider`
|
|
147
|
-
| `faas.invoked_region`
|
|
148
|
-
| `messaging.destination`
|
|
149
|
-
| `messaging.destination_kind`
|
|
150
|
-
| `messaging.system`
|
|
151
|
-
| `messaging.operation`
|
|
152
|
-
| `messaging.message_id`
|
|
153
|
-
| `messaging.url`
|
|
113
|
+
| Attribute | Short Description | Service |
|
|
114
|
+
| ------------------------------------------------ | ---------------------------------------------------------------------------------------------- | -------- |
|
|
115
|
+
| `http.status_code` / `http.response.status_code` | (aws-sdk) HTTP response status code. See "HTTP Semantic Convention migration" note below. | |
|
|
116
|
+
| `rpc.method` | The name of the (logical) method being called. | |
|
|
117
|
+
| `rpc.service` | The full (logical) name of the service being called. | |
|
|
118
|
+
| `rpc.system` | A string identifying the remoting system. | |
|
|
119
|
+
| `cloud.region` | The AWS Region where the requested service is being accessed. | |
|
|
120
|
+
| `aws.dynamodb.attribute_definitions` | The JSON-serialized value of each item in the `AttributeDefinitions` request field. | dynamodb |
|
|
121
|
+
| `aws.dynamodb.consistent_read` | The value of the `ConsistentRead` request parameter. | dynamodb |
|
|
122
|
+
| `aws.dynamodb.consumed_capacity` | The JSON-serialized value of each item in the `ConsumedCapacity` response field. | dynamodb |
|
|
123
|
+
| `aws.dynamodb.count` | The value of the `Count` response parameter. | dynamodb |
|
|
124
|
+
| `aws.dynamodb.exclusive_start_table` | The value of the `ExclusiveStartTableName` request parameter. | dynamodb |
|
|
125
|
+
| `aws.dynamodb.global_secondary_index_updates` | The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field. | dynamodb |
|
|
126
|
+
| `aws.dynamodb.global_secondary_indexes` | The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. | dynamodb |
|
|
127
|
+
| `aws.dynamodb.index_name` | The value of the `IndexName` request parameter. | dynamodb |
|
|
128
|
+
| `aws.dynamodb.item_collection_metrics` | The JSON-serialized value of the `ItemCollectionMetrics` response field. | dynamodb |
|
|
129
|
+
| `aws.dynamodb.limit` | The value of the `Limit` request parameter. | dynamodb |
|
|
130
|
+
| `aws.dynamodb.local_secondary_indexes` | The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. | dynamodb |
|
|
131
|
+
| `aws.dynamodb.projection` | The value of the `ProjectionExpression` request parameter. | dynamodb |
|
|
132
|
+
| `aws.dynamodb.provisioned_read_capacity` | The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. | dynamodb |
|
|
133
|
+
| `aws.dynamodb.provisioned_write_capacity` | The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. | dynamodb |
|
|
134
|
+
| `aws.dynamodb.scan_forward` | The value of the `ScanIndexForward` request parameter. | dynamodb |
|
|
135
|
+
| `aws.dynamodb.scanned_count` | The value of the `ScannedCount` response parameter. | dynamodb |
|
|
136
|
+
| `aws.dynamodb.segment` | The value of the `Segment` request parameter. | dynamodb |
|
|
137
|
+
| `aws.dynamodb.select` | The value of the `Select` request parameter. | dynamodb |
|
|
138
|
+
| `aws.dynamodb.table_count` | The number of items in the `TableNames` response parameter. | dynamodb |
|
|
139
|
+
| `aws.dynamodb.table_names` | The keys in the `RequestItems` object field. | dynamodb |
|
|
140
|
+
| `aws.dynamodb.total_segments` | The value of the `TotalSegments` request parameter. | dynamodb |
|
|
141
|
+
| `db.name` / `db.namespace` | The name of the database (TableName). See "Database Semantic Convention migration" note below. | dynamodb |
|
|
142
|
+
| `db.operation` / `db.operation.name` | The name of the operation. See "Database Semantic Convention migration" note below. | dynamodb |
|
|
143
|
+
| `db.statement` / `db.query.text` | The database statement. See "Database Semantic Convention migration" note below. | dynamodb |
|
|
144
|
+
| `db.system` / `db.system.name` | Database system identifier. See "Database Semantic Convention migration" note below. | dynamodb |
|
|
145
|
+
| `faas.execution` | The execution ID of the current function execution. | lambda |
|
|
146
|
+
| `faas.invoked_name` | The name of the invoked function. | lambda |
|
|
147
|
+
| `faas.invoked_provider` | The cloud provider of the invoked function. | lambda |
|
|
148
|
+
| `faas.invoked_region` | The cloud region of the invoked function. | lambda |
|
|
149
|
+
| `messaging.destination` | The message destination name. | sns, sqs |
|
|
150
|
+
| `messaging.destination_kind` | The kind of message destination. | sns, sqs |
|
|
151
|
+
| `messaging.system` | A string identifying the messaging system. | sns, sqs |
|
|
152
|
+
| `messaging.operation` | A string identifying the kind of message consumption. | sqs |
|
|
153
|
+
| `messaging.message_id` | A value used by the messaging system as an identifier for the message. | sqs |
|
|
154
|
+
| `messaging.url` | The connection string. | sqs |
|
|
154
155
|
|
|
155
156
|
### HTTP Semantic Convention migration
|
|
156
157
|
|
|
@@ -176,6 +177,30 @@ For this instrumentation, the only impacted attributes are as follows:
|
|
|
176
177
|
|
|
177
178
|
See the [HTTP semconv migration plan for OpenTelemetry JS instrumentations](https://github.com/open-telemetry/opentelemetry-js/issues/5646) for more details.
|
|
178
179
|
|
|
180
|
+
### Database Semantic Convention migration
|
|
181
|
+
|
|
182
|
+
Database semantic conventions (semconv) were stabilized in v1.33.0, and a [migration process](https://opentelemetry.io/docs/specs/semconv/non-normative/db-migration/)
|
|
183
|
+
was defined. For DynamoDB operations, `instrumentation-aws-sdk` emits database-related
|
|
184
|
+
attributes. The `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable can be used to
|
|
185
|
+
customize which database semantic conventions are used.
|
|
186
|
+
|
|
187
|
+
To select which semconv version(s) is emitted from this instrumentation, use the
|
|
188
|
+
`OTEL_SEMCONV_STABILITY_OPT_IN` environment variable.
|
|
189
|
+
|
|
190
|
+
- `database`: emit the new (stable) v1.33.0+ semantics
|
|
191
|
+
- `database/dup`: emit **both** the old v1.7.0 and the new (stable) v1.33.0+ semantics
|
|
192
|
+
- By default, if `OTEL_SEMCONV_STABILITY_OPT_IN` includes neither of the above tokens, the old v1.7.0 semconv is used.
|
|
193
|
+
|
|
194
|
+
For DynamoDB instrumentation, the impacted attributes are as follows:
|
|
195
|
+
|
|
196
|
+
| v1.7.0 semconv | v1.33.0 semconv | Short Description |
|
|
197
|
+
| -------------- | ------------------- | ------------------------------------------------- |
|
|
198
|
+
| `db.system` | `db.system.name` | Database system identifier |
|
|
199
|
+
| `db.name` | `db.namespace` | The database name (TableName for DynamoDB) |
|
|
200
|
+
| `db.operation` | `db.operation.name` | The name of the operation being executed |
|
|
201
|
+
| `db.statement` | `db.query.text` | The database statement (if serializer configured) |
|
|
202
|
+
|
|
203
|
+
See the [database migration guide](https://opentelemetry.io/docs/specs/semconv/non-normative/db-migration/) for details.
|
|
179
204
|
|
|
180
205
|
## Useful links
|
|
181
206
|
|
package/build/src/aws-sdk.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { InstrumentationBase, InstrumentationModuleDefinition } from '@opentelem
|
|
|
3
3
|
export declare class AwsInstrumentation extends InstrumentationBase<AwsSdkInstrumentationConfig> {
|
|
4
4
|
static readonly component = "aws-sdk";
|
|
5
5
|
private servicesExtensions;
|
|
6
|
-
private
|
|
6
|
+
private _httpSemconvStability;
|
|
7
|
+
private _dbSemconvStability;
|
|
7
8
|
constructor(config?: AwsSdkInstrumentationConfig);
|
|
8
9
|
protected init(): InstrumentationModuleDefinition[];
|
|
9
10
|
protected patchV3ConstructStack(moduleExports: any, moduleVersion?: string): any;
|
package/build/src/aws-sdk.js
CHANGED
|
@@ -30,10 +30,12 @@ const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
|
30
30
|
const V3_CLIENT_CONFIG_KEY = Symbol('opentelemetry.instrumentation.aws-sdk.client.config');
|
|
31
31
|
class AwsInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
32
32
|
static component = 'aws-sdk';
|
|
33
|
-
|
|
33
|
+
_httpSemconvStability;
|
|
34
|
+
_dbSemconvStability;
|
|
34
35
|
constructor(config = {}) {
|
|
35
36
|
super(version_1.PACKAGE_NAME, version_1.PACKAGE_VERSION, config);
|
|
36
|
-
this.
|
|
37
|
+
this._httpSemconvStability = (0, instrumentation_1.semconvStabilityFromStr)('http', process.env.OTEL_SEMCONV_STABILITY_OPT_IN);
|
|
38
|
+
this._dbSemconvStability = (0, instrumentation_1.semconvStabilityFromStr)('database', process.env.OTEL_SEMCONV_STABILITY_OPT_IN);
|
|
37
39
|
}
|
|
38
40
|
init() {
|
|
39
41
|
const v3MiddlewareStackFileOldVersions = new instrumentation_1.InstrumentationNodeModuleFile('@aws-sdk/middleware-stack/dist/cjs/MiddlewareStack.js', ['>=3.1.0 <3.35.0'], this.patchV3ConstructStack.bind(this), this.unpatchV3ConstructStack.bind(this));
|
|
@@ -173,7 +175,7 @@ class AwsInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
|
173
175
|
awsExecutionContext.clientName || 'AWS', 'Client');
|
|
174
176
|
const commandName = awsExecutionContext.commandName ?? command.constructor?.name;
|
|
175
177
|
const normalizedRequest = (0, utils_1.normalizeV3Request)(serviceName, commandName, command.input, undefined);
|
|
176
|
-
const requestMetadata = self.servicesExtensions.requestPreSpanHook(normalizedRequest, self.getConfig(), self._diag);
|
|
178
|
+
const requestMetadata = self.servicesExtensions.requestPreSpanHook(normalizedRequest, self.getConfig(), self._diag, self._dbSemconvStability);
|
|
177
179
|
const startTime = (0, core_1.hrTime)();
|
|
178
180
|
const span = self._startAwsV3Span(normalizedRequest, requestMetadata);
|
|
179
181
|
const activeContextWithSpan = api_1.trace.setSpan(api_1.context.active(), span);
|
|
@@ -202,10 +204,10 @@ class AwsInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
|
202
204
|
}
|
|
203
205
|
const httpStatusCode = response.output?.$metadata?.httpStatusCode;
|
|
204
206
|
if (httpStatusCode) {
|
|
205
|
-
if (self.
|
|
207
|
+
if (self._httpSemconvStability & instrumentation_1.SemconvStability.OLD) {
|
|
206
208
|
span.setAttribute(semconv_1.ATTR_HTTP_STATUS_CODE, httpStatusCode);
|
|
207
209
|
}
|
|
208
|
-
if (self.
|
|
210
|
+
if (self._httpSemconvStability & instrumentation_1.SemconvStability.STABLE) {
|
|
209
211
|
span.setAttribute(semantic_conventions_1.ATTR_HTTP_RESPONSE_STATUS_CODE, httpStatusCode);
|
|
210
212
|
}
|
|
211
213
|
}
|
|
@@ -233,10 +235,10 @@ class AwsInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
|
233
235
|
}
|
|
234
236
|
const httpStatusCode = err?.$metadata?.httpStatusCode;
|
|
235
237
|
if (httpStatusCode) {
|
|
236
|
-
if (self.
|
|
238
|
+
if (self._httpSemconvStability & instrumentation_1.SemconvStability.OLD) {
|
|
237
239
|
span.setAttribute(semconv_1.ATTR_HTTP_STATUS_CODE, httpStatusCode);
|
|
238
240
|
}
|
|
239
|
-
if (self.
|
|
241
|
+
if (self._httpSemconvStability & instrumentation_1.SemconvStability.STABLE) {
|
|
240
242
|
span.setAttribute(semantic_conventions_1.ATTR_HTTP_RESPONSE_STATUS_CODE, httpStatusCode);
|
|
241
243
|
}
|
|
242
244
|
}
|
package/build/src/aws-sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aws-sdk.js","sourceRoot":"","sources":["../../src/aws-sdk.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAO4B;AAC5B,8CAA8D;AAC9D,mCAAyC;AACzC,yCAAgD;AAQhD,kBAAkB;AAClB,uCAA0D;AAC1D,oEASwC;AAQxC,mCAKiB;AACjB,yCAAsC;AAEtC,uCAAkD;AAClD,8EAAqF;AAErF,MAAM,oBAAoB,GAAG,MAAM,CACjC,qDAAqD,CACtD,CAAC;AAKF,MAAa,kBAAmB,SAAQ,qCAAgD;IACtF,MAAM,CAAU,SAAS,GAAG,SAAS,CAAC;IAI9B,iBAAiB,CAAmB;IAE5C,YAAY,SAAsC,EAAE;QAClD,KAAK,CAAC,sBAAY,EAAE,yBAAe,EAAE,MAAM,CAAC,CAAC;QAC7C,IAAI,CAAC,iBAAiB,GAAG,IAAA,yCAAuB,EAC9C,MAAM,EACN,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAC1C,CAAC;IACJ,CAAC;IAES,IAAI;QACZ,MAAM,gCAAgC,GAAG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may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Span,\n SpanKind,\n context,\n trace,\n diag,\n SpanStatusCode,\n} from '@opentelemetry/api';\nimport { hrTime, suppressTracing } from '@opentelemetry/core';\nimport { AttributeNames } from './enums';\nimport { ServicesExtensions } from './services';\nimport {\n AwsSdkInstrumentationConfig,\n AwsSdkRequestHookInformation,\n AwsSdkResponseHookInformation,\n NormalizedRequest,\n NormalizedResponse,\n} from './types';\n/** @knipignore */\nimport { PACKAGE_NAME, PACKAGE_VERSION } from './version';\nimport {\n InstrumentationBase,\n InstrumentationModuleDefinition,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n isWrapped,\n safeExecuteInTheMiddle,\n SemconvStability,\n semconvStabilityFromStr,\n} from '@opentelemetry/instrumentation';\nimport type {\n MiddlewareStack,\n HandlerExecutionContext,\n Command as AwsV3Command,\n Handler as AwsV3MiddlewareHandler,\n InitializeHandlerArguments,\n} from '@aws-sdk/types';\nimport {\n bindPromise,\n extractAttributesFromNormalizedRequest,\n normalizeV3Request,\n removeSuffixFromStringIfExists,\n} from './utils';\nimport { propwrap } from './propwrap';\nimport { RequestMetadata } from './services/ServiceExtension';\nimport { ATTR_HTTP_STATUS_CODE } from './semconv';\nimport { ATTR_HTTP_RESPONSE_STATUS_CODE } from '@opentelemetry/semantic-conventions';\n\nconst V3_CLIENT_CONFIG_KEY = Symbol(\n 'opentelemetry.instrumentation.aws-sdk.client.config'\n);\ntype V3PluginCommand = AwsV3Command<any, any, any, any, any> & {\n [V3_CLIENT_CONFIG_KEY]?: any;\n};\n\nexport class AwsInstrumentation extends InstrumentationBase<AwsSdkInstrumentationConfig> {\n static readonly component = 'aws-sdk';\n // need declare since initialized in callbacks from super constructor\n private declare servicesExtensions: ServicesExtensions;\n\n private _semconvStability: SemconvStability;\n\n constructor(config: AwsSdkInstrumentationConfig = {}) {\n super(PACKAGE_NAME, PACKAGE_VERSION, config);\n this._semconvStability = semconvStabilityFromStr(\n 'http',\n process.env.OTEL_SEMCONV_STABILITY_OPT_IN\n );\n }\n\n protected init(): InstrumentationModuleDefinition[] {\n const v3MiddlewareStackFileOldVersions = new InstrumentationNodeModuleFile(\n '@aws-sdk/middleware-stack/dist/cjs/MiddlewareStack.js',\n ['>=3.1.0 <3.35.0'],\n this.patchV3ConstructStack.bind(this),\n this.unpatchV3ConstructStack.bind(this)\n );\n const v3MiddlewareStackFileNewVersions = new InstrumentationNodeModuleFile(\n '@aws-sdk/middleware-stack/dist-cjs/MiddlewareStack.js',\n ['>=3.35.0'],\n this.patchV3ConstructStack.bind(this),\n this.unpatchV3ConstructStack.bind(this)\n );\n\n // as for aws-sdk v3.13.1, constructStack is exported from @aws-sdk/middleware-stack as\n // getter instead of function, which fails shimmer.\n // so we are patching the MiddlewareStack.js file directly to get around it.\n const v3MiddlewareStack = new InstrumentationNodeModuleDefinition(\n '@aws-sdk/middleware-stack',\n ['^3.1.0'],\n undefined,\n undefined,\n [v3MiddlewareStackFileOldVersions, v3MiddlewareStackFileNewVersions]\n );\n\n // Patch for @smithy/middleware-stack for @aws-sdk/* packages v3.363.0+.\n // As of @smithy/middleware-stack@2.1.0 `constructStack` is only available\n // as a getter, so we cannot use `this._wrap()`.\n const self = this;\n const v3SmithyMiddlewareStack = new InstrumentationNodeModuleDefinition(\n '@smithy/middleware-stack',\n ['>=2.0.0'],\n (moduleExports, moduleVersion) => {\n const newExports = propwrap(\n moduleExports,\n 'constructStack',\n (orig: any) => {\n self._diag.debug('propwrapping aws-sdk v3 constructStack');\n return self._getV3ConstructStackPatch(moduleVersion, orig);\n }\n );\n return newExports;\n }\n );\n\n const v3SmithyClient = new InstrumentationNodeModuleDefinition(\n '@aws-sdk/smithy-client',\n ['^3.1.0'],\n this.patchV3SmithyClient.bind(this),\n this.unpatchV3SmithyClient.bind(this)\n );\n\n // patch for new @smithy/smithy-client for aws-sdk packages v3.363.0+\n const v3NewSmithyClient = new InstrumentationNodeModuleDefinition(\n '@smithy/smithy-client',\n ['>=1.0.3'],\n this.patchV3SmithyClient.bind(this),\n this.unpatchV3SmithyClient.bind(this)\n );\n\n return [\n v3MiddlewareStack,\n v3SmithyMiddlewareStack,\n v3SmithyClient,\n v3NewSmithyClient,\n ];\n }\n\n protected patchV3ConstructStack(moduleExports: any, moduleVersion?: string) {\n this._wrap(\n moduleExports,\n 'constructStack',\n this._getV3ConstructStackPatch.bind(this, moduleVersion)\n );\n return moduleExports;\n }\n\n protected unpatchV3ConstructStack(moduleExports: any) {\n this._unwrap(moduleExports, 'constructStack');\n return moduleExports;\n }\n\n protected patchV3SmithyClient(moduleExports: any) {\n this._wrap(\n moduleExports.Client.prototype,\n 'send',\n this._getV3SmithyClientSendPatch.bind(this)\n );\n return moduleExports;\n }\n\n protected unpatchV3SmithyClient(moduleExports: any) {\n this._unwrap(moduleExports.Client.prototype, 'send');\n return moduleExports;\n }\n\n private _startAwsV3Span(\n normalizedRequest: NormalizedRequest,\n metadata: RequestMetadata\n ): Span {\n const name =\n metadata.spanName ??\n `${normalizedRequest.serviceName}.${normalizedRequest.commandName}`;\n const newSpan = this.tracer.startSpan(name, {\n kind: metadata.spanKind ?? SpanKind.CLIENT,\n attributes: {\n ...extractAttributesFromNormalizedRequest(normalizedRequest),\n ...metadata.spanAttributes,\n },\n });\n\n return newSpan;\n }\n\n private _callUserPreRequestHook(\n span: Span,\n request: NormalizedRequest,\n moduleVersion: string | undefined\n ) {\n const { preRequestHook } = this.getConfig();\n if (preRequestHook) {\n const requestInfo: AwsSdkRequestHookInformation = {\n moduleVersion,\n request,\n };\n safeExecuteInTheMiddle(\n () => preRequestHook(span, requestInfo),\n (e: Error | undefined) => {\n if (e)\n diag.error(\n `${AwsInstrumentation.component} instrumentation: preRequestHook error`,\n e\n );\n },\n true\n );\n }\n }\n\n private _callUserResponseHook(span: Span, response: NormalizedResponse) {\n const { responseHook } = this.getConfig();\n if (!responseHook) return;\n\n const responseInfo: AwsSdkResponseHookInformation = {\n response,\n };\n safeExecuteInTheMiddle(\n () => responseHook(span, responseInfo),\n (e: Error | undefined) => {\n if (e)\n diag.error(\n `${AwsInstrumentation.component} instrumentation: responseHook error`,\n e\n );\n },\n true\n );\n }\n\n private _callUserExceptionResponseHook(\n span: Span,\n request: NormalizedRequest,\n err: any\n ) {\n const { exceptionHook } = this.getConfig();\n if (!exceptionHook) return;\n const requestInfo: AwsSdkRequestHookInformation = {\n request,\n };\n\n safeExecuteInTheMiddle(\n () => exceptionHook(span, requestInfo, err),\n (e: Error | undefined) => {\n if (e)\n diag.error(\n `${AwsInstrumentation.component} instrumentation: exceptionHook error`,\n e\n );\n },\n true\n );\n }\n\n private _getV3ConstructStackPatch(\n moduleVersion: string | undefined,\n original: (...args: unknown[]) => MiddlewareStack<any, any>\n ) {\n const self = this;\n return function constructStack(\n this: any,\n ...args: unknown[]\n ): MiddlewareStack<any, any> {\n const stack: MiddlewareStack<any, any> = original.apply(this, args);\n self.patchV3MiddlewareStack(moduleVersion, stack);\n return stack;\n };\n }\n\n private _getV3SmithyClientSendPatch(\n original: (...args: unknown[]) => Promise<any>\n ) {\n return function send(\n this: any,\n command: V3PluginCommand,\n ...args: unknown[]\n ): Promise<any> {\n command[V3_CLIENT_CONFIG_KEY] = this.config;\n return original.apply(this, [command, ...args]);\n };\n }\n\n private patchV3MiddlewareStack(\n moduleVersion: string | undefined,\n middlewareStackToPatch: MiddlewareStack<any, any>\n ) {\n if (!isWrapped(middlewareStackToPatch.resolve)) {\n this._wrap(\n middlewareStackToPatch,\n 'resolve',\n this._getV3MiddlewareStackResolvePatch.bind(this, moduleVersion)\n );\n }\n\n // 'clone' and 'concat' functions are internally calling 'constructStack' which is in same\n // module, thus not patched, and we need to take care of it specifically.\n this._wrap(\n middlewareStackToPatch,\n 'clone',\n this._getV3MiddlewareStackClonePatch.bind(this, moduleVersion)\n );\n this._wrap(\n middlewareStackToPatch,\n 'concat',\n this._getV3MiddlewareStackClonePatch.bind(this, moduleVersion)\n );\n }\n\n private _getV3MiddlewareStackClonePatch(\n moduleVersion: string | undefined,\n original: (...args: any[]) => MiddlewareStack<any, any>\n ) {\n const self = this;\n return function (this: any, ...args: any[]) {\n const newStack = original.apply(this, args);\n self.patchV3MiddlewareStack(moduleVersion, newStack);\n return newStack;\n };\n }\n\n private _getV3MiddlewareStackResolvePatch(\n moduleVersion: string | undefined,\n original: (\n _handler: any,\n context: HandlerExecutionContext\n ) => AwsV3MiddlewareHandler<any, any>\n ) {\n const self = this;\n return function (\n this: any,\n _handler: any,\n awsExecutionContext: HandlerExecutionContext\n ): AwsV3MiddlewareHandler<any, any> {\n const origHandler = original.call(this, _handler, awsExecutionContext);\n const patchedHandler = function (\n this: any,\n command: InitializeHandlerArguments<any> & {\n [V3_CLIENT_CONFIG_KEY]?: any;\n }\n ): Promise<any> {\n const clientConfig = command[V3_CLIENT_CONFIG_KEY];\n const regionPromise = clientConfig?.region?.();\n const serviceName =\n clientConfig?.serviceId ??\n removeSuffixFromStringIfExists(\n // Use 'AWS' as a fallback serviceName to match type definition.\n // In practice, `clientName` should always be set.\n awsExecutionContext.clientName || 'AWS',\n 'Client'\n );\n const commandName =\n awsExecutionContext.commandName ?? command.constructor?.name;\n const normalizedRequest = normalizeV3Request(\n serviceName,\n commandName,\n command.input,\n undefined\n );\n const requestMetadata = self.servicesExtensions.requestPreSpanHook(\n normalizedRequest,\n self.getConfig(),\n self._diag\n );\n const startTime = hrTime();\n const span = self._startAwsV3Span(normalizedRequest, requestMetadata);\n const activeContextWithSpan = trace.setSpan(context.active(), span);\n\n const handlerPromise = new Promise((resolve, reject) => {\n Promise.resolve(regionPromise)\n .then(resolvedRegion => {\n normalizedRequest.region = resolvedRegion;\n span.setAttribute(AttributeNames.CLOUD_REGION, resolvedRegion);\n })\n .catch(e => {\n // there is nothing much we can do in this case.\n // we'll just continue without region\n diag.debug(\n `${AwsInstrumentation.component} instrumentation: failed to extract region from async function`,\n e\n );\n })\n .finally(() => {\n self._callUserPreRequestHook(\n span,\n normalizedRequest,\n moduleVersion\n );\n const resultPromise = context.with(activeContextWithSpan, () => {\n self.servicesExtensions.requestPostSpanHook(normalizedRequest);\n return self._callOriginalFunction(() =>\n origHandler.call(this, command)\n );\n });\n const promiseWithResponseLogic = resultPromise\n .then(response => {\n const requestId = response.output?.$metadata?.requestId;\n if (requestId) {\n span.setAttribute(AttributeNames.AWS_REQUEST_ID, requestId);\n }\n\n const httpStatusCode =\n response.output?.$metadata?.httpStatusCode;\n if (httpStatusCode) {\n if (self._semconvStability & SemconvStability.OLD) {\n span.setAttribute(ATTR_HTTP_STATUS_CODE, httpStatusCode);\n }\n if (self._semconvStability & SemconvStability.STABLE) {\n span.setAttribute(\n ATTR_HTTP_RESPONSE_STATUS_CODE,\n httpStatusCode\n );\n }\n }\n\n const extendedRequestId =\n response.output?.$metadata?.extendedRequestId;\n if (extendedRequestId) {\n span.setAttribute(\n AttributeNames.AWS_REQUEST_EXTENDED_ID,\n extendedRequestId\n );\n }\n\n const normalizedResponse: NormalizedResponse = {\n data: response.output,\n request: normalizedRequest,\n requestId: requestId,\n };\n const override = self.servicesExtensions.responseHook(\n normalizedResponse,\n span,\n self.tracer,\n self.getConfig(),\n startTime\n );\n if (override) {\n response.output = override;\n normalizedResponse.data = override;\n }\n self._callUserResponseHook(span, normalizedResponse);\n return response;\n })\n .catch(err => {\n const requestId = err?.RequestId;\n if (requestId) {\n span.setAttribute(AttributeNames.AWS_REQUEST_ID, requestId);\n }\n\n const httpStatusCode = err?.$metadata?.httpStatusCode;\n if (httpStatusCode) {\n if (self._semconvStability & SemconvStability.OLD) {\n span.setAttribute(ATTR_HTTP_STATUS_CODE, httpStatusCode);\n }\n if (self._semconvStability & SemconvStability.STABLE) {\n span.setAttribute(\n ATTR_HTTP_RESPONSE_STATUS_CODE,\n httpStatusCode\n );\n }\n }\n\n const extendedRequestId = err?.extendedRequestId;\n if (extendedRequestId) {\n span.setAttribute(\n AttributeNames.AWS_REQUEST_EXTENDED_ID,\n extendedRequestId\n );\n }\n\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n span.recordException(err);\n self._callUserExceptionResponseHook(\n span,\n normalizedRequest,\n err\n );\n throw err;\n })\n .finally(() => {\n if (!requestMetadata.isStream) {\n span.end();\n }\n });\n promiseWithResponseLogic\n .then(res => {\n resolve(res);\n })\n .catch(err => reject(err));\n });\n });\n\n return requestMetadata.isIncoming\n ? bindPromise(handlerPromise, activeContextWithSpan, 2)\n : handlerPromise;\n };\n return patchedHandler;\n };\n }\n\n private _callOriginalFunction<T>(originalFunction: (...args: any[]) => T): T {\n if (this.getConfig().suppressInternalInstrumentation) {\n return context.with(suppressTracing(context.active()), originalFunction);\n } else {\n return originalFunction();\n }\n }\n\n override _updateMetricInstruments() {\n if (!this.servicesExtensions) {\n this.servicesExtensions = new ServicesExtensions();\n }\n this.servicesExtensions.updateMetricInstruments(this.meter);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"aws-sdk.js","sourceRoot":"","sources":["../../src/aws-sdk.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAO4B;AAC5B,8CAA8D;AAC9D,mCAAyC;AACzC,yCAAgD;AAQhD,kBAAkB;AAClB,uCAA0D;AAC1D,oEASwC;AAQxC,mCAKiB;AACjB,yCAAsC;AAEtC,uCAAkD;AAClD,8EAAqF;AAErF,MAAM,oBAAoB,GAAG,MAAM,CACjC,qDAAqD,CACtD,CAAC;AAKF,MAAa,kBAAmB,SAAQ,qCAAgD;IACtF,MAAM,CAAU,SAAS,GAAG,SAAS,CAAC;IAI9B,qBAAqB,CAAmB;IACxC,mBAAmB,CAAmB;IAE9C,YAAY,SAAsC,EAAE;QAClD,KAAK,CAAC,sBAAY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AC;SAC3B;IACH,CAAC;IAEQ,wBAAwB;QAC/B,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC5B,IAAI,CAAC,kBAAkB,GAAG,IAAI,6BAAkB,EAAE,CAAC;SACpD;QACD,IAAI,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC;;AAjdU,gDAAkB","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Span,\n SpanKind,\n context,\n trace,\n diag,\n SpanStatusCode,\n} from '@opentelemetry/api';\nimport { hrTime, suppressTracing } from '@opentelemetry/core';\nimport { AttributeNames } from './enums';\nimport { ServicesExtensions } from './services';\nimport {\n AwsSdkInstrumentationConfig,\n AwsSdkRequestHookInformation,\n AwsSdkResponseHookInformation,\n NormalizedRequest,\n NormalizedResponse,\n} from './types';\n/** @knipignore */\nimport { PACKAGE_NAME, PACKAGE_VERSION } from './version';\nimport {\n InstrumentationBase,\n InstrumentationModuleDefinition,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n isWrapped,\n safeExecuteInTheMiddle,\n SemconvStability,\n semconvStabilityFromStr,\n} from '@opentelemetry/instrumentation';\nimport type {\n MiddlewareStack,\n HandlerExecutionContext,\n Command as AwsV3Command,\n Handler as AwsV3MiddlewareHandler,\n InitializeHandlerArguments,\n} from '@aws-sdk/types';\nimport {\n bindPromise,\n extractAttributesFromNormalizedRequest,\n normalizeV3Request,\n removeSuffixFromStringIfExists,\n} from './utils';\nimport { propwrap } from './propwrap';\nimport { RequestMetadata } from './services/ServiceExtension';\nimport { ATTR_HTTP_STATUS_CODE } from './semconv';\nimport { ATTR_HTTP_RESPONSE_STATUS_CODE } from '@opentelemetry/semantic-conventions';\n\nconst V3_CLIENT_CONFIG_KEY = Symbol(\n 'opentelemetry.instrumentation.aws-sdk.client.config'\n);\ntype V3PluginCommand = AwsV3Command<any, any, any, any, any> & {\n [V3_CLIENT_CONFIG_KEY]?: any;\n};\n\nexport class AwsInstrumentation extends InstrumentationBase<AwsSdkInstrumentationConfig> {\n static readonly component = 'aws-sdk';\n // need declare since initialized in callbacks from super constructor\n declare private servicesExtensions: ServicesExtensions;\n\n private _httpSemconvStability: SemconvStability;\n private _dbSemconvStability: SemconvStability;\n\n constructor(config: AwsSdkInstrumentationConfig = {}) {\n super(PACKAGE_NAME, PACKAGE_VERSION, config);\n this._httpSemconvStability = semconvStabilityFromStr(\n 'http',\n process.env.OTEL_SEMCONV_STABILITY_OPT_IN\n );\n this._dbSemconvStability = semconvStabilityFromStr(\n 'database',\n process.env.OTEL_SEMCONV_STABILITY_OPT_IN\n );\n }\n\n protected init(): InstrumentationModuleDefinition[] {\n const v3MiddlewareStackFileOldVersions = new InstrumentationNodeModuleFile(\n '@aws-sdk/middleware-stack/dist/cjs/MiddlewareStack.js',\n ['>=3.1.0 <3.35.0'],\n this.patchV3ConstructStack.bind(this),\n this.unpatchV3ConstructStack.bind(this)\n );\n const v3MiddlewareStackFileNewVersions = new InstrumentationNodeModuleFile(\n '@aws-sdk/middleware-stack/dist-cjs/MiddlewareStack.js',\n ['>=3.35.0'],\n this.patchV3ConstructStack.bind(this),\n this.unpatchV3ConstructStack.bind(this)\n );\n\n // as for aws-sdk v3.13.1, constructStack is exported from @aws-sdk/middleware-stack as\n // getter instead of function, which fails shimmer.\n // so we are patching the MiddlewareStack.js file directly to get around it.\n const v3MiddlewareStack = new InstrumentationNodeModuleDefinition(\n '@aws-sdk/middleware-stack',\n ['^3.1.0'],\n undefined,\n undefined,\n [v3MiddlewareStackFileOldVersions, v3MiddlewareStackFileNewVersions]\n );\n\n // Patch for @smithy/middleware-stack for @aws-sdk/* packages v3.363.0+.\n // As of @smithy/middleware-stack@2.1.0 `constructStack` is only available\n // as a getter, so we cannot use `this._wrap()`.\n const self = this;\n const v3SmithyMiddlewareStack = new InstrumentationNodeModuleDefinition(\n '@smithy/middleware-stack',\n ['>=2.0.0'],\n (moduleExports, moduleVersion) => {\n const newExports = propwrap(\n moduleExports,\n 'constructStack',\n (orig: any) => {\n self._diag.debug('propwrapping aws-sdk v3 constructStack');\n return self._getV3ConstructStackPatch(moduleVersion, orig);\n }\n );\n return newExports;\n }\n );\n\n const v3SmithyClient = new InstrumentationNodeModuleDefinition(\n '@aws-sdk/smithy-client',\n ['^3.1.0'],\n this.patchV3SmithyClient.bind(this),\n this.unpatchV3SmithyClient.bind(this)\n );\n\n // patch for new @smithy/smithy-client for aws-sdk packages v3.363.0+\n const v3NewSmithyClient = new InstrumentationNodeModuleDefinition(\n '@smithy/smithy-client',\n ['>=1.0.3'],\n this.patchV3SmithyClient.bind(this),\n this.unpatchV3SmithyClient.bind(this)\n );\n\n return [\n v3MiddlewareStack,\n v3SmithyMiddlewareStack,\n v3SmithyClient,\n v3NewSmithyClient,\n ];\n }\n\n protected patchV3ConstructStack(moduleExports: any, moduleVersion?: string) {\n this._wrap(\n moduleExports,\n 'constructStack',\n this._getV3ConstructStackPatch.bind(this, moduleVersion)\n );\n return moduleExports;\n }\n\n protected unpatchV3ConstructStack(moduleExports: any) {\n this._unwrap(moduleExports, 'constructStack');\n return moduleExports;\n }\n\n protected patchV3SmithyClient(moduleExports: any) {\n this._wrap(\n moduleExports.Client.prototype,\n 'send',\n this._getV3SmithyClientSendPatch.bind(this)\n );\n return moduleExports;\n }\n\n protected unpatchV3SmithyClient(moduleExports: any) {\n this._unwrap(moduleExports.Client.prototype, 'send');\n return moduleExports;\n }\n\n private _startAwsV3Span(\n normalizedRequest: NormalizedRequest,\n metadata: RequestMetadata\n ): Span {\n const name =\n metadata.spanName ??\n `${normalizedRequest.serviceName}.${normalizedRequest.commandName}`;\n const newSpan = this.tracer.startSpan(name, {\n kind: metadata.spanKind ?? SpanKind.CLIENT,\n attributes: {\n ...extractAttributesFromNormalizedRequest(normalizedRequest),\n ...metadata.spanAttributes,\n },\n });\n\n return newSpan;\n }\n\n private _callUserPreRequestHook(\n span: Span,\n request: NormalizedRequest,\n moduleVersion: string | undefined\n ) {\n const { preRequestHook } = this.getConfig();\n if (preRequestHook) {\n const requestInfo: AwsSdkRequestHookInformation = {\n moduleVersion,\n request,\n };\n safeExecuteInTheMiddle(\n () => preRequestHook(span, requestInfo),\n (e: Error | undefined) => {\n if (e)\n diag.error(\n `${AwsInstrumentation.component} instrumentation: preRequestHook error`,\n e\n );\n },\n true\n );\n }\n }\n\n private _callUserResponseHook(span: Span, response: NormalizedResponse) {\n const { responseHook } = this.getConfig();\n if (!responseHook) return;\n\n const responseInfo: AwsSdkResponseHookInformation = {\n response,\n };\n safeExecuteInTheMiddle(\n () => responseHook(span, responseInfo),\n (e: Error | undefined) => {\n if (e)\n diag.error(\n `${AwsInstrumentation.component} instrumentation: responseHook error`,\n e\n );\n },\n true\n );\n }\n\n private _callUserExceptionResponseHook(\n span: Span,\n request: NormalizedRequest,\n err: any\n ) {\n const { exceptionHook } = this.getConfig();\n if (!exceptionHook) return;\n const requestInfo: AwsSdkRequestHookInformation = {\n request,\n };\n\n safeExecuteInTheMiddle(\n () => exceptionHook(span, requestInfo, err),\n (e: Error | undefined) => {\n if (e)\n diag.error(\n `${AwsInstrumentation.component} instrumentation: exceptionHook error`,\n e\n );\n },\n true\n );\n }\n\n private _getV3ConstructStackPatch(\n moduleVersion: string | undefined,\n original: (...args: unknown[]) => MiddlewareStack<any, any>\n ) {\n const self = this;\n return function constructStack(\n this: any,\n ...args: unknown[]\n ): MiddlewareStack<any, any> {\n const stack: MiddlewareStack<any, any> = original.apply(this, args);\n self.patchV3MiddlewareStack(moduleVersion, stack);\n return stack;\n };\n }\n\n private _getV3SmithyClientSendPatch(\n original: (...args: unknown[]) => Promise<any>\n ) {\n return function send(\n this: any,\n command: V3PluginCommand,\n ...args: unknown[]\n ): Promise<any> {\n command[V3_CLIENT_CONFIG_KEY] = this.config;\n return original.apply(this, [command, ...args]);\n };\n }\n\n private patchV3MiddlewareStack(\n moduleVersion: string | undefined,\n middlewareStackToPatch: MiddlewareStack<any, any>\n ) {\n if (!isWrapped(middlewareStackToPatch.resolve)) {\n this._wrap(\n middlewareStackToPatch,\n 'resolve',\n this._getV3MiddlewareStackResolvePatch.bind(this, moduleVersion)\n );\n }\n\n // 'clone' and 'concat' functions are internally calling 'constructStack' which is in same\n // module, thus not patched, and we need to take care of it specifically.\n this._wrap(\n middlewareStackToPatch,\n 'clone',\n this._getV3MiddlewareStackClonePatch.bind(this, moduleVersion)\n );\n this._wrap(\n middlewareStackToPatch,\n 'concat',\n this._getV3MiddlewareStackClonePatch.bind(this, moduleVersion)\n );\n }\n\n private _getV3MiddlewareStackClonePatch(\n moduleVersion: string | undefined,\n original: (...args: any[]) => MiddlewareStack<any, any>\n ) {\n const self = this;\n return function (this: any, ...args: any[]) {\n const newStack = original.apply(this, args);\n self.patchV3MiddlewareStack(moduleVersion, newStack);\n return newStack;\n };\n }\n\n private _getV3MiddlewareStackResolvePatch(\n moduleVersion: string | undefined,\n original: (\n _handler: any,\n context: HandlerExecutionContext\n ) => AwsV3MiddlewareHandler<any, any>\n ) {\n const self = this;\n return function (\n this: any,\n _handler: any,\n awsExecutionContext: HandlerExecutionContext\n ): AwsV3MiddlewareHandler<any, any> {\n const origHandler = original.call(this, _handler, awsExecutionContext);\n const patchedHandler = function (\n this: any,\n command: InitializeHandlerArguments<any> & {\n [V3_CLIENT_CONFIG_KEY]?: any;\n }\n ): Promise<any> {\n const clientConfig = command[V3_CLIENT_CONFIG_KEY];\n const regionPromise = clientConfig?.region?.();\n const serviceName =\n clientConfig?.serviceId ??\n removeSuffixFromStringIfExists(\n // Use 'AWS' as a fallback serviceName to match type definition.\n // In practice, `clientName` should always be set.\n awsExecutionContext.clientName || 'AWS',\n 'Client'\n );\n const commandName =\n awsExecutionContext.commandName ?? command.constructor?.name;\n const normalizedRequest = normalizeV3Request(\n serviceName,\n commandName,\n command.input,\n undefined\n );\n const requestMetadata = self.servicesExtensions.requestPreSpanHook(\n normalizedRequest,\n self.getConfig(),\n self._diag,\n self._dbSemconvStability\n );\n const startTime = hrTime();\n const span = self._startAwsV3Span(normalizedRequest, requestMetadata);\n const activeContextWithSpan = trace.setSpan(context.active(), span);\n\n const handlerPromise = new Promise((resolve, reject) => {\n Promise.resolve(regionPromise)\n .then(resolvedRegion => {\n normalizedRequest.region = resolvedRegion;\n span.setAttribute(AttributeNames.CLOUD_REGION, resolvedRegion);\n })\n .catch(e => {\n // there is nothing much we can do in this case.\n // we'll just continue without region\n diag.debug(\n `${AwsInstrumentation.component} instrumentation: failed to extract region from async function`,\n e\n );\n })\n .finally(() => {\n self._callUserPreRequestHook(\n span,\n normalizedRequest,\n moduleVersion\n );\n const resultPromise = context.with(activeContextWithSpan, () => {\n self.servicesExtensions.requestPostSpanHook(normalizedRequest);\n return self._callOriginalFunction(() =>\n origHandler.call(this, command)\n );\n });\n const promiseWithResponseLogic = resultPromise\n .then(response => {\n const requestId = response.output?.$metadata?.requestId;\n if (requestId) {\n span.setAttribute(AttributeNames.AWS_REQUEST_ID, requestId);\n }\n\n const httpStatusCode =\n response.output?.$metadata?.httpStatusCode;\n if (httpStatusCode) {\n if (self._httpSemconvStability & SemconvStability.OLD) {\n span.setAttribute(ATTR_HTTP_STATUS_CODE, httpStatusCode);\n }\n if (self._httpSemconvStability & SemconvStability.STABLE) {\n span.setAttribute(\n ATTR_HTTP_RESPONSE_STATUS_CODE,\n httpStatusCode\n );\n }\n }\n\n const extendedRequestId =\n response.output?.$metadata?.extendedRequestId;\n if (extendedRequestId) {\n span.setAttribute(\n AttributeNames.AWS_REQUEST_EXTENDED_ID,\n extendedRequestId\n );\n }\n\n const normalizedResponse: NormalizedResponse = {\n data: response.output,\n request: normalizedRequest,\n requestId: requestId,\n };\n const override = self.servicesExtensions.responseHook(\n normalizedResponse,\n span,\n self.tracer,\n self.getConfig(),\n startTime\n );\n if (override) {\n response.output = override;\n normalizedResponse.data = override;\n }\n self._callUserResponseHook(span, normalizedResponse);\n return response;\n })\n .catch(err => {\n const requestId = err?.RequestId;\n if (requestId) {\n span.setAttribute(AttributeNames.AWS_REQUEST_ID, requestId);\n }\n\n const httpStatusCode = err?.$metadata?.httpStatusCode;\n if (httpStatusCode) {\n if (self._httpSemconvStability & SemconvStability.OLD) {\n span.setAttribute(ATTR_HTTP_STATUS_CODE, httpStatusCode);\n }\n if (self._httpSemconvStability & SemconvStability.STABLE) {\n span.setAttribute(\n ATTR_HTTP_RESPONSE_STATUS_CODE,\n httpStatusCode\n );\n }\n }\n\n const extendedRequestId = err?.extendedRequestId;\n if (extendedRequestId) {\n span.setAttribute(\n AttributeNames.AWS_REQUEST_EXTENDED_ID,\n extendedRequestId\n );\n }\n\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n span.recordException(err);\n self._callUserExceptionResponseHook(\n span,\n normalizedRequest,\n err\n );\n throw err;\n })\n .finally(() => {\n if (!requestMetadata.isStream) {\n span.end();\n }\n });\n promiseWithResponseLogic\n .then(res => {\n resolve(res);\n })\n .catch(err => reject(err));\n });\n });\n\n return requestMetadata.isIncoming\n ? bindPromise(handlerPromise, activeContextWithSpan, 2)\n : handlerPromise;\n };\n return patchedHandler;\n };\n }\n\n private _callOriginalFunction<T>(originalFunction: (...args: any[]) => T): T {\n if (this.getConfig().suppressInternalInstrumentation) {\n return context.with(suppressTracing(context.active()), originalFunction);\n } else {\n return originalFunction();\n }\n }\n\n override _updateMetricInstruments() {\n if (!this.servicesExtensions) {\n this.servicesExtensions = new ServicesExtensions();\n }\n this.servicesExtensions.updateMetricInstruments(this.meter);\n }\n}\n"]}
|
package/build/src/semconv.d.ts
CHANGED
|
@@ -461,8 +461,18 @@ export declare const ATTR_RPC_SYSTEM: "rpc.system";
|
|
|
461
461
|
* Amazon DynamoDB
|
|
462
462
|
*
|
|
463
463
|
* @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
464
|
+
*
|
|
465
|
+
* @deprecated Replaced by `DB_SYSTEM_NAME_VALUE_DYNAMODB`.
|
|
464
466
|
*/
|
|
465
467
|
export declare const DB_SYSTEM_VALUE_DYNAMODB: "dynamodb";
|
|
468
|
+
/**
|
|
469
|
+
* Enum value "dynamodb" for attribute ATTR_DB_SYSTEM_NAME.
|
|
470
|
+
*
|
|
471
|
+
* Amazon DynamoDB
|
|
472
|
+
*
|
|
473
|
+
* @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
474
|
+
*/
|
|
475
|
+
export declare const DB_SYSTEM_NAME_VALUE_DYNAMODB: "dynamodb";
|
|
466
476
|
/**
|
|
467
477
|
* Enum value "chat" for attribute {@link ATTR_GEN_AI_OPERATION_NAME}.
|
|
468
478
|
*
|
package/build/src/semconv.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.ATTR_MESSAGING_SYSTEM = exports.ATTR_MESSAGING_OPERATION_TYPE = exports.ATTR_MESSAGING_OPERATION = exports.ATTR_MESSAGING_MESSAGE_ID = exports.ATTR_MESSAGING_DESTINATION_NAME = exports.ATTR_MESSAGING_BATCH_MESSAGE_COUNT = exports.ATTR_HTTP_STATUS_CODE = exports.ATTR_GEN_AI_USAGE_OUTPUT_TOKENS = exports.ATTR_GEN_AI_USAGE_INPUT_TOKENS = exports.ATTR_GEN_AI_TOKEN_TYPE = exports.ATTR_GEN_AI_SYSTEM = exports.ATTR_GEN_AI_RESPONSE_FINISH_REASONS = exports.ATTR_GEN_AI_REQUEST_TOP_P = exports.ATTR_GEN_AI_REQUEST_TEMPERATURE = exports.ATTR_GEN_AI_REQUEST_STOP_SEQUENCES = exports.ATTR_GEN_AI_REQUEST_MODEL = exports.ATTR_GEN_AI_REQUEST_MAX_TOKENS = exports.ATTR_GEN_AI_OPERATION_NAME = exports.ATTR_FAAS_INVOKED_REGION = exports.ATTR_FAAS_INVOKED_PROVIDER = exports.ATTR_FAAS_INVOKED_NAME = exports.ATTR_DB_SYSTEM = exports.ATTR_DB_STATEMENT = exports.ATTR_DB_OPERATION = exports.ATTR_DB_NAME = exports.ATTR_AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN = exports.ATTR_AWS_STEP_FUNCTIONS_ACTIVITY_ARN = exports.ATTR_AWS_SNS_TOPIC_ARN = exports.ATTR_AWS_SECRETSMANAGER_SECRET_ARN = exports.ATTR_AWS_DYNAMODB_TOTAL_SEGMENTS = exports.ATTR_AWS_DYNAMODB_TABLE_NAMES = exports.ATTR_AWS_DYNAMODB_TABLE_COUNT = exports.ATTR_AWS_DYNAMODB_SELECT = exports.ATTR_AWS_DYNAMODB_SEGMENT = exports.ATTR_AWS_DYNAMODB_SCAN_FORWARD = exports.ATTR_AWS_DYNAMODB_SCANNED_COUNT = exports.ATTR_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = exports.ATTR_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = exports.ATTR_AWS_DYNAMODB_PROJECTION = exports.ATTR_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = exports.ATTR_AWS_DYNAMODB_LIMIT = exports.ATTR_AWS_DYNAMODB_ITEM_COLLECTION_METRICS = exports.ATTR_AWS_DYNAMODB_INDEX_NAME = exports.ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = exports.ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = exports.ATTR_AWS_DYNAMODB_EXCLUSIVE_START_TABLE = exports.ATTR_AWS_DYNAMODB_COUNT = exports.ATTR_AWS_DYNAMODB_CONSUMED_CAPACITY = exports.ATTR_AWS_DYNAMODB_CONSISTENT_READ = exports.ATTR_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS = void 0;
|
|
19
|
-
exports.METRIC_GEN_AI_CLIENT_TOKEN_USAGE = exports.METRIC_GEN_AI_CLIENT_OPERATION_DURATION = exports.GEN_AI_TOKEN_TYPE_VALUE_OUTPUT = exports.GEN_AI_TOKEN_TYPE_VALUE_INPUT = exports.GEN_AI_SYSTEM_VALUE_AWS_BEDROCK = exports.GEN_AI_OPERATION_NAME_VALUE_CHAT = exports.DB_SYSTEM_VALUE_DYNAMODB = exports.ATTR_RPC_SYSTEM = exports.ATTR_RPC_SERVICE = exports.ATTR_RPC_METHOD = void 0;
|
|
19
|
+
exports.METRIC_GEN_AI_CLIENT_TOKEN_USAGE = exports.METRIC_GEN_AI_CLIENT_OPERATION_DURATION = exports.GEN_AI_TOKEN_TYPE_VALUE_OUTPUT = exports.GEN_AI_TOKEN_TYPE_VALUE_INPUT = exports.GEN_AI_SYSTEM_VALUE_AWS_BEDROCK = exports.GEN_AI_OPERATION_NAME_VALUE_CHAT = exports.DB_SYSTEM_NAME_VALUE_DYNAMODB = exports.DB_SYSTEM_VALUE_DYNAMODB = exports.ATTR_RPC_SYSTEM = exports.ATTR_RPC_SERVICE = exports.ATTR_RPC_METHOD = void 0;
|
|
20
20
|
/*
|
|
21
21
|
* This file contains a copy of unstable semantic convention definitions
|
|
22
22
|
* used by this package.
|
|
@@ -485,8 +485,18 @@ exports.ATTR_RPC_SYSTEM = 'rpc.system';
|
|
|
485
485
|
* Amazon DynamoDB
|
|
486
486
|
*
|
|
487
487
|
* @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
488
|
+
*
|
|
489
|
+
* @deprecated Replaced by `DB_SYSTEM_NAME_VALUE_DYNAMODB`.
|
|
488
490
|
*/
|
|
489
491
|
exports.DB_SYSTEM_VALUE_DYNAMODB = 'dynamodb';
|
|
492
|
+
/**
|
|
493
|
+
* Enum value "dynamodb" for attribute ATTR_DB_SYSTEM_NAME.
|
|
494
|
+
*
|
|
495
|
+
* Amazon DynamoDB
|
|
496
|
+
*
|
|
497
|
+
* @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
498
|
+
*/
|
|
499
|
+
exports.DB_SYSTEM_NAME_VALUE_DYNAMODB = 'dynamodb';
|
|
490
500
|
/**
|
|
491
501
|
* Enum value "chat" for attribute {@link ATTR_GEN_AI_OPERATION_NAME}.
|
|
492
502
|
*
|
package/build/src/semconv.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AACU,QAAA,uCAAuC,GAClD,oCAA6C,CAAC;AAEhD;;;;GAIG;AACU,QAAA,iCAAiC,GAC5C,8BAAuC,CAAC;AAE1C;;;;;;GAMG;AACU,QAAA,mCAAmC,GAC9C,gCAAyC,CAAC;AAE5C;;;;;;GAMG;AACU,QAAA,uBAAuB,GAAG,oBAA6B,CAAC;AAErE;;;;;;;GAOG;AACU,QAAA,uCAAuC,GAClD,oCAA6C,CAAC;AAEhD;;;;;;GAMG;AACU,QAAA,0CAA0C,GACrD,uCAAgD,CAAC;AAEnD;;;;;;GAMG;AACU,QAAA,gDAAgD,GAC3D,6CAAsD,CAAC;AAEzD;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAG,yBAAkC,CAAC;AAE/E;;;;;;GAMG;AACU,QAAA,yCAAyC,GACpD,sCAA+C,CAAC;AAElD;;;;;;GAMG;AACU,QAAA,uBAAuB,GAAG,oBAA6B,CAAC;AAErE;;;;;;GAMG;AACU,QAAA,yCAAyC,GACpD,sCAA+C,CAAC;AAElD;;;;;;;;GAQG;AACU,QAAA,4BAA4B,GAAG,yBAAkC,CAAC;AAE/E;;;;;;;GAOG;AACU,QAAA,2CAA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;;;;;;GAMG;AACU,QAAA,gCAAgC,GAAG,MAAe,CAAC;AAEhE;;;;;;GAMG;AACU,QAAA,+BAA+B,GAAG,aAAsB,CAAC;AAEtE;;;;;;GAMG;AACU,QAAA,6BAA6B,GAAG,OAAgB,CAAC;AAE9D;;;;;;GAMG;AACU,QAAA,8BAA8B,GAAG,QAAiB,CAAC;AAEhE;;;;GAIG;AACU,QAAA,uCAAuC,GAClD,kCAA2C,CAAC;AAE9C;;;;GAIG;AACU,QAAA,gCAAgC,GAC3C,2BAAoC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * The JSON-serialized value of each item in the `AttributeDefinitions` request field.\n *\n * @example [\"{ \"AttributeName\": \"string\", \"AttributeType\": \"string\" }\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS =\n 'aws.dynamodb.attribute_definitions' as const;\n\n/**\n * The value of the `ConsistentRead` request parameter.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_CONSISTENT_READ =\n 'aws.dynamodb.consistent_read' as const;\n\n/**\n * The JSON-serialized value of each item in the `ConsumedCapacity` response field.\n *\n * @example [\"{ \"CapacityUnits\": number, \"GlobalSecondaryIndexes\": { \"string\" : { \"CapacityUnits\": number, \"ReadCapacityUnits\": number, \"WriteCapacityUnits\": number } }, \"LocalSecondaryIndexes\": { \"string\" : { \"CapacityUnits\": number, \"ReadCapacityUnits\": number, \"WriteCapacityUnits\": number } }, \"ReadCapacityUnits\": number, \"Table\": { \"CapacityUnits\": number, \"ReadCapacityUnits\": number, \"WriteCapacityUnits\": number }, \"TableName\": \"string\", \"WriteCapacityUnits\": number }\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_CONSUMED_CAPACITY =\n 'aws.dynamodb.consumed_capacity' as const;\n\n/**\n * The value of the `Count` response parameter.\n *\n * @example 10\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_COUNT = 'aws.dynamodb.count' as const;\n\n/**\n * The value of the `ExclusiveStartTableName` request parameter.\n *\n * @example Users\n * @example CatsTable\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_EXCLUSIVE_START_TABLE =\n 'aws.dynamodb.exclusive_start_table' as const;\n\n/**\n * The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field\n *\n * @example [\"{ \"IndexName\": \"string\", \"KeySchema\": [ { \"AttributeName\": \"string\", \"KeyType\": \"string\" } ], \"Projection\": { \"NonKeyAttributes\": [ \"string\" ], \"ProjectionType\": \"string\" }, \"ProvisionedThroughput\": { \"ReadCapacityUnits\": number, \"WriteCapacityUnits\": number } }\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES =\n 'aws.dynamodb.global_secondary_indexes' as const;\n\n/**\n * The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` request field.\n *\n * @example [\"{ \"Create\": { \"IndexName\": \"string\", \"KeySchema\": [ { \"AttributeName\": \"string\", \"KeyType\": \"string\" } ], \"Projection\": { \"NonKeyAttributes\": [ \"string\" ], \"ProjectionType\": \"string\" }, \"ProvisionedThroughput\": { \"ReadCapacityUnits\": number, \"WriteCapacityUnits\": number } }\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES =\n 'aws.dynamodb.global_secondary_index_updates' as const;\n\n/**\n * The value of the `IndexName` request parameter.\n *\n * @example name_to_group\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_INDEX_NAME = 'aws.dynamodb.index_name' as const;\n\n/**\n * The JSON-serialized value of the `ItemCollectionMetrics` response field.\n *\n * @example { \"string\" : [ { \"ItemCollectionKey\": { \"string\" : { \"B\": blob, \"BOOL\": boolean, \"BS\": [ blob ], \"L\": [ \"AttributeValue\" ], \"M\": { \"string\" : \"AttributeValue\" }, \"N\": \"string\", \"NS\": [ \"string\" ], \"NULL\": boolean, \"S\": \"string\", \"SS\": [ \"string\" ] } }, \"SizeEstimateRangeGB\": [ number ] } ] }\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_ITEM_COLLECTION_METRICS =\n 'aws.dynamodb.item_collection_metrics' as const;\n\n/**\n * The value of the `Limit` request parameter.\n *\n * @example 10\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_LIMIT = 'aws.dynamodb.limit' as const;\n\n/**\n * The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field.\n *\n * @example [\"{ \"IndexArn\": \"string\", \"IndexName\": \"string\", \"IndexSizeBytes\": number, \"ItemCount\": number, \"KeySchema\": [ { \"AttributeName\": \"string\", \"KeyType\": \"string\" } ], \"Projection\": { \"NonKeyAttributes\": [ \"string\" ], \"ProjectionType\": \"string\" } }\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES =\n 'aws.dynamodb.local_secondary_indexes' as const;\n\n/**\n * The value of the `ProjectionExpression` request parameter.\n *\n * @example Title\n * @example Title, Price, Color\n * @example Title, Description, RelatedItems, ProductReviews\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_PROJECTION = 'aws.dynamodb.projection' as const;\n\n/**\n * The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter.\n *\n * @example 1.0\n * @example 2.0\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY =\n 'aws.dynamodb.provisioned_read_capacity' as const;\n\n/**\n * The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter.\n *\n * @example 1.0\n * @example 2.0\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY =\n 'aws.dynamodb.provisioned_write_capacity' as const;\n\n/**\n * The value of the `ScannedCount` response parameter.\n *\n * @example 50\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_SCANNED_COUNT =\n 'aws.dynamodb.scanned_count' as const;\n\n/**\n * The value of the `ScanIndexForward` request parameter.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_SCAN_FORWARD =\n 'aws.dynamodb.scan_forward' as const;\n\n/**\n * The value of the `Segment` request parameter.\n *\n * @example 10\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_SEGMENT = 'aws.dynamodb.segment' as const;\n\n/**\n * The value of the `Select` request parameter.\n *\n * @example ALL_ATTRIBUTES\n * @example COUNT\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_SELECT = 'aws.dynamodb.select' as const;\n\n/**\n * The number of items in the `TableNames` response parameter.\n *\n * @example 20\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_TABLE_COUNT =\n 'aws.dynamodb.table_count' as const;\n\n/**\n * The keys in the `RequestItems` object field.\n *\n * @example [\"Users\", \"Cats\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_TABLE_NAMES =\n 'aws.dynamodb.table_names' as const;\n\n/**\n * The value of the `TotalSegments` request parameter.\n *\n * @example 100\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_TOTAL_SEGMENTS =\n 'aws.dynamodb.total_segments' as const;\n\n/**\n * The ARN of the Secret stored in the Secrets Mangger\n *\n * @example arn:aws:secretsmanager:us-east-1:123456789012:secret:SecretName-6RandomCharacters\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_SECRETSMANAGER_SECRET_ARN =\n 'aws.secretsmanager.secret.arn' as const;\n\n/**\n * The ARN of the AWS SNS Topic. An Amazon SNS [topic](https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html) is a logical access point that acts as a communication channel.\n *\n * @example arn:aws:sns:us-east-1:123456789012:mystack-mytopic-NZJ5JSMVGFIE\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_SNS_TOPIC_ARN = 'aws.sns.topic.arn' as const;\n\n/**\n * The ARN of the AWS Step Functions Activity.\n *\n * @example arn:aws:states:us-east-1:123456789012:activity:get-greeting\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_STEP_FUNCTIONS_ACTIVITY_ARN =\n 'aws.step_functions.activity.arn' as const;\n\n/**\n * The ARN of the AWS Step Functions State Machine.\n *\n * @example arn:aws:states:us-east-1:123456789012:stateMachine:myStateMachine:1\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN =\n 'aws.step_functions.state_machine.arn' as const;\n\n/**\n * Deprecated, use `db.namespace` instead.\n *\n * @example customers\n * @example main\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `db.namespace`.\n */\nexport const ATTR_DB_NAME = 'db.name' as const;\n\n/**\n * Deprecated, use `db.operation.name` instead.\n *\n * @example findAndModify\n * @example HMSET\n * @example SELECT\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `db.operation.name`.\n */\nexport const ATTR_DB_OPERATION = 'db.operation' as const;\n\n/**\n * The database statement being executed.\n *\n * @example SELECT * FROM wuser_table\n * @example SET mykey \"WuValue\"\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `db.query.text`.\n */\nexport const ATTR_DB_STATEMENT = 'db.statement' as const;\n\n/**\n * Deprecated, use `db.system.name` instead.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `db.system.name`.\n */\nexport const ATTR_DB_SYSTEM = 'db.system' as const;\n\n/**\n * The name of the invoked function.\n *\n * @example \"my-function\"\n *\n * @note **SHOULD** be equal to the `faas.name` resource attribute of the invoked function.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_INVOKED_NAME = 'faas.invoked_name' as const;\n\n/**\n * The cloud provider of the invoked function.\n *\n * @note **SHOULD** be equal to the `cloud.provider` resource attribute of the invoked function.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_INVOKED_PROVIDER = 'faas.invoked_provider' as const;\n\n/**\n * The cloud region of the invoked function.\n *\n * @example \"eu-central-1\"\n *\n * @note **SHOULD** be equal to the `cloud.region` resource attribute of the invoked function.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_INVOKED_REGION = 'faas.invoked_region' as const;\n\n/**\n * The name of the operation being performed.\n *\n * @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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_OPERATION_NAME = 'gen_ai.operation.name' as const;\n\n/**\n * The maximum number of tokens the model generates for a request.\n *\n * @example 100\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_REQUEST_MAX_TOKENS =\n 'gen_ai.request.max_tokens' as const;\n\n/**\n * The name of the GenAI model a request is being made to.\n *\n * @example \"gpt-4\"\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_REQUEST_MODEL = 'gen_ai.request.model' as const;\n\n/**\n * List of sequences that the model will use to stop generating further tokens.\n *\n * @example [\"forest\", \"lived\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_REQUEST_STOP_SEQUENCES =\n 'gen_ai.request.stop_sequences' as const;\n\n/**\n * The temperature setting for the GenAI request.\n *\n * @example 0.0\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_REQUEST_TEMPERATURE =\n 'gen_ai.request.temperature' as const;\n\n/**\n * The top_p sampling setting for the GenAI request.\n *\n * @example 1.0\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_REQUEST_TOP_P = 'gen_ai.request.top_p' as const;\n\n/**\n * Array of reasons the model stopped generating tokens, corresponding to each generation received.\n *\n * @example [\"stop\"]\n * @example [\"stop\", \"length\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_RESPONSE_FINISH_REASONS =\n 'gen_ai.response.finish_reasons' as const;\n\n/**\n * Deprecated, use `gen_ai.provider.name` instead.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `gen_ai.provider.name`.\n */\nexport const ATTR_GEN_AI_SYSTEM = 'gen_ai.system' as const;\n\n/**\n * The type of token being counted.\n *\n * @example input\n * @example output\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_TOKEN_TYPE = 'gen_ai.token.type' as const;\n\n/**\n * The number of tokens used in the GenAI input (prompt).\n *\n * @example 100\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_USAGE_INPUT_TOKENS =\n 'gen_ai.usage.input_tokens' as const;\n\n/**\n * The number of tokens used in the GenAI response (completion).\n *\n * @example 180\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_USAGE_OUTPUT_TOKENS =\n 'gen_ai.usage.output_tokens' as const;\n\n/**\n * Deprecated, use `http.response.status_code` instead.\n *\n * @example 200\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `http.response.status_code`.\n */\nexport const ATTR_HTTP_STATUS_CODE = 'http.status_code' as const;\n\n/**\n * The number of messages sent, received, or processed in the scope of the batching operation.\n *\n * @example 0\n * @example 1\n * @example 2\n *\n * @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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_BATCH_MESSAGE_COUNT =\n 'messaging.batch.message_count' as const;\n\n/**\n * The message destination name\n *\n * @example MyQueue\n * @example MyTopic\n *\n * @note Destination name **SHOULD** uniquely identify a specific queue, topic or other entity within the broker. If\n * the broker doesn't have such notion, the destination name **SHOULD** uniquely identify the broker.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_DESTINATION_NAME =\n 'messaging.destination.name' as const;\n\n/**\n * A value used by the messaging system as an identifier for the message, represented as a string.\n *\n * @example \"452a7c7c7c7048c2f887f61572b18fc2\"\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_MESSAGE_ID = 'messaging.message.id' as const;\n\n/**\n * Deprecated, use `messaging.operation.type` instead.\n *\n * @example publish\n * @example create\n * @example process\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `messaging.operation.type`.\n */\nexport const ATTR_MESSAGING_OPERATION = 'messaging.operation' as const;\n\n/**\n * A string identifying the type of the messaging operation.\n *\n * @note If a custom value is used, it **MUST** be of low cardinality.\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_OPERATION_TYPE =\n 'messaging.operation.type' as const;\n\n/**\n * The messaging system as identified by the client instrumentation.\n *\n * @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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_SYSTEM = 'messaging.system' as const;\n\n/**\n * The name of the (logical) method being called, must be equal to the $method part in the span name.\n *\n * @example \"exampleMethod\"\n *\n * @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).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_RPC_METHOD = 'rpc.method' as const;\n\n/**\n * The full (logical) name of the service being called, including its package name, if applicable.\n *\n * @example \"myservice.EchoService\"\n *\n * @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).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_RPC_SERVICE = 'rpc.service' as const;\n\n/**\n * A string identifying the remoting system. See below for a list of well-known identifiers.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_RPC_SYSTEM = 'rpc.system' as const;\n\n/**\n * Enum value \"dynamodb\" for attribute {@link ATTR_DB_SYSTEM}.\n *\n * Amazon DynamoDB\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const DB_SYSTEM_VALUE_DYNAMODB = 'dynamodb' as const;\n\n/**\n * Enum value \"chat\" for attribute {@link ATTR_GEN_AI_OPERATION_NAME}.\n *\n * Chat completion operation such as [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const GEN_AI_OPERATION_NAME_VALUE_CHAT = 'chat' as const;\n\n/**\n * Enum value \"aws.bedrock\" for attribute {@link ATTR_GEN_AI_SYSTEM}.\n *\n * AWS Bedrock\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const GEN_AI_SYSTEM_VALUE_AWS_BEDROCK = 'aws.bedrock' as const;\n\n/**\n * Enum value \"input\" for attribute {@link ATTR_GEN_AI_TOKEN_TYPE}.\n *\n * Input tokens (prompt, input, etc.)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const GEN_AI_TOKEN_TYPE_VALUE_INPUT = 'input' as const;\n\n/**\n * Enum value \"output\" for attribute {@link ATTR_GEN_AI_TOKEN_TYPE}.\n *\n * Output tokens (completion, response, etc.)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const GEN_AI_TOKEN_TYPE_VALUE_OUTPUT = 'output' as const;\n\n/**\n * GenAI operation duration.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_GEN_AI_CLIENT_OPERATION_DURATION =\n 'gen_ai.client.operation.duration' as const;\n\n/**\n * Number of input and output tokens used.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_GEN_AI_CLIENT_TOKEN_USAGE =\n 'gen_ai.client.token.usage' as const;\n"]}
|
|
1
|
+
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AACU,QAAA,uCAAuC,GAClD,oCAA6C,CAAC;AAEhD;;;;GAIG;AACU,QAAA,iCAAiC,GAC5C,8BAAuC,CAAC;AAE1C;;;;;;GAMG;AACU,QAAA,mCAAmC,GAC9C,gCAAyC,CAAC;AAE5C;;;;;;GAMG;AACU,QAAA,uBAAuB,GAAG,oBAA6B,CAAC;AAErE;;;;;;;GAOG;AACU,QAAA,uCAAuC,GAClD,oCAA6C,CAAC;AAEhD;;;;;;GAMG;AACU,QAAA,0CAA0C,GACrD,uCAAgD,CAAC;AAEnD;;;;;;GAMG;AACU,QAAA,gDAAgD,GAC3D,6CAAsD,CAAC;AAEzD;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAG,yBAAkC,CAAC;AAE/E;;;;;;GAMG;AACU,QAAA,yCAAyC,GACpD,sCAA+C,CAAC;AAElD;;;;;;GAMG;AACU,QAAA,uBAAuB,GAAG,oBAA6B,CAAC;AAErE;;;;;;GAMG;AACU,QAAA,yCAAyC,GACpD,sCAA+C,CAAC;AAElD;;;;;;;;GAQG;AACU,QAAA,4BAA4B,GAAG,yBAAkC,CAAC;AAE/E;;;;;;;GAOG;AACU,QAAA,2CAA2C,GACtD,wCAAiD,CAAC;AAEpD;;;;;;;GAOG;AACU,QAAA,4CAA4C,GACvD,y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G;AACU,QAAA,gCAAgC,GAAG,MAAe,CAAC;AAEhE;;;;;;GAMG;AACU,QAAA,+BAA+B,GAAG,aAAsB,CAAC;AAEtE;;;;;;GAMG;AACU,QAAA,6BAA6B,GAAG,OAAgB,CAAC;AAE9D;;;;;;GAMG;AACU,QAAA,8BAA8B,GAAG,QAAiB,CAAC;AAEhE;;;;GAIG;AACU,QAAA,uCAAuC,GAClD,kCAA2C,CAAC;AAE9C;;;;GAIG;AACU,QAAA,gCAAgC,GAC3C,2BAAoC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * This file contains a copy of unstable semantic convention definitions\n * used by this package.\n * @see https://github.com/open-telemetry/opentelemetry-js/tree/main/semantic-conventions#unstable-semconv\n */\n\n/**\n * The JSON-serialized value of each item in the `AttributeDefinitions` request field.\n *\n * @example [\"{ \"AttributeName\": \"string\", \"AttributeType\": \"string\" }\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS =\n 'aws.dynamodb.attribute_definitions' as const;\n\n/**\n * The value of the `ConsistentRead` request parameter.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_CONSISTENT_READ =\n 'aws.dynamodb.consistent_read' as const;\n\n/**\n * The JSON-serialized value of each item in the `ConsumedCapacity` response field.\n *\n * @example [\"{ \"CapacityUnits\": number, \"GlobalSecondaryIndexes\": { \"string\" : { \"CapacityUnits\": number, \"ReadCapacityUnits\": number, \"WriteCapacityUnits\": number } }, \"LocalSecondaryIndexes\": { \"string\" : { \"CapacityUnits\": number, \"ReadCapacityUnits\": number, \"WriteCapacityUnits\": number } }, \"ReadCapacityUnits\": number, \"Table\": { \"CapacityUnits\": number, \"ReadCapacityUnits\": number, \"WriteCapacityUnits\": number }, \"TableName\": \"string\", \"WriteCapacityUnits\": number }\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_CONSUMED_CAPACITY =\n 'aws.dynamodb.consumed_capacity' as const;\n\n/**\n * The value of the `Count` response parameter.\n *\n * @example 10\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_COUNT = 'aws.dynamodb.count' as const;\n\n/**\n * The value of the `ExclusiveStartTableName` request parameter.\n *\n * @example Users\n * @example CatsTable\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_EXCLUSIVE_START_TABLE =\n 'aws.dynamodb.exclusive_start_table' as const;\n\n/**\n * The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field\n *\n * @example [\"{ \"IndexName\": \"string\", \"KeySchema\": [ { \"AttributeName\": \"string\", \"KeyType\": \"string\" } ], \"Projection\": { \"NonKeyAttributes\": [ \"string\" ], \"ProjectionType\": \"string\" }, \"ProvisionedThroughput\": { \"ReadCapacityUnits\": number, \"WriteCapacityUnits\": number } }\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES =\n 'aws.dynamodb.global_secondary_indexes' as const;\n\n/**\n * The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` request field.\n *\n * @example [\"{ \"Create\": { \"IndexName\": \"string\", \"KeySchema\": [ { \"AttributeName\": \"string\", \"KeyType\": \"string\" } ], \"Projection\": { \"NonKeyAttributes\": [ \"string\" ], \"ProjectionType\": \"string\" }, \"ProvisionedThroughput\": { \"ReadCapacityUnits\": number, \"WriteCapacityUnits\": number } }\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES =\n 'aws.dynamodb.global_secondary_index_updates' as const;\n\n/**\n * The value of the `IndexName` request parameter.\n *\n * @example name_to_group\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_INDEX_NAME = 'aws.dynamodb.index_name' as const;\n\n/**\n * The JSON-serialized value of the `ItemCollectionMetrics` response field.\n *\n * @example { \"string\" : [ { \"ItemCollectionKey\": { \"string\" : { \"B\": blob, \"BOOL\": boolean, \"BS\": [ blob ], \"L\": [ \"AttributeValue\" ], \"M\": { \"string\" : \"AttributeValue\" }, \"N\": \"string\", \"NS\": [ \"string\" ], \"NULL\": boolean, \"S\": \"string\", \"SS\": [ \"string\" ] } }, \"SizeEstimateRangeGB\": [ number ] } ] }\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_ITEM_COLLECTION_METRICS =\n 'aws.dynamodb.item_collection_metrics' as const;\n\n/**\n * The value of the `Limit` request parameter.\n *\n * @example 10\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_LIMIT = 'aws.dynamodb.limit' as const;\n\n/**\n * The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field.\n *\n * @example [\"{ \"IndexArn\": \"string\", \"IndexName\": \"string\", \"IndexSizeBytes\": number, \"ItemCount\": number, \"KeySchema\": [ { \"AttributeName\": \"string\", \"KeyType\": \"string\" } ], \"Projection\": { \"NonKeyAttributes\": [ \"string\" ], \"ProjectionType\": \"string\" } }\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES =\n 'aws.dynamodb.local_secondary_indexes' as const;\n\n/**\n * The value of the `ProjectionExpression` request parameter.\n *\n * @example Title\n * @example Title, Price, Color\n * @example Title, Description, RelatedItems, ProductReviews\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_PROJECTION = 'aws.dynamodb.projection' as const;\n\n/**\n * The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter.\n *\n * @example 1.0\n * @example 2.0\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY =\n 'aws.dynamodb.provisioned_read_capacity' as const;\n\n/**\n * The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter.\n *\n * @example 1.0\n * @example 2.0\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY =\n 'aws.dynamodb.provisioned_write_capacity' as const;\n\n/**\n * The value of the `ScannedCount` response parameter.\n *\n * @example 50\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_SCANNED_COUNT =\n 'aws.dynamodb.scanned_count' as const;\n\n/**\n * The value of the `ScanIndexForward` request parameter.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_SCAN_FORWARD =\n 'aws.dynamodb.scan_forward' as const;\n\n/**\n * The value of the `Segment` request parameter.\n *\n * @example 10\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_SEGMENT = 'aws.dynamodb.segment' as const;\n\n/**\n * The value of the `Select` request parameter.\n *\n * @example ALL_ATTRIBUTES\n * @example COUNT\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_SELECT = 'aws.dynamodb.select' as const;\n\n/**\n * The number of items in the `TableNames` response parameter.\n *\n * @example 20\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_TABLE_COUNT =\n 'aws.dynamodb.table_count' as const;\n\n/**\n * The keys in the `RequestItems` object field.\n *\n * @example [\"Users\", \"Cats\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_TABLE_NAMES =\n 'aws.dynamodb.table_names' as const;\n\n/**\n * The value of the `TotalSegments` request parameter.\n *\n * @example 100\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_DYNAMODB_TOTAL_SEGMENTS =\n 'aws.dynamodb.total_segments' as const;\n\n/**\n * The ARN of the Secret stored in the Secrets Mangger\n *\n * @example arn:aws:secretsmanager:us-east-1:123456789012:secret:SecretName-6RandomCharacters\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_SECRETSMANAGER_SECRET_ARN =\n 'aws.secretsmanager.secret.arn' as const;\n\n/**\n * The ARN of the AWS SNS Topic. An Amazon SNS [topic](https://docs.aws.amazon.com/sns/latest/dg/sns-create-topic.html) is a logical access point that acts as a communication channel.\n *\n * @example arn:aws:sns:us-east-1:123456789012:mystack-mytopic-NZJ5JSMVGFIE\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_SNS_TOPIC_ARN = 'aws.sns.topic.arn' as const;\n\n/**\n * The ARN of the AWS Step Functions Activity.\n *\n * @example arn:aws:states:us-east-1:123456789012:activity:get-greeting\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_STEP_FUNCTIONS_ACTIVITY_ARN =\n 'aws.step_functions.activity.arn' as const;\n\n/**\n * The ARN of the AWS Step Functions State Machine.\n *\n * @example arn:aws:states:us-east-1:123456789012:stateMachine:myStateMachine:1\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_AWS_STEP_FUNCTIONS_STATE_MACHINE_ARN =\n 'aws.step_functions.state_machine.arn' as const;\n\n/**\n * Deprecated, use `db.namespace` instead.\n *\n * @example customers\n * @example main\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `db.namespace`.\n */\nexport const ATTR_DB_NAME = 'db.name' as const;\n\n/**\n * Deprecated, use `db.operation.name` instead.\n *\n * @example findAndModify\n * @example HMSET\n * @example SELECT\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `db.operation.name`.\n */\nexport const ATTR_DB_OPERATION = 'db.operation' as const;\n\n/**\n * The database statement being executed.\n *\n * @example SELECT * FROM wuser_table\n * @example SET mykey \"WuValue\"\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `db.query.text`.\n */\nexport const ATTR_DB_STATEMENT = 'db.statement' as const;\n\n/**\n * Deprecated, use `db.system.name` instead.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `db.system.name`.\n */\nexport const ATTR_DB_SYSTEM = 'db.system' as const;\n\n/**\n * The name of the invoked function.\n *\n * @example \"my-function\"\n *\n * @note **SHOULD** be equal to the `faas.name` resource attribute of the invoked function.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_INVOKED_NAME = 'faas.invoked_name' as const;\n\n/**\n * The cloud provider of the invoked function.\n *\n * @note **SHOULD** be equal to the `cloud.provider` resource attribute of the invoked function.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_INVOKED_PROVIDER = 'faas.invoked_provider' as const;\n\n/**\n * The cloud region of the invoked function.\n *\n * @example \"eu-central-1\"\n *\n * @note **SHOULD** be equal to the `cloud.region` resource attribute of the invoked function.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_FAAS_INVOKED_REGION = 'faas.invoked_region' as const;\n\n/**\n * The name of the operation being performed.\n *\n * @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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_OPERATION_NAME = 'gen_ai.operation.name' as const;\n\n/**\n * The maximum number of tokens the model generates for a request.\n *\n * @example 100\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_REQUEST_MAX_TOKENS =\n 'gen_ai.request.max_tokens' as const;\n\n/**\n * The name of the GenAI model a request is being made to.\n *\n * @example \"gpt-4\"\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_REQUEST_MODEL = 'gen_ai.request.model' as const;\n\n/**\n * List of sequences that the model will use to stop generating further tokens.\n *\n * @example [\"forest\", \"lived\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_REQUEST_STOP_SEQUENCES =\n 'gen_ai.request.stop_sequences' as const;\n\n/**\n * The temperature setting for the GenAI request.\n *\n * @example 0.0\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_REQUEST_TEMPERATURE =\n 'gen_ai.request.temperature' as const;\n\n/**\n * The top_p sampling setting for the GenAI request.\n *\n * @example 1.0\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_REQUEST_TOP_P = 'gen_ai.request.top_p' as const;\n\n/**\n * Array of reasons the model stopped generating tokens, corresponding to each generation received.\n *\n * @example [\"stop\"]\n * @example [\"stop\", \"length\"]\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_RESPONSE_FINISH_REASONS =\n 'gen_ai.response.finish_reasons' as const;\n\n/**\n * Deprecated, use `gen_ai.provider.name` instead.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `gen_ai.provider.name`.\n */\nexport const ATTR_GEN_AI_SYSTEM = 'gen_ai.system' as const;\n\n/**\n * The type of token being counted.\n *\n * @example input\n * @example output\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_TOKEN_TYPE = 'gen_ai.token.type' as const;\n\n/**\n * The number of tokens used in the GenAI input (prompt).\n *\n * @example 100\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_USAGE_INPUT_TOKENS =\n 'gen_ai.usage.input_tokens' as const;\n\n/**\n * The number of tokens used in the GenAI response (completion).\n *\n * @example 180\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_GEN_AI_USAGE_OUTPUT_TOKENS =\n 'gen_ai.usage.output_tokens' as const;\n\n/**\n * Deprecated, use `http.response.status_code` instead.\n *\n * @example 200\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `http.response.status_code`.\n */\nexport const ATTR_HTTP_STATUS_CODE = 'http.status_code' as const;\n\n/**\n * The number of messages sent, received, or processed in the scope of the batching operation.\n *\n * @example 0\n * @example 1\n * @example 2\n *\n * @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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_BATCH_MESSAGE_COUNT =\n 'messaging.batch.message_count' as const;\n\n/**\n * The message destination name\n *\n * @example MyQueue\n * @example MyTopic\n *\n * @note Destination name **SHOULD** uniquely identify a specific queue, topic or other entity within the broker. If\n * the broker doesn't have such notion, the destination name **SHOULD** uniquely identify the broker.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_DESTINATION_NAME =\n 'messaging.destination.name' as const;\n\n/**\n * A value used by the messaging system as an identifier for the message, represented as a string.\n *\n * @example \"452a7c7c7c7048c2f887f61572b18fc2\"\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_MESSAGE_ID = 'messaging.message.id' as const;\n\n/**\n * Deprecated, use `messaging.operation.type` instead.\n *\n * @example publish\n * @example create\n * @example process\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `messaging.operation.type`.\n */\nexport const ATTR_MESSAGING_OPERATION = 'messaging.operation' as const;\n\n/**\n * A string identifying the type of the messaging operation.\n *\n * @note If a custom value is used, it **MUST** be of low cardinality.\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_OPERATION_TYPE =\n 'messaging.operation.type' as const;\n\n/**\n * The messaging system as identified by the client instrumentation.\n *\n * @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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_MESSAGING_SYSTEM = 'messaging.system' as const;\n\n/**\n * The name of the (logical) method being called, must be equal to the $method part in the span name.\n *\n * @example \"exampleMethod\"\n *\n * @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).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_RPC_METHOD = 'rpc.method' as const;\n\n/**\n * The full (logical) name of the service being called, including its package name, if applicable.\n *\n * @example \"myservice.EchoService\"\n *\n * @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).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_RPC_SERVICE = 'rpc.service' as const;\n\n/**\n * A string identifying the remoting system. See below for a list of well-known identifiers.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_RPC_SYSTEM = 'rpc.system' as const;\n\n/**\n * Enum value \"dynamodb\" for attribute {@link ATTR_DB_SYSTEM}.\n *\n * Amazon DynamoDB\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n *\n * @deprecated Replaced by `DB_SYSTEM_NAME_VALUE_DYNAMODB`.\n */\nexport const DB_SYSTEM_VALUE_DYNAMODB = 'dynamodb' as const;\n\n/**\n * Enum value \"dynamodb\" for attribute ATTR_DB_SYSTEM_NAME.\n *\n * Amazon DynamoDB\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const DB_SYSTEM_NAME_VALUE_DYNAMODB = 'dynamodb' as const;\n\n/**\n * Enum value \"chat\" for attribute {@link ATTR_GEN_AI_OPERATION_NAME}.\n *\n * Chat completion operation such as [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const GEN_AI_OPERATION_NAME_VALUE_CHAT = 'chat' as const;\n\n/**\n * Enum value \"aws.bedrock\" for attribute {@link ATTR_GEN_AI_SYSTEM}.\n *\n * AWS Bedrock\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const GEN_AI_SYSTEM_VALUE_AWS_BEDROCK = 'aws.bedrock' as const;\n\n/**\n * Enum value \"input\" for attribute {@link ATTR_GEN_AI_TOKEN_TYPE}.\n *\n * Input tokens (prompt, input, etc.)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const GEN_AI_TOKEN_TYPE_VALUE_INPUT = 'input' as const;\n\n/**\n * Enum value \"output\" for attribute {@link ATTR_GEN_AI_TOKEN_TYPE}.\n *\n * Output tokens (completion, response, etc.)\n *\n * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const GEN_AI_TOKEN_TYPE_VALUE_OUTPUT = 'output' as const;\n\n/**\n * GenAI operation duration.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_GEN_AI_CLIENT_OPERATION_DURATION =\n 'gen_ai.client.operation.duration' as const;\n\n/**\n * Number of input and output tokens used.\n *\n * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const METRIC_GEN_AI_CLIENT_TOKEN_USAGE =\n 'gen_ai.client.token.usage' as const;\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DiagLogger, HrTime, Meter, Span, SpanAttributes, SpanKind, Tracer } from '@opentelemetry/api';
|
|
2
|
+
import { SemconvStability } from '@opentelemetry/instrumentation';
|
|
2
3
|
import { AwsSdkInstrumentationConfig, NormalizedRequest, NormalizedResponse } from '../types';
|
|
3
4
|
export interface RequestMetadata {
|
|
4
5
|
isIncoming: boolean;
|
|
@@ -8,7 +9,7 @@ export interface RequestMetadata {
|
|
|
8
9
|
spanName?: string;
|
|
9
10
|
}
|
|
10
11
|
export interface ServiceExtension {
|
|
11
|
-
requestPreSpanHook: (request: NormalizedRequest, config: AwsSdkInstrumentationConfig, diag: DiagLogger) => RequestMetadata;
|
|
12
|
+
requestPreSpanHook: (request: NormalizedRequest, config: AwsSdkInstrumentationConfig, diag: DiagLogger, dbSemconvStability?: SemconvStability) => RequestMetadata;
|
|
12
13
|
requestPostSpanHook?: (request: NormalizedRequest) => void;
|
|
13
14
|
responseHook?: (response: NormalizedResponse, span: Span, tracer: Tracer, config: AwsSdkInstrumentationConfig, startTime: HrTime) => any | undefined;
|
|
14
15
|
updateMetricInstruments?: (meter: Meter) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceExtension.js","sourceRoot":"","sources":["../../../src/services/ServiceExtension.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n DiagLogger,\n HrTime,\n Meter,\n Span,\n SpanAttributes,\n SpanKind,\n Tracer,\n} from '@opentelemetry/api';\nimport {\n AwsSdkInstrumentationConfig,\n NormalizedRequest,\n NormalizedResponse,\n} from '../types';\n\nexport interface RequestMetadata {\n // isIncoming - if true, then the operation callback / promise should be bind with the operation's span\n isIncoming: boolean;\n // isStream - if true, then the response is a stream so the span should not be ended by the middleware.\n // the ServiceExtension must end the span itself, generally by wrapping the stream and ending after it is\n // consumed.\n isStream?: boolean;\n spanAttributes?: SpanAttributes;\n spanKind?: SpanKind;\n spanName?: string;\n}\n\nexport interface ServiceExtension {\n // called before request is sent, and before span is started\n requestPreSpanHook: (\n request: NormalizedRequest,\n config: AwsSdkInstrumentationConfig,\n diag: DiagLogger\n ) => RequestMetadata;\n\n // called before request is sent, and after span is started\n requestPostSpanHook?: (request: NormalizedRequest) => void;\n\n // called after response is received. If value is returned, it replaces the response output.\n responseHook?: (\n response: NormalizedResponse,\n span: Span,\n tracer: Tracer,\n config: AwsSdkInstrumentationConfig,\n startTime: HrTime\n ) => any | undefined;\n\n updateMetricInstruments?: (meter: Meter) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ServiceExtension.js","sourceRoot":"","sources":["../../../src/services/ServiceExtension.ts"],"names":[],"mappings":"","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n DiagLogger,\n HrTime,\n Meter,\n Span,\n SpanAttributes,\n SpanKind,\n Tracer,\n} from '@opentelemetry/api';\nimport { SemconvStability } from '@opentelemetry/instrumentation';\nimport {\n AwsSdkInstrumentationConfig,\n NormalizedRequest,\n NormalizedResponse,\n} from '../types';\n\nexport interface RequestMetadata {\n // isIncoming - if true, then the operation callback / promise should be bind with the operation's span\n isIncoming: boolean;\n // isStream - if true, then the response is a stream so the span should not be ended by the middleware.\n // the ServiceExtension must end the span itself, generally by wrapping the stream and ending after it is\n // consumed.\n isStream?: boolean;\n spanAttributes?: SpanAttributes;\n spanKind?: SpanKind;\n spanName?: string;\n}\n\nexport interface ServiceExtension {\n // called before request is sent, and before span is started\n requestPreSpanHook: (\n request: NormalizedRequest,\n config: AwsSdkInstrumentationConfig,\n diag: DiagLogger,\n dbSemconvStability?: SemconvStability\n ) => RequestMetadata;\n\n // called before request is sent, and after span is started\n requestPostSpanHook?: (request: NormalizedRequest) => void;\n\n // called after response is received. If value is returned, it replaces the response output.\n responseHook?: (\n response: NormalizedResponse,\n span: Span,\n tracer: Tracer,\n config: AwsSdkInstrumentationConfig,\n startTime: HrTime\n ) => any | undefined;\n\n updateMetricInstruments?: (meter: Meter) => void;\n}\n"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Tracer, Span, DiagLogger, Meter, HrTime } from '@opentelemetry/api';
|
|
2
|
+
import { SemconvStability } from '@opentelemetry/instrumentation';
|
|
2
3
|
import { ServiceExtension, RequestMetadata } from './ServiceExtension';
|
|
3
4
|
import { AwsSdkInstrumentationConfig, NormalizedRequest, NormalizedResponse } from '../types';
|
|
4
5
|
export declare class ServicesExtensions implements ServiceExtension {
|
|
5
6
|
services: Map<string, ServiceExtension>;
|
|
6
7
|
constructor();
|
|
7
8
|
private registerServices;
|
|
8
|
-
requestPreSpanHook(request: NormalizedRequest, config: AwsSdkInstrumentationConfig, diag: DiagLogger): RequestMetadata;
|
|
9
|
+
requestPreSpanHook(request: NormalizedRequest, config: AwsSdkInstrumentationConfig, diag: DiagLogger, dbSemconvStability?: SemconvStability): RequestMetadata;
|
|
9
10
|
requestPostSpanHook(request: NormalizedRequest): void;
|
|
10
11
|
responseHook(response: NormalizedResponse, span: Span, tracer: Tracer, config: AwsSdkInstrumentationConfig, startTime: HrTime): any;
|
|
11
12
|
updateMetricInstruments(meter: Meter): void;
|
|
@@ -26,13 +26,13 @@ class ServicesExtensions {
|
|
|
26
26
|
this.services.set('Kinesis', new kinesis_1.KinesisServiceExtension());
|
|
27
27
|
this.services.set('BedrockRuntime', new bedrock_runtime_1.BedrockRuntimeServiceExtension());
|
|
28
28
|
}
|
|
29
|
-
requestPreSpanHook(request, config, diag) {
|
|
29
|
+
requestPreSpanHook(request, config, diag, dbSemconvStability) {
|
|
30
30
|
const serviceExtension = this.services.get(request.serviceName);
|
|
31
31
|
if (!serviceExtension)
|
|
32
32
|
return {
|
|
33
33
|
isIncoming: false,
|
|
34
34
|
};
|
|
35
|
-
return serviceExtension.requestPreSpanHook(request, config, diag);
|
|
35
|
+
return serviceExtension.requestPreSpanHook(request, config, diag, dbSemconvStability);
|
|
36
36
|
}
|
|
37
37
|
requestPostSpanHook(request) {
|
|
38
38
|
const serviceExtension = this.services.get(request.serviceName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServicesExtensions.js","sourceRoot":"","sources":["../../../src/services/ServicesExtensions.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Services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M,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,gBAAgB;YACnB,OAAO;gBACL,UAAU,EAAE,KAAK;aAClB,CAAC;QACJ,OAAO,gBAAgB,CAAC,kBAAkB,CACxC,OAAO,EACP,MAAM,EACN,IAAI,EACJ,kBAAkB,CACnB,CAAC;IACJ,CAAC;IAED,mBAAmB,CAAC,OAA0B;QAC5C,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,gBAAgB,EAAE,mBAAmB;YAAE,OAAO;QACnD,OAAO,gBAAgB,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,YAAY,CACV,QAA4B,EAC5B,IAAU,EACV,MAAc,EACd,MAAmC,EACnC,SAAiB;QAEjB,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAEzE,OAAO,gBAAgB,EAAE,YAAY,EAAE,CACrC,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,MAAM,EACN,SAAS,CACV,CAAC;IACJ,CAAC;IAED,uBAAuB,CAAC,KAAY;QAClC,KAAK,MAAM,gBAAgB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE;YACrD,gBAAgB,CAAC,uBAAuB,EAAE,CAAC,KAAK,CAAC,CAAC;SACnD;IACH,CAAC;CACF;AAnED,gDAmEC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Tracer, Span, DiagLogger, Meter, HrTime } from '@opentelemetry/api';\nimport { SemconvStability } from '@opentelemetry/instrumentation';\nimport { ServiceExtension, RequestMetadata } from './ServiceExtension';\nimport { SqsServiceExtension } from './sqs';\nimport {\n AwsSdkInstrumentationConfig,\n NormalizedRequest,\n NormalizedResponse,\n} from '../types';\nimport { BedrockRuntimeServiceExtension } from './bedrock-runtime';\nimport { DynamodbServiceExtension } from './dynamodb';\nimport { SecretsManagerServiceExtension } from './secretsmanager';\nimport { SnsServiceExtension } from './sns';\nimport { StepFunctionsServiceExtension } from './stepfunctions';\nimport { LambdaServiceExtension } from './lambda';\nimport { S3ServiceExtension } from './s3';\nimport { KinesisServiceExtension } from './kinesis';\n\nexport class ServicesExtensions implements ServiceExtension {\n services: Map<string, ServiceExtension> = new Map();\n\n constructor() {\n this.registerServices();\n }\n\n private registerServices() {\n this.services.set('SecretsManager', new SecretsManagerServiceExtension());\n this.services.set('SFN', new StepFunctionsServiceExtension());\n this.services.set('SQS', new SqsServiceExtension());\n this.services.set('SNS', new SnsServiceExtension());\n this.services.set('DynamoDB', new DynamodbServiceExtension());\n this.services.set('Lambda', new LambdaServiceExtension());\n this.services.set('S3', new S3ServiceExtension());\n this.services.set('Kinesis', new KinesisServiceExtension());\n this.services.set('BedrockRuntime', new BedrockRuntimeServiceExtension());\n }\n\n requestPreSpanHook(\n request: NormalizedRequest,\n config: AwsSdkInstrumentationConfig,\n diag: DiagLogger,\n dbSemconvStability?: SemconvStability\n ): RequestMetadata {\n const serviceExtension = this.services.get(request.serviceName);\n if (!serviceExtension)\n return {\n isIncoming: false,\n };\n return serviceExtension.requestPreSpanHook(\n request,\n config,\n diag,\n dbSemconvStability\n );\n }\n\n requestPostSpanHook(request: NormalizedRequest) {\n const serviceExtension = this.services.get(request.serviceName);\n if (!serviceExtension?.requestPostSpanHook) return;\n return serviceExtension.requestPostSpanHook(request);\n }\n\n responseHook(\n response: NormalizedResponse,\n span: Span,\n tracer: Tracer,\n config: AwsSdkInstrumentationConfig,\n startTime: HrTime\n ) {\n const serviceExtension = this.services.get(response.request.serviceName);\n\n return serviceExtension?.responseHook?.(\n response,\n span,\n tracer,\n config,\n startTime\n );\n }\n\n updateMetricInstruments(meter: Meter) {\n for (const serviceExtension of this.services.values()) {\n serviceExtension.updateMetricInstruments?.(meter);\n }\n }\n}\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { DiagLogger, Span, Tracer } from '@opentelemetry/api';
|
|
2
|
+
import { SemconvStability } from '@opentelemetry/instrumentation';
|
|
2
3
|
import { RequestMetadata, ServiceExtension } from './ServiceExtension';
|
|
3
4
|
import { AwsSdkInstrumentationConfig, NormalizedRequest, NormalizedResponse } from '../types';
|
|
4
5
|
export declare class DynamodbServiceExtension implements ServiceExtension {
|
|
5
6
|
toArray<T>(values: T | T[]): T[];
|
|
6
|
-
requestPreSpanHook(normalizedRequest: NormalizedRequest, config: AwsSdkInstrumentationConfig, diag: DiagLogger): RequestMetadata;
|
|
7
|
+
requestPreSpanHook(normalizedRequest: NormalizedRequest, config: AwsSdkInstrumentationConfig, diag: DiagLogger, dbSemconvStability?: SemconvStability): RequestMetadata;
|
|
7
8
|
responseHook(response: NormalizedResponse, span: Span, _tracer: Tracer, _config: AwsSdkInstrumentationConfig): void;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=dynamodb.d.ts.map
|
|
@@ -17,26 +17,44 @@ exports.DynamodbServiceExtension = void 0;
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
const api_1 = require("@opentelemetry/api");
|
|
20
|
+
const instrumentation_1 = require("@opentelemetry/instrumentation");
|
|
21
|
+
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
20
22
|
const semconv_1 = require("../semconv");
|
|
21
23
|
class DynamodbServiceExtension {
|
|
22
24
|
toArray(values) {
|
|
23
25
|
return Array.isArray(values) ? values : [values];
|
|
24
26
|
}
|
|
25
|
-
requestPreSpanHook(normalizedRequest, config, diag) {
|
|
27
|
+
requestPreSpanHook(normalizedRequest, config, diag, dbSemconvStability) {
|
|
26
28
|
const spanKind = api_1.SpanKind.CLIENT;
|
|
27
29
|
let spanName;
|
|
28
30
|
const isIncoming = false;
|
|
29
31
|
const operation = normalizedRequest.commandName;
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const tableName = normalizedRequest.commandInput?.TableName;
|
|
33
|
+
const spanAttributes = {};
|
|
34
|
+
if (dbSemconvStability === undefined ||
|
|
35
|
+
dbSemconvStability & instrumentation_1.SemconvStability.OLD) {
|
|
36
|
+
spanAttributes[semconv_1.ATTR_DB_SYSTEM] = semconv_1.DB_SYSTEM_VALUE_DYNAMODB;
|
|
37
|
+
spanAttributes[semconv_1.ATTR_DB_NAME] = tableName;
|
|
38
|
+
spanAttributes[semconv_1.ATTR_DB_OPERATION] = operation;
|
|
39
|
+
}
|
|
40
|
+
if (dbSemconvStability !== undefined &&
|
|
41
|
+
dbSemconvStability & instrumentation_1.SemconvStability.STABLE) {
|
|
42
|
+
spanAttributes[semantic_conventions_1.ATTR_DB_SYSTEM_NAME] = semconv_1.DB_SYSTEM_NAME_VALUE_DYNAMODB;
|
|
43
|
+
spanAttributes[semantic_conventions_1.ATTR_DB_NAMESPACE] = tableName;
|
|
44
|
+
spanAttributes[semantic_conventions_1.ATTR_DB_OPERATION_NAME] = operation;
|
|
45
|
+
}
|
|
35
46
|
if (config.dynamoDBStatementSerializer) {
|
|
36
47
|
try {
|
|
37
48
|
const sanitizedStatement = config.dynamoDBStatementSerializer(operation, normalizedRequest.commandInput);
|
|
38
49
|
if (typeof sanitizedStatement === 'string') {
|
|
39
|
-
|
|
50
|
+
if (dbSemconvStability === undefined ||
|
|
51
|
+
dbSemconvStability & instrumentation_1.SemconvStability.OLD) {
|
|
52
|
+
spanAttributes[semconv_1.ATTR_DB_STATEMENT] = sanitizedStatement;
|
|
53
|
+
}
|
|
54
|
+
if (dbSemconvStability !== undefined &&
|
|
55
|
+
dbSemconvStability & instrumentation_1.SemconvStability.STABLE) {
|
|
56
|
+
spanAttributes[semantic_conventions_1.ATTR_DB_QUERY_TEXT] = sanitizedStatement;
|
|
57
|
+
}
|
|
40
58
|
}
|
|
41
59
|
}
|
|
42
60
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamodb.js","sourceRoot":"","sources":["../../../src/services/dynamodb.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAM4B;AAE5B,wCA2BoB;AAOpB,MAAa,wBAAwB;IACnC,OAAO,CAAI,MAAe;QACxB,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAED,kBAAkB,CAChB,iBAAoC,EACpC,MAAmC,EACnC,IAAgB;QAEhB,MAAM,QAAQ,GAAa,cAAQ,CAAC,MAAM,CAAC;QAC3C,IAAI,QAA4B,CAAC;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC;QACzB,MAAM,SAAS,GAAG,iBAAiB,CAAC,WAAW,CAAC;QAEhD,MAAM,cAAc,GAAe;YACjC,CAAC,wBAAc,CAAC,EAAE,kCAAwB;YAC1C,CAAC,sBAAY,CAAC,EAAE,iBAAiB,CAAC,YAAY,EAAE,SAAS;YACzD,CAAC,2BAAiB,CAAC,EAAE,SAAS;SAC/B,CAAC;QAEF,IAAI,MAAM,CAAC,2BAA2B,EAAE;YACtC,IAAI;gBACF,MAAM,kBAAkB,GAAG,MAAM,CAAC,2BAA2B,CAC3D,SAAS,EACT,iBAAiB,CAAC,YAAY,CAC/B,CAAC;gBAEF,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE;oBAC1C,cAAc,CAAC,2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,EAAE,YAAY,CAC5B,CAAC;SACH;IACH,CAAC;CACF;AAxND,4DAwNC;AAED,SAAS,OAAO,CAAI,MAAe;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Attributes,\n DiagLogger,\n Span,\n SpanKind,\n Tracer,\n} from '@opentelemetry/api';\nimport { RequestMetadata, ServiceExtension } from './ServiceExtension';\nimport {\n ATTR_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS,\n ATTR_AWS_DYNAMODB_CONSISTENT_READ,\n ATTR_AWS_DYNAMODB_CONSUMED_CAPACITY,\n ATTR_AWS_DYNAMODB_COUNT,\n ATTR_AWS_DYNAMODB_EXCLUSIVE_START_TABLE,\n ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES,\n ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES,\n ATTR_AWS_DYNAMODB_INDEX_NAME,\n ATTR_AWS_DYNAMODB_ITEM_COLLECTION_METRICS,\n ATTR_AWS_DYNAMODB_LIMIT,\n ATTR_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES,\n ATTR_AWS_DYNAMODB_PROJECTION,\n ATTR_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY,\n ATTR_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY,\n ATTR_AWS_DYNAMODB_SCAN_FORWARD,\n ATTR_AWS_DYNAMODB_SCANNED_COUNT,\n ATTR_AWS_DYNAMODB_SEGMENT,\n ATTR_AWS_DYNAMODB_SELECT,\n ATTR_AWS_DYNAMODB_TABLE_COUNT,\n ATTR_AWS_DYNAMODB_TABLE_NAMES,\n ATTR_AWS_DYNAMODB_TOTAL_SEGMENTS,\n ATTR_DB_NAME,\n ATTR_DB_OPERATION,\n ATTR_DB_STATEMENT,\n ATTR_DB_SYSTEM,\n DB_SYSTEM_VALUE_DYNAMODB,\n} from '../semconv';\nimport {\n AwsSdkInstrumentationConfig,\n NormalizedRequest,\n NormalizedResponse,\n} from '../types';\n\nexport class DynamodbServiceExtension implements ServiceExtension {\n toArray<T>(values: T | T[]): T[] {\n return Array.isArray(values) ? values : [values];\n }\n\n requestPreSpanHook(\n normalizedRequest: NormalizedRequest,\n config: AwsSdkInstrumentationConfig,\n diag: DiagLogger\n ): RequestMetadata {\n const spanKind: SpanKind = SpanKind.CLIENT;\n let spanName: string | undefined;\n const isIncoming = false;\n const operation = normalizedRequest.commandName;\n\n const spanAttributes: Attributes = {\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_DYNAMODB,\n [ATTR_DB_NAME]: normalizedRequest.commandInput?.TableName,\n [ATTR_DB_OPERATION]: operation,\n };\n\n if (config.dynamoDBStatementSerializer) {\n try {\n const sanitizedStatement = config.dynamoDBStatementSerializer(\n operation,\n normalizedRequest.commandInput\n );\n\n if (typeof sanitizedStatement === 'string') {\n spanAttributes[ATTR_DB_STATEMENT] = sanitizedStatement;\n }\n } catch (err) {\n diag.error('failed to sanitize DynamoDB statement', err);\n }\n }\n\n // normalizedRequest.commandInput.RequestItems) is undefined when no table names are returned\n // keys in this object are the table names\n if (normalizedRequest.commandInput?.TableName) {\n // Necessary for commands with only 1 table name (example: CreateTable). Attribute is TableName not keys of RequestItems\n // single table name returned for operations like CreateTable\n spanAttributes[ATTR_AWS_DYNAMODB_TABLE_NAMES] = [\n normalizedRequest.commandInput.TableName,\n ];\n } else if (normalizedRequest.commandInput?.RequestItems) {\n spanAttributes[ATTR_AWS_DYNAMODB_TABLE_NAMES] = Object.keys(\n normalizedRequest.commandInput.RequestItems\n );\n }\n\n if (operation === 'CreateTable' || operation === 'UpdateTable') {\n // only check for ProvisionedThroughput since ReadCapacityUnits and WriteCapacity units are required attributes\n if (normalizedRequest.commandInput?.ProvisionedThroughput) {\n spanAttributes[ATTR_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY] =\n normalizedRequest.commandInput.ProvisionedThroughput.ReadCapacityUnits;\n spanAttributes[ATTR_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY] =\n normalizedRequest.commandInput.ProvisionedThroughput.WriteCapacityUnits;\n }\n }\n\n if (\n operation === 'GetItem' ||\n operation === 'Scan' ||\n operation === 'Query'\n ) {\n if (normalizedRequest.commandInput?.ConsistentRead) {\n spanAttributes[ATTR_AWS_DYNAMODB_CONSISTENT_READ] =\n normalizedRequest.commandInput.ConsistentRead;\n }\n }\n\n if (operation === 'Query' || operation === 'Scan') {\n if (normalizedRequest.commandInput?.ProjectionExpression) {\n spanAttributes[ATTR_AWS_DYNAMODB_PROJECTION] =\n normalizedRequest.commandInput.ProjectionExpression;\n }\n }\n\n if (operation === 'CreateTable') {\n if (normalizedRequest.commandInput?.GlobalSecondaryIndexes) {\n spanAttributes[ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES] =\n this.toArray(\n normalizedRequest.commandInput.GlobalSecondaryIndexes\n ).map((x: { [DictionaryKey: string]: any }) => JSON.stringify(x));\n }\n\n if (normalizedRequest.commandInput?.LocalSecondaryIndexes) {\n spanAttributes[ATTR_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES] =\n this.toArray(\n normalizedRequest.commandInput.LocalSecondaryIndexes\n ).map((x: { [DictionaryKey: string]: any }) => JSON.stringify(x));\n }\n }\n\n if (\n operation === 'ListTables' ||\n operation === 'Query' ||\n operation === 'Scan'\n ) {\n if (normalizedRequest.commandInput?.Limit) {\n spanAttributes[ATTR_AWS_DYNAMODB_LIMIT] =\n normalizedRequest.commandInput.Limit;\n }\n }\n\n if (operation === 'ListTables') {\n if (normalizedRequest.commandInput?.ExclusiveStartTableName) {\n spanAttributes[ATTR_AWS_DYNAMODB_EXCLUSIVE_START_TABLE] =\n normalizedRequest.commandInput.ExclusiveStartTableName;\n }\n }\n\n if (operation === 'Query') {\n if (normalizedRequest.commandInput?.ScanIndexForward) {\n spanAttributes[ATTR_AWS_DYNAMODB_SCAN_FORWARD] =\n normalizedRequest.commandInput.ScanIndexForward;\n }\n\n if (normalizedRequest.commandInput?.IndexName) {\n spanAttributes[ATTR_AWS_DYNAMODB_INDEX_NAME] =\n normalizedRequest.commandInput.IndexName;\n }\n\n if (normalizedRequest.commandInput?.Select) {\n spanAttributes[ATTR_AWS_DYNAMODB_SELECT] =\n normalizedRequest.commandInput.Select;\n }\n }\n\n if (operation === 'Scan') {\n if (normalizedRequest.commandInput?.Segment) {\n spanAttributes[ATTR_AWS_DYNAMODB_SEGMENT] =\n normalizedRequest.commandInput?.Segment;\n }\n\n if (normalizedRequest.commandInput?.TotalSegments) {\n spanAttributes[ATTR_AWS_DYNAMODB_TOTAL_SEGMENTS] =\n normalizedRequest.commandInput?.TotalSegments;\n }\n\n if (normalizedRequest.commandInput?.IndexName) {\n spanAttributes[ATTR_AWS_DYNAMODB_INDEX_NAME] =\n normalizedRequest.commandInput.IndexName;\n }\n\n if (normalizedRequest.commandInput?.Select) {\n spanAttributes[ATTR_AWS_DYNAMODB_SELECT] =\n normalizedRequest.commandInput.Select;\n }\n }\n\n if (operation === 'UpdateTable') {\n if (normalizedRequest.commandInput?.AttributeDefinitions) {\n spanAttributes[ATTR_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS] = this.toArray(\n normalizedRequest.commandInput.AttributeDefinitions\n ).map((x: { [DictionaryKey: string]: any }) => JSON.stringify(x));\n }\n\n if (normalizedRequest.commandInput?.GlobalSecondaryIndexUpdates) {\n spanAttributes[ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES] =\n this.toArray(\n normalizedRequest.commandInput.GlobalSecondaryIndexUpdates\n ).map((x: { [DictionaryKey: string]: any }) => JSON.stringify(x));\n }\n }\n\n return {\n isIncoming,\n spanAttributes,\n spanKind,\n spanName,\n };\n }\n\n responseHook(\n response: NormalizedResponse,\n span: Span,\n _tracer: Tracer,\n _config: AwsSdkInstrumentationConfig\n ) {\n if (response.data?.ConsumedCapacity) {\n span.setAttribute(\n ATTR_AWS_DYNAMODB_CONSUMED_CAPACITY,\n toArray(response.data.ConsumedCapacity).map(\n (x: { [DictionaryKey: string]: any }) => JSON.stringify(x)\n )\n );\n }\n\n if (response.data?.ItemCollectionMetrics) {\n span.setAttribute(\n ATTR_AWS_DYNAMODB_ITEM_COLLECTION_METRICS,\n this.toArray(response.data.ItemCollectionMetrics).map(\n (x: { [DictionaryKey: string]: any }) => JSON.stringify(x)\n )\n );\n }\n\n if (response.data?.TableNames) {\n span.setAttribute(\n ATTR_AWS_DYNAMODB_TABLE_COUNT,\n response.data?.TableNames.length\n );\n }\n\n if (response.data?.Count) {\n span.setAttribute(ATTR_AWS_DYNAMODB_COUNT, response.data?.Count);\n }\n\n if (response.data?.ScannedCount) {\n span.setAttribute(\n ATTR_AWS_DYNAMODB_SCANNED_COUNT,\n response.data?.ScannedCount\n );\n }\n }\n}\n\nfunction toArray<T>(values: T | T[]): T[] {\n return Array.isArray(values) ? values : [values];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dynamodb.js","sourceRoot":"","sources":["../../../src/services/dynamodb.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAM4B;AAC5B,oEAAkE;AAClE,8EAK6C;AAE7C,wCA4BoB;AAOpB,MAAa,wBAAwB;IACnC,OAAO,CAAI,MAAe;QACxB,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,M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AC,YAAY,CACf,yCAA+B,EAC/B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAC5B,CAAC;SACH;IACH,CAAC;CACF;AAlPD,4DAkPC;AAED,SAAS,OAAO,CAAI,MAAe;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Attributes,\n DiagLogger,\n Span,\n SpanKind,\n Tracer,\n} from '@opentelemetry/api';\nimport { SemconvStability } from '@opentelemetry/instrumentation';\nimport {\n ATTR_DB_NAMESPACE,\n ATTR_DB_OPERATION_NAME,\n ATTR_DB_QUERY_TEXT,\n ATTR_DB_SYSTEM_NAME,\n} from '@opentelemetry/semantic-conventions';\nimport { RequestMetadata, ServiceExtension } from './ServiceExtension';\nimport {\n ATTR_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS,\n ATTR_AWS_DYNAMODB_CONSISTENT_READ,\n ATTR_AWS_DYNAMODB_CONSUMED_CAPACITY,\n ATTR_AWS_DYNAMODB_COUNT,\n ATTR_AWS_DYNAMODB_EXCLUSIVE_START_TABLE,\n ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES,\n ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES,\n ATTR_AWS_DYNAMODB_INDEX_NAME,\n ATTR_AWS_DYNAMODB_ITEM_COLLECTION_METRICS,\n ATTR_AWS_DYNAMODB_LIMIT,\n ATTR_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES,\n ATTR_AWS_DYNAMODB_PROJECTION,\n ATTR_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY,\n ATTR_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY,\n ATTR_AWS_DYNAMODB_SCAN_FORWARD,\n ATTR_AWS_DYNAMODB_SCANNED_COUNT,\n ATTR_AWS_DYNAMODB_SEGMENT,\n ATTR_AWS_DYNAMODB_SELECT,\n ATTR_AWS_DYNAMODB_TABLE_COUNT,\n ATTR_AWS_DYNAMODB_TABLE_NAMES,\n ATTR_AWS_DYNAMODB_TOTAL_SEGMENTS,\n ATTR_DB_NAME,\n ATTR_DB_OPERATION,\n ATTR_DB_STATEMENT,\n ATTR_DB_SYSTEM,\n DB_SYSTEM_NAME_VALUE_DYNAMODB,\n DB_SYSTEM_VALUE_DYNAMODB,\n} from '../semconv';\nimport {\n AwsSdkInstrumentationConfig,\n NormalizedRequest,\n NormalizedResponse,\n} from '../types';\n\nexport class DynamodbServiceExtension implements ServiceExtension {\n toArray<T>(values: T | T[]): T[] {\n return Array.isArray(values) ? values : [values];\n }\n\n requestPreSpanHook(\n normalizedRequest: NormalizedRequest,\n config: AwsSdkInstrumentationConfig,\n diag: DiagLogger,\n dbSemconvStability?: SemconvStability\n ): RequestMetadata {\n const spanKind: SpanKind = SpanKind.CLIENT;\n let spanName: string | undefined;\n const isIncoming = false;\n const operation = normalizedRequest.commandName;\n const tableName = normalizedRequest.commandInput?.TableName;\n\n const spanAttributes: Attributes = {};\n\n if (\n dbSemconvStability === undefined ||\n dbSemconvStability & SemconvStability.OLD\n ) {\n spanAttributes[ATTR_DB_SYSTEM] = DB_SYSTEM_VALUE_DYNAMODB;\n spanAttributes[ATTR_DB_NAME] = tableName;\n spanAttributes[ATTR_DB_OPERATION] = operation;\n }\n if (\n dbSemconvStability !== undefined &&\n dbSemconvStability & SemconvStability.STABLE\n ) {\n spanAttributes[ATTR_DB_SYSTEM_NAME] = DB_SYSTEM_NAME_VALUE_DYNAMODB;\n spanAttributes[ATTR_DB_NAMESPACE] = tableName;\n spanAttributes[ATTR_DB_OPERATION_NAME] = operation;\n }\n\n if (config.dynamoDBStatementSerializer) {\n try {\n const sanitizedStatement = config.dynamoDBStatementSerializer(\n operation,\n normalizedRequest.commandInput\n );\n\n if (typeof sanitizedStatement === 'string') {\n if (\n dbSemconvStability === undefined ||\n dbSemconvStability & SemconvStability.OLD\n ) {\n spanAttributes[ATTR_DB_STATEMENT] = sanitizedStatement;\n }\n if (\n dbSemconvStability !== undefined &&\n dbSemconvStability & SemconvStability.STABLE\n ) {\n spanAttributes[ATTR_DB_QUERY_TEXT] = sanitizedStatement;\n }\n }\n } catch (err) {\n diag.error('failed to sanitize DynamoDB statement', err);\n }\n }\n\n // normalizedRequest.commandInput.RequestItems) is undefined when no table names are returned\n // keys in this object are the table names\n if (normalizedRequest.commandInput?.TableName) {\n // Necessary for commands with only 1 table name (example: CreateTable). Attribute is TableName not keys of RequestItems\n // single table name returned for operations like CreateTable\n spanAttributes[ATTR_AWS_DYNAMODB_TABLE_NAMES] = [\n normalizedRequest.commandInput.TableName,\n ];\n } else if (normalizedRequest.commandInput?.RequestItems) {\n spanAttributes[ATTR_AWS_DYNAMODB_TABLE_NAMES] = Object.keys(\n normalizedRequest.commandInput.RequestItems\n );\n }\n\n if (operation === 'CreateTable' || operation === 'UpdateTable') {\n // only check for ProvisionedThroughput since ReadCapacityUnits and WriteCapacity units are required attributes\n if (normalizedRequest.commandInput?.ProvisionedThroughput) {\n spanAttributes[ATTR_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY] =\n normalizedRequest.commandInput.ProvisionedThroughput.ReadCapacityUnits;\n spanAttributes[ATTR_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY] =\n normalizedRequest.commandInput.ProvisionedThroughput.WriteCapacityUnits;\n }\n }\n\n if (\n operation === 'GetItem' ||\n operation === 'Scan' ||\n operation === 'Query'\n ) {\n if (normalizedRequest.commandInput?.ConsistentRead) {\n spanAttributes[ATTR_AWS_DYNAMODB_CONSISTENT_READ] =\n normalizedRequest.commandInput.ConsistentRead;\n }\n }\n\n if (operation === 'Query' || operation === 'Scan') {\n if (normalizedRequest.commandInput?.ProjectionExpression) {\n spanAttributes[ATTR_AWS_DYNAMODB_PROJECTION] =\n normalizedRequest.commandInput.ProjectionExpression;\n }\n }\n\n if (operation === 'CreateTable') {\n if (normalizedRequest.commandInput?.GlobalSecondaryIndexes) {\n spanAttributes[ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES] =\n this.toArray(\n normalizedRequest.commandInput.GlobalSecondaryIndexes\n ).map((x: { [DictionaryKey: string]: any }) => JSON.stringify(x));\n }\n\n if (normalizedRequest.commandInput?.LocalSecondaryIndexes) {\n spanAttributes[ATTR_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES] =\n this.toArray(\n normalizedRequest.commandInput.LocalSecondaryIndexes\n ).map((x: { [DictionaryKey: string]: any }) => JSON.stringify(x));\n }\n }\n\n if (\n operation === 'ListTables' ||\n operation === 'Query' ||\n operation === 'Scan'\n ) {\n if (normalizedRequest.commandInput?.Limit) {\n spanAttributes[ATTR_AWS_DYNAMODB_LIMIT] =\n normalizedRequest.commandInput.Limit;\n }\n }\n\n if (operation === 'ListTables') {\n if (normalizedRequest.commandInput?.ExclusiveStartTableName) {\n spanAttributes[ATTR_AWS_DYNAMODB_EXCLUSIVE_START_TABLE] =\n normalizedRequest.commandInput.ExclusiveStartTableName;\n }\n }\n\n if (operation === 'Query') {\n if (normalizedRequest.commandInput?.ScanIndexForward) {\n spanAttributes[ATTR_AWS_DYNAMODB_SCAN_FORWARD] =\n normalizedRequest.commandInput.ScanIndexForward;\n }\n\n if (normalizedRequest.commandInput?.IndexName) {\n spanAttributes[ATTR_AWS_DYNAMODB_INDEX_NAME] =\n normalizedRequest.commandInput.IndexName;\n }\n\n if (normalizedRequest.commandInput?.Select) {\n spanAttributes[ATTR_AWS_DYNAMODB_SELECT] =\n normalizedRequest.commandInput.Select;\n }\n }\n\n if (operation === 'Scan') {\n if (normalizedRequest.commandInput?.Segment) {\n spanAttributes[ATTR_AWS_DYNAMODB_SEGMENT] =\n normalizedRequest.commandInput?.Segment;\n }\n\n if (normalizedRequest.commandInput?.TotalSegments) {\n spanAttributes[ATTR_AWS_DYNAMODB_TOTAL_SEGMENTS] =\n normalizedRequest.commandInput?.TotalSegments;\n }\n\n if (normalizedRequest.commandInput?.IndexName) {\n spanAttributes[ATTR_AWS_DYNAMODB_INDEX_NAME] =\n normalizedRequest.commandInput.IndexName;\n }\n\n if (normalizedRequest.commandInput?.Select) {\n spanAttributes[ATTR_AWS_DYNAMODB_SELECT] =\n normalizedRequest.commandInput.Select;\n }\n }\n\n if (operation === 'UpdateTable') {\n if (normalizedRequest.commandInput?.AttributeDefinitions) {\n spanAttributes[ATTR_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS] = this.toArray(\n normalizedRequest.commandInput.AttributeDefinitions\n ).map((x: { [DictionaryKey: string]: any }) => JSON.stringify(x));\n }\n\n if (normalizedRequest.commandInput?.GlobalSecondaryIndexUpdates) {\n spanAttributes[ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES] =\n this.toArray(\n normalizedRequest.commandInput.GlobalSecondaryIndexUpdates\n ).map((x: { [DictionaryKey: string]: any }) => JSON.stringify(x));\n }\n }\n\n return {\n isIncoming,\n spanAttributes,\n spanKind,\n spanName,\n };\n }\n\n responseHook(\n response: NormalizedResponse,\n span: Span,\n _tracer: Tracer,\n _config: AwsSdkInstrumentationConfig\n ) {\n if (response.data?.ConsumedCapacity) {\n span.setAttribute(\n ATTR_AWS_DYNAMODB_CONSUMED_CAPACITY,\n toArray(response.data.ConsumedCapacity).map(\n (x: { [DictionaryKey: string]: any }) => JSON.stringify(x)\n )\n );\n }\n\n if (response.data?.ItemCollectionMetrics) {\n span.setAttribute(\n ATTR_AWS_DYNAMODB_ITEM_COLLECTION_METRICS,\n this.toArray(response.data.ItemCollectionMetrics).map(\n (x: { [DictionaryKey: string]: any }) => JSON.stringify(x)\n )\n );\n }\n\n if (response.data?.TableNames) {\n span.setAttribute(\n ATTR_AWS_DYNAMODB_TABLE_COUNT,\n response.data?.TableNames.length\n );\n }\n\n if (response.data?.Count) {\n span.setAttribute(ATTR_AWS_DYNAMODB_COUNT, response.data?.Count);\n }\n\n if (response.data?.ScannedCount) {\n span.setAttribute(\n ATTR_AWS_DYNAMODB_SCANNED_COUNT,\n response.data?.ScannedCount\n );\n }\n }\n}\n\nfunction toArray<T>(values: T | T[]): T[] {\n return Array.isArray(values) ? values : [values];\n}\n"]}
|
package/build/src/version.d.ts
CHANGED
package/build/src/version.js
CHANGED
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.PACKAGE_NAME = exports.PACKAGE_VERSION = void 0;
|
|
19
19
|
// this is autogenerated file, see scripts/version-update.js
|
|
20
|
-
exports.PACKAGE_VERSION = '0.
|
|
20
|
+
exports.PACKAGE_VERSION = '0.65.0';
|
|
21
21
|
exports.PACKAGE_NAME = '@opentelemetry/instrumentation-aws-sdk';
|
|
22
22
|
//# sourceMappingURL=version.js.map
|
package/build/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,YAAY,GAAG,wCAAwC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const PACKAGE_VERSION = '0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,YAAY,GAAG,wCAAwC,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const PACKAGE_VERSION = '0.65.0';\nexport const PACKAGE_NAME = '@opentelemetry/instrumentation-aws-sdk';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/instrumentation-aws-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.0",
|
|
4
4
|
"description": "OpenTelemetry instrumentation for `aws-sdk` and `@aws-sdk/client-*` clients for various AWS services",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@opentelemetry/core": "^2.0.0",
|
|
50
|
-
"@opentelemetry/instrumentation": "^0.
|
|
50
|
+
"@opentelemetry/instrumentation": "^0.210.0",
|
|
51
51
|
"@opentelemetry/semantic-conventions": "^1.34.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -62,22 +62,12 @@
|
|
|
62
62
|
"@aws-sdk/client-sqs": "^3.85.0",
|
|
63
63
|
"@aws-sdk/types": "^3.370.0",
|
|
64
64
|
"@opentelemetry/api": "^1.3.0",
|
|
65
|
-
"@opentelemetry/contrib-test-utils": "^0.
|
|
65
|
+
"@opentelemetry/contrib-test-utils": "^0.57.0",
|
|
66
66
|
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
67
|
-
"@smithy/node-http-handler": "4.
|
|
68
|
-
"@types/mocha": "10.0.10",
|
|
69
|
-
"@types/node": "18.18.14",
|
|
70
|
-
"@types/sinon": "17.0.4",
|
|
71
|
-
"expect": "29.2.0",
|
|
72
|
-
"nock": "13.3.3",
|
|
73
|
-
"nyc": "17.1.0",
|
|
74
|
-
"rimraf": "5.0.10",
|
|
75
|
-
"sinon": "15.2.0",
|
|
76
|
-
"test-all-versions": "6.1.0",
|
|
77
|
-
"typescript": "5.0.4"
|
|
67
|
+
"@smithy/node-http-handler": "4.4.7"
|
|
78
68
|
},
|
|
79
69
|
"engines": {
|
|
80
70
|
"node": "^18.19.0 || >=20.6.0"
|
|
81
71
|
},
|
|
82
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "c84212cca7f010b80747cccb9942474e0459df6e"
|
|
83
73
|
}
|