Skip to content

Add public telemetry tracer helper#568

Merged
rbarbadillo merged 2 commits into
mainfrom
rbarbadillo/add-telemetry-tracer-helper
Jun 19, 2026
Merged

Add public telemetry tracer helper#568
rbarbadillo merged 2 commits into
mainfrom
rbarbadillo/add-telemetry-tracer-helper

Conversation

@rbarbadillo

@rbarbadillo rbarbadillo commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add get_telemetry_tracer(client, name=None) to mistralai.extra.observability
  • select the client custom/dedicated/global telemetry provider without exposing provider lifecycle management
  • cover dedicated, global, custom provider, and disabled telemetry behavior

Usage

from mistralai.client import Mistral
from mistralai.extra.observability import configure_telemetry, get_telemetry_tracer

client = Mistral(api_key="your-api-key")
configure_telemetry(client)

tracer = get_telemetry_tracer(client, "my-agent")

with tracer.start_as_current_span("invoke_agent"):
    response = client.chat.complete(
        model="mistral-large-latest",
        messages=[{"role": "user", "content": "Find recent AI news."}],
    )

    with tracer.start_as_current_span("execute_tool web_search") as tool_span:
        tool_span.set_attribute("gen_ai.tool.name", "web_search")
        tool_span.set_attribute("gen_ai.tool.type", "function")
        search_results = web_search(response)
        tool_span.set_attribute("gen_ai.tool.call.result", str(search_results))

@rbarbadillo rbarbadillo self-assigned this Jun 16, 2026
@rbarbadillo rbarbadillo marked this pull request as ready for review June 19, 2026 07:37
@rbarbadillo rbarbadillo force-pushed the rbarbadillo/add-telemetry-tracer-helper branch from b66d50b to 87a1e85 Compare June 19, 2026 07:38
@rbarbadillo rbarbadillo merged commit 8a259f6 into main Jun 19, 2026
11 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