File tree Expand file tree Collapse file tree 5 files changed +22
-28
lines changed
plugins/node/opentelemetry-instrumentation-aws-sdk Expand file tree Collapse file tree 5 files changed +22
-28
lines changed Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff 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' ] ,
Original file line number Diff line number Diff line change @@ -109,6 +109,16 @@ export const ATTR_GEN_AI_RESPONSE_FINISH_REASONS =
109109 */
110110export 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 */
140150export 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 ;
Original file line number Diff line number Diff 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' ;
4444import {
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 }
You can’t perform that action at this time.
0 commit comments