feat(observability): support custom ports for self-hosted Laminar#2447
Open
Shimada666 wants to merge 1 commit intoOpenHands:mainfrom
Open
feat(observability): support custom ports for self-hosted Laminar#2447Shimada666 wants to merge 1 commit intoOpenHands:mainfrom
Shimada666 wants to merge 1 commit intoOpenHands:mainfrom
Conversation
Self-hosted Laminar uses port 8001 for gRPC and 8000 for HTTP, but `maybe_init_laminar()` calls `Laminar.initialize()` without passing port arguments, causing it to default to 8443/443 (cloud ports). This makes self-hosted Laminar unusable without workarounds like pre-initializing Laminar before importing the SDK or falling back to raw OTEL environment variables. Add support for `LMNR_HTTP_PORT` and `LMNR_GRPC_PORT` environment variables, passed to `Laminar.initialize()` only on the Laminar backend path. When unset, defaults remain unchanged (443/8443), so this is fully backward compatible. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
LMNR_HTTP_PORTandLMNR_GRPC_PORTenvironment variables to configure custom ports for self-hosted Laminar instancesmaybe_init_laminar()defaults to 8443/443 (cloud ports), making self-hosted setups unusable without workaroundsProblem
When using a self-hosted Laminar instance (via
docker compose), the gRPC port is8001and HTTP port is8000. However,maybe_init_laminar()callsLaminar.initialize()without port arguments, so it always defaults to the cloud ports (gRPC: 8443, HTTP: 443).Current workarounds are unintuitive:
Laminarbefore importing the SDK to prevent re-initializationOTEL_EXPORTER_OTLP_TRACES_*environment variables instead ofLMNR_*variablesSolution
Read optional
LMNR_HTTP_PORTandLMNR_GRPC_PORTenvironment variables and pass them toLaminar.initialize()on the Laminar backend path only. The OTEL backend path is unaffected since its ports are controlled byOTEL_EXPORTER_OTLP_TRACES_ENDPOINT.Usage
Test plan
LMNR_HTTP_PORT/LMNR_GRPC_PORTset, behavior is identical to before (defaults to 443/8443)🤖 Generated with Claude Code