Skip to content

Commit 8fe002a

Browse files
committed
Fix
1 parent 6a6c50e commit 8fe002a

File tree

5 files changed

+22
-28
lines changed

5 files changed

+22
-28
lines changed

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/node/opentelemetry-instrumentation-aws-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@opentelemetry/core": "^2.0.0",
4848
"@opentelemetry/instrumentation": "^0.200.0",
4949
"@opentelemetry/propagation-utils": "^0.31.0",
50-
"@opentelemetry/semantic-conventions": "^1.27.0"
50+
"@opentelemetry/semantic-conventions": "^1.31.0"
5151
},
5252
"devDependencies": {
5353
"@aws-sdk/client-bedrock-runtime": "^3.587.0",

plugins/node/opentelemetry-instrumentation-aws-sdk/src/aws-sdk.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ export class AwsInstrumentation extends InstrumentationBase<AwsSdkInstrumentatio
7575
}
7676

7777
protected init(): InstrumentationModuleDefinition[] {
78-
// Should always have been initialized in _updateMetricInstruments, but check again
79-
// for safety.
80-
if (!this.servicesExtensions) {
81-
this.servicesExtensions = new ServicesExtensions();
82-
}
83-
8478
const v3MiddlewareStackFileOldVersions = new InstrumentationNodeModuleFile(
8579
'@aws-sdk/middleware-stack/dist/cjs/MiddlewareStack.js',
8680
['>=3.1.0 <3.35.0'],

plugins/node/opentelemetry-instrumentation-aws-sdk/src/semconv.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ export const ATTR_GEN_AI_RESPONSE_FINISH_REASONS =
109109
*/
110110
export const ATTR_GEN_AI_SYSTEM = 'gen_ai.system' as const;
111111

112+
/**
113+
* The type of token being counted.
114+
*
115+
* @example input
116+
* @example output
117+
*
118+
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
119+
*/
120+
export const ATTR_GEN_AI_TOKEN_TYPE = 'gen_ai.token.type' as const;
121+
112122
/**
113123
* The number of tokens used in the GenAI input (prompt).
114124
*
@@ -139,16 +149,6 @@ export const GEN_AI_OPERATION_NAME_VALUE_CHAT = 'chat' as const;
139149
*/
140150
export const GEN_AI_SYSTEM_VALUE_AWS_BEDROCK = 'aws.bedrock' as const;
141151

142-
/**
143-
* The type of token being counted.
144-
*
145-
* @example input
146-
* @example output
147-
*
148-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
149-
*/
150-
export const ATTR_GEN_AI_TOKEN_TYPE = 'gen_ai.token.type' as const;
151-
152152
/**
153153
* Enum value "input" for attribute {@link ATTR_GEN_AI_TOKEN_TYPE}.
154154
*/
@@ -157,4 +157,4 @@ export const GEN_AI_TOKEN_TYPE_VALUE_INPUT = 'input' as const;
157157
/**
158158
* Enum value "output" for attribute {@link ATTR_GEN_AI_TOKEN_TYPE}.
159159
*/
160-
export const GEN_AI_TOKEN_TYPE_VALUE_COMPLETION = 'output' as const;
160+
export const GEN_AI_TOKEN_TYPE_VALUE_OUTPUT = 'output' as const;

plugins/node/opentelemetry-instrumentation-aws-sdk/src/services/bedrock-runtime.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import {
3939
GEN_AI_OPERATION_NAME_VALUE_CHAT,
4040
GEN_AI_SYSTEM_VALUE_AWS_BEDROCK,
4141
GEN_AI_TOKEN_TYPE_VALUE_INPUT,
42-
GEN_AI_TOKEN_TYPE_VALUE_COMPLETION,
42+
GEN_AI_TOKEN_TYPE_VALUE_OUTPUT,
4343
} from '../semconv';
4444
import {
4545
AwsSdkInstrumentationConfig,
@@ -201,7 +201,7 @@ export class BedrockRuntimeServiceExtension implements ServiceExtension {
201201

202202
this.tokenUsage.record(outputTokens, {
203203
...sharedMetricAttrs,
204-
[ATTR_GEN_AI_TOKEN_TYPE]: GEN_AI_TOKEN_TYPE_VALUE_COMPLETION,
204+
[ATTR_GEN_AI_TOKEN_TYPE]: GEN_AI_TOKEN_TYPE_VALUE_OUTPUT,
205205
});
206206
}
207207
}

0 commit comments

Comments
 (0)