Skip to content

Add experimental logfire.instrument_litellm() - #1237

Merged
alexmojaki merged 15 commits into
mainfrom
alex/litellm
Jul 10, 2025
Merged

alexmojaki merged 15 commits into
mainfrom
alex/litellm

Conversation

@alexmojaki

Copy link
Copy Markdown
Contributor

No description provided.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 9, 2025 •

Copy link
Copy Markdown

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 43a5204
Status: ✅  Deploy successful!
Preview URL: https://1cbec5cd.logfire-docs.pages.dev
Branch Preview URL: https://alex-litellm.logfire-docs.pages.dev

View logs

@alexmojaki
alexmojaki marked this pull request as ready for review July 10, 2025 13:46
@alexmojaki
alexmojaki requested a review from Copilot July 10, 2025 13:46
@alexmojaki alexmojaki changed the title LiteLLM Add experimental logfire.instrument_litellm() Jul 10, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for instrumenting the LiteLLM client through Logfire.

  • Introduces a new instrument_litellm API method and integration
  • Updates the span processor to transform LiteLLM spans and guess model systems
  • Adds end-to-end tests and VCR cassettes for the new integration

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_logfire_api.py Adds tests for the new instrument_litellm API
tests/otel_integrations/test_litellm.py New integration test covering LiteLLM span enrichment
tests/otel_integrations/cassettes/...yaml VCR cassette for LiteLLM API interactions
pyproject.toml Adds openinference-instrumentation-litellm, litellm to dev deps
logfire/_internal/main.py Exposes instrument_litellm on the main client
logfire/_internal/integrations/litellm.py Implements the LiteLLM instrumentor wrapper
logfire/_internal/exporters/processor_wrapper.py Transforms LiteLLM spans and implements guess_system
logfire/init.py Exports instrument_litellm at package level
logfire-api/logfire_api/init.py Exposes instrument_litellm in the API wrapper

alexmojaki and others added 3 commits July 10, 2025 15:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@alexmojaki
alexmojaki merged commit b44c387 into main Jul 10, 2025
@alexmojaki
alexmojaki deleted the alex/litellm branch July 10, 2025 14:00
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