Skip to content

feat(otlp): structured typed attributes in JSON payload - #102

Merged
LimiNode merged 3 commits into
mainfrom
feat/otlp-structured-attributes
May 20, 2026
Merged

feat(otlp): structured typed attributes in JSON payload#102
LimiNode merged 3 commits into
mainfrom
feat/otlp-structured-attributes

Conversation

@LimiNode

Copy link
Copy Markdown
Owner

Summary

Add structured typed attributes from VariableValue args_array to OTLP JSON payload.

  • OtlpRecordSnapshot now carries args_array across the async boundary.
  • New serializer helpers: otlp_write_double_attr, otlp_write_uint_attr.
  • VariableValue type-mapped to OTLP AnyValue: bool/int/uint/double/string.
  • Config flags: include_args=true, include_arg_names=false, args_prefix="logit.arg.".
  • Name deduplication, sanitization ([A-Za-z0-9_.-]), and positional fallback for empty names.
  • Legacy logit.arg_names deprecated as OTLP attribute.

Scope

  • OtlpRecordSnapshot.hpp
  • OtlpJsonSerializer.hpp
  • OtlpHttpLoggerConfig.hpp
  • tests/otlp_structured_attributes_test.cpp
  • tests/otlp_json_serializer_test.cpp
  • tests/CMakeLists.txt
  • docs/OtlpHttpLogger.md

Test plan

  • otlp_json_serializer_test — backward compatibility preserved.
  • otlp_structured_attributes_test — 14 cases: type mapping, NaN/Inf, dedup, sanitization, custom prefix, config flags.
  • 52/53 tests passed (1 pre-existing gzip failure unrelated to PR).

Breaking change

  • include_arg_names default changed from true to false. Users relying on logit.arg_names must set include_arg_names=true explicitly.

Fixes since review

  • doubleValue emitted as bare JSON number, not string (OTLP/proto3 spec).
  • Dedup map registers suffixed keys to prevent collision with naturally-named args.

Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

LimiNode and others added 3 commits May 20, 2026 23:18
- OtlpRecordSnapshot now carries args_array across async boundary.
- New serializer helpers: otlp_write_double_attr, otlp_write_uint_attr.
- VariableValue type-mapped to OTLP AnyValue (bool/int/uint/double/string).
- Config flags: include_args=true, include_arg_names=false, args_prefix.
- Name deduplication, sanitization, and positional fallback for empty names.
- Legacy logit.arg_names deprecated as OTLP attribute.

PR: feat/otlp-structured-attributes

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- otlp_write_double_attr: emit doubleValue as bare JSON number,
  not string, per OTLP/proto3 JSON mapping.
- dedup map: register suffixed keys to prevent collision with
  naturally-named args (e.g., a.1 after dedup a -> a.1).
- Add three-dup and suffix-vs-natural-name collision tests.
- Include pending WindowsDebugLogger set_config() Doxygen fix.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Include <cctype> for std::isalnum in sanitize_otlp_key.
- Set std::setprecision(max_digits10) in otlp_write_double_attr
  to avoid stream precision loss for double values.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@LimiNode
LimiNode merged commit 958ffc1 into main May 20, 2026
12 checks passed
@LimiNode
LimiNode deleted the feat/otlp-structured-attributes branch May 21, 2026 19:52
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