feat(otlp): structured typed attributes in JSON payload - #102
Merged
Conversation
- 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>
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
Add structured typed attributes from
VariableValue args_arrayto OTLP JSON payload.OtlpRecordSnapshotnow carriesargs_arrayacross the async boundary.otlp_write_double_attr,otlp_write_uint_attr.include_args=true,include_arg_names=false,args_prefix="logit.arg.".[A-Za-z0-9_.-]), and positional fallback for empty names.logit.arg_namesdeprecated as OTLP attribute.Scope
OtlpRecordSnapshot.hppOtlpJsonSerializer.hppOtlpHttpLoggerConfig.hpptests/otlp_structured_attributes_test.cpptests/otlp_json_serializer_test.cpptests/CMakeLists.txtdocs/OtlpHttpLogger.mdTest plan
otlp_json_serializer_test— backward compatibility preserved.otlp_structured_attributes_test— 14 cases: type mapping, NaN/Inf, dedup, sanitization, custom prefix, config flags.Breaking change
include_arg_namesdefault changed fromtruetofalse. Users relying onlogit.arg_namesmust setinclude_arg_names=trueexplicitly.Fixes since review
doubleValueemitted as bare JSON number, not string (OTLP/proto3 spec).Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com