Skip to content

abi: new v2: typed numeric storage#254

Merged
edsiper merged 9 commits intomasterfrom
abi-v2-typed-numeric-storage
Feb 11, 2026
Merged

abi: new v2: typed numeric storage#254
edsiper merged 9 commits intomasterfrom
abi-v2-typed-numeric-storage

Conversation

@edsiper
Copy link
Member

@edsiper edsiper commented Feb 11, 2026

This PR introduces typed scalar value support in cmetrics to preserve integer precision end-to-end (especially OTLP NumberDataPoint.as_int) while remaining backward-compatible with existing MsgPack payloads.

What changed

  • Added typed scalar model to cmt_metric:
    • value type tag: double | int64 | uint64
    • exact integer storage fields
    • kept legacy packed-double field for compatibility paths
  • Added typed scalar APIs:
    • cmt_metric_set_double, cmt_metric_set_int64, cmt_metric_set_uint64
    • cmt_metric_get_value_type, cmt_metric_get_int64_value, cmt_metric_get_uint64_value
    • existing cmt_metric_set/get_value still work (compat wrapper behavior preserved)
  • Updated OTLP decode/encode:
    • decode as_int into typed int64
    • encode emits exact integer when representable, preserving roundtrip fidelity
  • Updated MsgPack encode/decode ABI:
    • still writes/reads legacy "value" (old payload compatibility)
    • adds typed fields for new payloads: "value_type" + "value_int64"/"value_uint64"
    • decoder accepts old/new payloads and prefers typed fields when present
  • Updated scalar copy/cat paths to preserve typed value semantics.

Tests

  • Extended OTLP roundtrip coverage for large integer precision (> 2^53) across:
    • OTLP -> cmetrics -> MsgPack -> cmetrics -> OTLP
  • Added standalone MsgPack ABI/security tests:
    • legacy value-only decode path
    • new typed-int64 decode path
    • malformed summary/histogram payload mismatch rejection tests
  • Full suite passing:
    • ctest --test-dir build_test_otlp --output-on-failure (18/18)

Compatibility

  • Backward compatibility with older MsgPack payloads is preserved.
  • Existing API users relying on double setters/getters continue to work unchanged.
  • Precision-sensitive integer pipelines now roundtrip losslessly where protocol allows.

Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1b6e73735

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
@edsiper edsiper force-pushed the abi-v2-typed-numeric-storage branch from 4a18a59 to f48b8b9 Compare February 11, 2026 20:06
@edsiper edsiper merged commit 26b50e9 into master Feb 11, 2026
20 checks passed
@edsiper edsiper deleted the abi-v2-typed-numeric-storage branch February 11, 2026 20:20
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