Skip to content

Commit d4424b4

Browse files
nirgaclaude
andcommitted
refactor: remove debug console.log statements
Remove temporary debug logging from instrumentation code. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 51b8557 commit d4424b4

File tree

4 files changed

+7
-20
lines changed

4 files changed

+7
-20
lines changed

packages/instrumentation-langchain/src/callback_handler.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ export class TraceloopCallbackHandler extends BaseCallbackHandler {
5151
_metadata?: Record<string, unknown>,
5252
_runName?: string,
5353
): Promise<void> {
54-
console.log("📞 handleChatModelStart called!", {
55-
runId,
56-
className: llm.id?.[llm.id.length - 1],
57-
});
5854
const className = llm.id?.[llm.id.length - 1] || "unknown";
5955
const vendor = this.detectVendor(llm);
6056
const spanBaseName = this.convertClassNameToSpanName(className);

packages/instrumentation-langchain/src/instrumentation.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export class LangChainInstrumentation extends InstrumentationBase {
2828
constructor(config: LangChainInstrumentationConfig = {}) {
2929
super("@traceloop/instrumentation-langchain", version, config);
3030

31-
console.log("🚀 LangChain instrumentation constructor called");
3231

3332
// Manually instrument CallbackManager immediately since module detection doesn't work
3433
this.instrumentCallbackManagerDirectly();
@@ -83,9 +82,6 @@ export class LangChainInstrumentation extends InstrumentationBase {
8382
inheritableMetadata?: Record<string, unknown>,
8483
localMetadata?: Record<string, unknown>,
8584
) {
86-
console.log(
87-
"🎉 _configureSync called - Creating TraceloopCallbackHandler...",
88-
);
8985

9086
// Add our callback handler to inheritable handlers
9187
const callbackHandler = new TraceloopCallbackHandler(

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,7 @@ describe("Test Langchain instrumentation", async function () {
439439
// Test LLM span attributes like in amazon.test.ts
440440
const attributes = llmSpan.attributes;
441441
assert.strictEqual(attributes[SpanAttributes.LLM_SYSTEM], "AWS");
442-
assert.strictEqual(
443-
attributes[SpanAttributes.LLM_REQUEST_TYPE],
444-
"chat",
445-
);
442+
assert.strictEqual(attributes[SpanAttributes.LLM_REQUEST_TYPE], "chat");
446443
assert.ok(attributes[SpanAttributes.LLM_REQUEST_MODEL]);
447444
assert.strictEqual(
448445
attributes[`${SpanAttributes.LLM_PROMPTS}.0.role`],
@@ -461,10 +458,8 @@ describe("Test Langchain instrumentation", async function () {
461458
assert.ok(attributes[SpanAttributes.LLM_USAGE_COMPLETION_TOKENS]);
462459
assert.ok(attributes[SpanAttributes.LLM_USAGE_TOTAL_TOKENS]);
463460
} else {
464-
// Test LangChain callback handler spans - now only creates completion span
465-
const completionSpan = spans.find(
466-
(span) => span.name === "bedrock.chat",
467-
);
461+
// Test LangChain callback handler spans - now only creates completion span
462+
const completionSpan = spans.find((span) => span.name === "bedrock.chat");
468463

469464
assert.ok(
470465
completionSpan,

packages/sample-app/src/sample_langchain_bedrock.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import "dotenv/config";
22
import * as traceloop from "@traceloop/node-server-sdk";
33

44
traceloop.initialize({
5-
appName: "sample_langchain_bedrock",
5+
appName: "sample_langchain_bedrock",
66
apiKey: process.env.TRACELOOP_API_KEY,
77
disableBatch: true,
88
logLevel: "debug",
@@ -14,7 +14,7 @@ import { HumanMessage } from "@langchain/core/messages";
1414
async function main() {
1515
const model = new BedrockChat({
1616
model: "us.anthropic.claude-3-7-sonnet-20250219-v1:0",
17-
region: "us-east-1"
17+
region: "us-east-1",
1818
});
1919

2020
const message = new HumanMessage({
@@ -24,9 +24,9 @@ async function main() {
2424
console.log("About to invoke BedrockChat...");
2525
const response = await model.invoke([message]);
2626
console.log("Response received:", response);
27-
27+
2828
// Wait for spans to be exported
29-
await new Promise(resolve => setTimeout(resolve, 2000));
29+
await new Promise((resolve) => setTimeout(resolve, 2000));
3030
console.log("Done waiting for spans");
3131
}
3232

0 commit comments

Comments
 (0)