Repository navigation
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9519362. Configure here.
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.

TL;DRAccept JSON-valued metadata propagation and add opt-in JSON object encoding for observations, traces, and experiments.
WhyRuby is excluded from Langfuse's per-key JSON decoding. Whole-object encoding preserves structured payloads without changing SDK identity. Legacy encoding remains the default; migration guidance covers hooks, filters, and server readback limits.
ChecklistCloses AAI-611
Verification
Local tests passed with 97.31% coverage. CI passed on Ruby 3.2–3.4 with both JSON dependency matrices, plus RuboCop. Langfuse 4.78.0 CLI readback, observation metadata filters, and browser inspection verified propagation, concurrent updates, experiments, and masking. Older self-hosted versions remain unverified.
Note
Medium Risk
Touches core trace propagation, OpenTelemetry attribute shape, and cross-service baggage; opting into
:jsoncan break existing metadata filters and export masking hooks until migrated.Overview
Introduces
metadata_encodingonLangfuse::Config(:legacydefault,:jsonopt-in) and a newMetadataEncodingmodule that owns how observation, trace, experiment, and experiment-item metadata are serialized on the wire, propagated through context/baggage, merged on span updates, and applied viaMetadataEncoding.apply_to_span.Legacy behavior is unchanged by default. In
:jsonmode, metadata is sent as a single JSON object per base attribute (e.g.langfuse.trace.metadata) instead of flattened dotted keys;propagate_attributesnow accepts JSON-serializable metadata values with encoded length limits, frozen snapshots, and safer handling of invalid JSON, oversized values, and inbound baggage (including dropping non–UTF-8 entries so export batches are not lost). Observation/trace updates use striped locks to merge concurrent JSON metadata writes.OtelAttributes,Propagation,ExperimentAttributes, and observationupdate/update_tracepaths route throughMetadataEncoding. Docs addMETADATA.mdplus updates to configuration, tracing, and experiments guidance (backend contract, filters, hook migration). A largemetadata_encoding_speccovers encoding modes, propagation, baggage round-trips, masking, and export hooks.Reviewed by Cursor Bugbot for commit b4fca75. Bugbot is set up for automated code reviews on this repo. Configure here.