Move V3 protocol into a separate crate#1920
Draft
StephenWakely wants to merge 3 commits into
Draft
Conversation
…ics-v3 crate Extract the pure-protocol V3 codec (interner, types, writer, serializer) from lib/saluki-components into a zero-dependency lib/datadog-metrics-v3 crate. The serializer is reimplemented using raw protobuf wire-format encoding with no external deps. saluki-components now re-exports from this crate.
Three issues addressed: 1. compact_values() skipped for Sketch metrics. Sketch summary values (sum/min/max) must stay in vals_float64. The old code could move them to vals_float32 or vals_sint64 based on magnitude, corrupting the payload — the decoder reads these from vals_float64 by position, not by type tag. 2. V3MetricBuilder Drop guard. Without a Drop impl, forgetting close() silently left value-type bits unset in the types column. Now panics in debug builds if close() is not called before drop. 3. MetricsV3EndpointEncoder::encode() now writes to buffer. The EndpointEncoder contract requires each encode() call to write to buffer so the request builder can track sizes. Previously the V3 encoder accumulated into self.writer but wrote nothing to buffer, producing empty payloads. Fixed by serializing a single-metric V3 payload per encode() call. Full cross-metric deduplication requires a batch-flush hook on EndpointEncoder (tracked via TODO comment).
…d_numbers module field_numbers was a duplicate of the private mod field in serializer.rs and was not referenced anywhere. WIRE_VARINT (protobuf wire type 0) is not used by the current serializer.
|
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
Change Type
How did you test this PR?
References