Skip to content

Commit 1bcbeb5

Browse files
nirgaclaude
andcommitted
fix: correct span naming to match Python implementation
- Change span names from {model}.completion to {model} - bedrock.chat.completion -> bedrock.chat - Matches Python callback handler naming convention - Update test to expect correct span names - All tests passing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ea3b08b commit 1bcbeb5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/instrumentation-langchain/src/callback_handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class TraceloopCallbackHandler extends BaseCallbackHandler {
6161
const spanBaseName = this.convertClassNameToSpanName(className);
6262

6363
// Create single LLM span like Python implementation
64-
const span = this.tracer.startSpan(`${spanBaseName}.completion`, {
64+
const span = this.tracer.startSpan(spanBaseName, {
6565
kind: SpanKind.CLIENT,
6666
});
6767

@@ -105,7 +105,7 @@ export class TraceloopCallbackHandler extends BaseCallbackHandler {
105105
const spanBaseName = this.convertClassNameToSpanName(className);
106106

107107
// Create single LLM span like handleChatModelStart
108-
const span = this.tracer.startSpan(`${spanBaseName}.completion`, {
108+
const span = this.tracer.startSpan(spanBaseName, {
109109
kind: SpanKind.CLIENT,
110110
});
111111

packages/instrumentation-langchain/test/instrumentation.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ describe("Test Langchain instrumentation", async function () {
461461
assert.ok(attributes[SpanAttributes.LLM_USAGE_COMPLETION_TOKENS]);
462462
assert.ok(attributes[SpanAttributes.LLM_USAGE_TOTAL_TOKENS]);
463463
} else {
464-
// Test LangChain callback handler spans - now only creates completion span
464+
// Test LangChain callback handler spans - now only creates completion span
465465
const completionSpan = spans.find(
466-
(span) => span.name === "bedrock.chat.completion",
466+
(span) => span.name === "bedrock.chat",
467467
);
468468

469469
assert.ok(

0 commit comments

Comments
 (0)