Repository navigation
Conversation
…slash
A base_url such as "http://localhost:3000/" was joined with
f"{base_url}/...", so the OTLP exporter posted spans to
"//api/public/otel/v1/traces" and get_trace_url() / experiment_url
returned "http://localhost:3000//project/...". The generated API client
already normalizes this via urljoin; these three URLs bypass it.
Strip the trailing slash where the SDK builds these URLs. _base_url
itself is unchanged.
This branch has not been deployed
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.
When
base_urlends with a slash (for examplehttp://localhost:3000/), three URLs the SDK builds itself end up with a doubled slash://api/public/otel/v1/traces(or//<LANGFUSE_OTEL_TRACES_EXPORT_PATH>)get_trace_url()returnshttp://localhost:3000//project/...experiment_urlinrun_experimenthas the same//project/...problemThe generated API client already normalizes the base URL, and an existing test asserts
_base_urlkeeps the slash as given, so I left_base_urlalone and strip the trailing slash only where these three URLs are built.Tests: three new unit tests (span exporter path, trace URL, experiment URL). Before the fix they fail (
'//api/public/otel/v1/traces' != '/api/public/otel/v1/traces'andhttp://test.com//project/...); after, they pass. Affected files (test_span_processor.py,test_initialization.py,test_experiment.py): 96 passed. Fulltests/unit: 1014 passed, 2 skipped, 26 errors, all intests/unit/test_prompt.pyand identical without this change (missing LANGFUSE_* env vars, #1976); with LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY set: 1040 passed, 2 skipped.ruff check,ruff format --checkandmypy langfusepass. Not run: e2e and live-provider tests (need a Langfuse server and provider keys).Not covered: a
LANGFUSE_OTEL_TRACES_EXPORT_PATHthat itself starts with/would still give//.AI disclosure: Claude (Opus 5.5) found the bug, wrote the fix and tests, and drafted this description. The test runs above were done by the assistant in a cloud sandbox. A person has not yet reviewed the diff line by line beyond confirming scope and authorship; I will respond to review feedback.


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Fixes doubled slashes when a configured base URL ends with
/, without changing the stored URL.Sid13SST explicitly left export paths that start with
/out of scope; that existing case remains unchanged. No actionable issues found.Reviews (1) · Last reviewed commit: "fix(client): don't double the slash afte..." · Reviewed by Greptile