docs(logs): clarify attribute value types for Python logs#17921
Open
sergical wants to merge 2 commits into
Open
docs(logs): clarify attribute value types for Python logs#17921sergical wants to merge 2 commits into
sergical wants to merge 2 commits into
Conversation
Log attribute values must be primitives (string/number/boolean) to be stored. Same-typed scalar lists are sent as arrays that aren't currently retained (they appear empty in the Logs UI), while mixed lists and dicts are stored as their string representation. Document this and recommend serializing complex values (e.g. json.dumps) before logging. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
The "Include Business Context" example showed feature_flags as a raw list, which the Python SDK drops on ingestion (arrays aren't stored as attributes). Show the join-to-string pattern instead so the example actually works. Co-Authored-By: Claude Opus 4.8 <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
Clarifies which value types are supported for Python log attributes, after a user reported that array-valued attributes (e.g.
list[int]likeworkflow_ids/detector_ids) silently show up empty in the Logs UI.Findings (validated against a real project)
Sentry's log storage (EAP) only retains scalar attribute types — string, number, boolean. The Python SDK (
sentry_sdk.utils.format_attribute) sends a homogeneous scalarlist/tupleas a real array, which the backend does not store, so it appears empty. Mixed lists anddicts arerepr'd to strings and do survive. (For contrast,@sentry/corestringifies all non-primitives viaserializeAttributes(attrs, true), so JS users see arrays as JSON strings — the two SDKs diverge here.)Change
Adds an
<Alert>to the Python logs usage include documenting that attribute values should be primitives, explaining the array behavior, and recommending serializing complex values (e.g.json.dumps(...)) before logging.A separate
sentry-pythonissue tracks the SDK-level inconsistency.🤖 Generated with Claude Code