Skip to content

Conversation

@len-foss
Copy link

Some customer environments do not have the ability to set any custom environment variables (it's bad, but environment setups are typically very hard to change).
They rely on runtime configuration only.
Moreover, they have strong privacy requirements that go beyond simple GDPR.
Therefore, just relying on logfire is a problem; the self-hosted solution is behind enterprise paywall, so it's not an easily available option, especially to test on a staging environment.

@codecov
Copy link

codecov bot commented Jan 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@strawgate
Copy link
Contributor

strawgate commented Jan 17, 2026

You should be able to use os.environ to change the environment vars visible to your process at runtime without actually changing the system or how the process is invoked.

os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://my-logs-are-on-fire.com:443"

logfire.configure(...)

As for making this configurable in code -- I imagine you wouldn't just want to expose an otlp_endpoint setting on the top-level configure call -- you'd want the entire exporter / otlp to be configurable with code as you may be proxying OTLP, only providing a traces endpoint, etc.

@len-foss
Copy link
Author

@strawgate Thank you for your reply.

And for your patience, as I'm really not familiar with OTel stuff, but I figured it should be as simple as that from:
https://logfire.pydantic.dev/docs/how-to-guides/alternative-backends/#example-with-jaeger

But I think this other link is much clearer:
https://ai.pydantic.dev/logfire/#alternative-observability-backends

It's possible to make a more complete example using the docker-compose at https://github.com/livingdocsIO/monitoring as basis, to have everything running easily and test all features.
This was to go for a staging environment, so I was looking for a quick solution... I see why logfire is more convenient.

@len-foss len-foss closed this Jan 18, 2026
@len-foss len-foss deleted the main-otelrt branch January 18, 2026 16:55
@alexmojaki
Copy link
Contributor

from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import BatchSpanProcessor
import logfire

exporter = OTLPSpanExporter(endpoint='http://localhost:4318/v1/traces')
span_processor = BatchSpanProcessor(exporter)
logfire.configure(additional_span_processors=[span_processor])

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.

3 participants