Skip to content

Commit 6113778

Browse files
committed
fix ConsoleSpanExporter, gen_ai.output.messages
1 parent 0d6880a commit 6113778

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

packages/instrumentation-bedrock/src/instrumentation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,9 @@ export class BedrockInstrumentation extends InstrumentationBase {
551551
.replace("\n\nAssistant:", ""),
552552
// OTel 1.40: structured input messages alongside legacy prompt attributes
553553
[ATTR_GEN_AI_INPUT_MESSAGES]: formatInputMessagesFromPrompt(
554-
requestBody["prompt"],
554+
requestBody["prompt"]
555+
.replace("\n\nHuman:", "")
556+
.replace("\n\nAssistant:", ""),
555557
),
556558
};
557559
}

packages/instrumentation-bedrock/tests/anthropic.test.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
NodeTracerProvider,
2323
InMemorySpanExporter,
2424
SimpleSpanProcessor,
25-
ConsoleSpanExporter,
2625
} from "@opentelemetry/sdk-trace-node";
2726
import * as bedrockModule from "@aws-sdk/client-bedrock-runtime";
2827
import { NodeHttpHandler } from "@smithy/node-http-handler";
@@ -60,10 +59,7 @@ Polly.register(FSPersister);
6059

6160
describe("Test Anthropic with AWS Bedrock Instrumentation", () => {
6261
const provider = new NodeTracerProvider({
63-
spanProcessors: [
64-
new SimpleSpanProcessor(memoryExporter),
65-
new SimpleSpanProcessor(new ConsoleSpanExporter()),
66-
],
62+
spanProcessors: [new SimpleSpanProcessor(memoryExporter)],
6763
});
6864
let instrumentation: BedrockInstrumentation;
6965
let contextManager: AsyncHooksContextManager;

0 commit comments

Comments
 (0)