Skip to content

fix: convert int and double to string in otel body#1544

Open
nikhilsinhaparseable wants to merge 2 commits intoparseablehq:mainfrom
nikhilsinhaparseable:otel-value-fix
Open

fix: convert int and double to string in otel body#1544
nikhilsinhaparseable wants to merge 2 commits intoparseablehq:mainfrom
nikhilsinhaparseable:otel-value-fix

Conversation

@nikhilsinhaparseable
Copy link
Contributor

@nikhilsinhaparseable nikhilsinhaparseable commented Feb 12, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Numeric telemetry values (integers and doubles), including those inside arrays, are now serialized as strings rather than as JSON numbers.
    • This change improves consistency of exported telemetry payloads and reduces parsing variability for downstream consumers.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Walkthrough

Changes to OpenTelemetry value serialization in otel_utils.rs: top-level DoubleValue now serializes as a JSON string; inside arrays, IntValue and DoubleValue now emit string representations instead of JSON numbers.

Changes

Cohort / File(s) Summary
OpenTelemetry Value Serialization
src/otel/otel_utils.rs
Adjusted JSON serialization for numeric OtelValues: top-level DoubleValue -> string; array IntValue -> string (no numeric emission); array DoubleValue -> string (no numeric emission).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐇 I hopped through code at break of dawn,

Turned numbers to strings with a cheerful yawn,
Telemetry whispers in quotes so neat,
JSON hums soft with a rabbit's beat.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is missing entirely. The template requires sections for issue reference, description of goals, solutions, and testing/documentation checklists, none of which are provided. Add a complete pull request description following the repository template, including issue reference (Fixes #XXXX), description of changes, and completed checklist items for testing and documentation.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: convert int and double to string in otel body' accurately reflects the main changes in the pull request, which convert OtelValue::IntValue and OtelValue::DoubleValue from JSON Numbers to String representations.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/otel/otel_utils.rs`:
- Around line 82-85: The IntValue arm in the conversion logic
(OtelValue::IntValue) is incorrectly pushing both a string and a numeric
serde_json::Number into json_array, producing duplicate entries; update the
OtelValue::IntValue handling so it only pushes the string representation
(Value::String(i.to_string())) to json_array to match the top-level IntValue
behavior and DoubleValue handling, leaving the rest of the function unchanged
and removing the serde_json::Number::from(*i) push.

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.

1 participant