feat: install() one-call setup helper (v1.3.0)#13
Merged
prathamesh-sonpatki merged 3 commits intomainfrom Apr 26, 2026
Merged
Conversation
Collapses the usual six-line setup (TracerProvider + Last9SpanProcessor + LoggerProvider + Last9LogToSpanProcessor + OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT env + OpenAIInstrumentor.instrument()) into a single `install()` call. The helper: - creates the providers if the caller didn't pass any, and optionally registers them as OTel globals (set_global=True by default) - wires Last9SpanProcessor + Last9LogToSpanProcessor together so span and log pipelines share state - sets OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT unless the caller already set it - best-effort calls OpenAIInstrumentor().instrument(logger_provider=...) if opentelemetry-instrumentation-openai-v2 is importable - returns an InstallHandle dataclass exposing both providers, both processors, and a shutdown() convenience Also forwards cost-tracking kwargs (custom_pricing, enable_cost_tracking, workflow_tracker) through to Last9SpanProcessor so install() is a full replacement for the manual wiring. Bumps version to 1.3.0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
Author
|
@coderabbitai do full review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
last9_genai.install()— a single call that wires up the full Last9GenAI observability pipeline: providers,
Last9SpanProcessor,Last9LogToSpanProcessor, the capture-content env var, andOpenAIInstrumentor().instrument()(when the openai-v2 package isinstalled).
InstallHandledataclass so callers can reach the providers(to attach exporters) and call
shutdown().Why
Previously customers had to repeat six lines of boilerplate (see README
"Manual wiring" section) to hook up the log-to-span bridge. That was the
friction Avakash hit.
install()compresses that to:Test plan
install()— provider reuse, env-var behaviour,kwarg forwarding, shutdown, missing-openai-v2 fallback.
v1.3.0and verify PyPI publish.Related
agent_context) shipped on PyPI earlier today.setup into the package.
🤖 Generated with Claude Code