File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
packages/instrumentation-aws-sdk/src Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -601,3 +601,11 @@ export const GEN_AI_TOKEN_TYPE_VALUE_INPUT = 'input' as const;
601601 * @experimental This enum value is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
602602 */
603603export const GEN_AI_TOKEN_TYPE_VALUE_OUTPUT = 'output' as const ;
604+
605+ /**
606+ * Number of input and output tokens used.
607+ *
608+ * @experimental This metric is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
609+ */
610+ export const METRIC_GEN_AI_CLIENT_TOKEN_USAGE =
611+ 'gen_ai.client.token.usage' as const ;
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ import {
4040 GEN_AI_SYSTEM_VALUE_AWS_BEDROCK ,
4141 GEN_AI_TOKEN_TYPE_VALUE_INPUT ,
4242 GEN_AI_TOKEN_TYPE_VALUE_OUTPUT ,
43+ METRIC_GEN_AI_CLIENT_TOKEN_USAGE ,
4344} from '../semconv' ;
4445import {
4546 AwsSdkInstrumentationConfig ,
@@ -62,7 +63,7 @@ export class BedrockRuntimeServiceExtension implements ServiceExtension {
6263
6364 updateMetricInstruments ( meter : Meter ) {
6465 // https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/#metric-gen_aiclienttokenusage
65- this . tokenUsage = meter . createHistogram ( 'gen_ai.client.token.usage' , {
66+ this . tokenUsage = meter . createHistogram ( METRIC_GEN_AI_CLIENT_TOKEN_USAGE , {
6667 unit : '{token}' ,
6768 description : 'Measures number of input and output tokens used' ,
6869 valueType : ValueType . INT ,
You can’t perform that action at this time.
0 commit comments