Skip to content

Add client-aware telemetry tracer getter#247

Merged
rbarbadillo merged 1 commit into
mainfrom
rbarbadillo/client-telemetry-tracer-getter
Jun 23, 2026
Merged

Add client-aware telemetry tracer getter#247
rbarbadillo merged 1 commit into
mainfrom
rbarbadillo/client-telemetry-tracer-getter

Conversation

@rbarbadillo

@rbarbadillo rbarbadillo commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add getTelemetryTracer(client, name, version?, options?) to the observability public surface
  • Resolve tracers from the same client-aware provider source as SDK request tracing
  • Preserve explicit global telemetry mode by bypassing registered providers when configured via configureTelemetry or env

Usage

import { Mistral } from "@mistralai/mistralai";
import {
  configureTelemetry,
  getTelemetryTracer,
} from "@mistralai/mistralai/extra/observability";

const client = new Mistral({ apiKey: process.env["MISTRAL_API_KEY"] ?? "" });

await configureTelemetry(client);

const tracer = getTelemetryTracer(client, "my-agent");

await tracer.startActiveSpan("invoke_agent", async (span) => {
  try {
    const toolResult = await runToolCall();

    return await client.chat.complete({
      model: "mistral-large-latest",
      messages: [
        { role: "user", content: `Tool returned: ${toolResult}` },
      ],
    });
  } finally {
    span.end();
  }
});

Tests

  • pnpm --dir tests test -- extra/observability/telemetry.test.ts
  • pnpm --dir tests test -- extra/observability/customProvider.test.ts
  • pnpm --dir tests test -- extra/observability
  • pnpm run build
  • pnpm run lint

@rbarbadillo rbarbadillo self-assigned this Jun 23, 2026
@rbarbadillo
rbarbadillo marked this pull request as ready for review June 23, 2026 13:00
@rbarbadillo
rbarbadillo merged commit 6bdabd4 into main Jun 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants