Feat[OBE-10264] - Add topology buffer delay metric#113
Open
janmejay-s1 wants to merge 7 commits into
Open
Conversation
…ds compatibility with EventArray enq_tm change
…e creating sender
Contributor
Author
|
Manual test |
Contributor
Author
|
Disk buffer queue-delay |
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
Adds
topology_queue_delay_seconds, a per-component histogram that measures how longeach event-batch sits in a topology buffer before being consumed. The metric is tagged
with
component_id(consumer) andstage(0 for base, 1 for disk-overflow), lettingoperators pinpoint which sink or transform is slow without inferring it from
backpressure or send-duration.
Wired through every buffer in the topology — sink buffers (memory or disk_v2,
including chained memory→disk overflow), inter-transform buffers, fanout buffers, and
tap buffers. Mandatory at the type level:
BufferReceiver::new/with_overflowrequire
Registered<BufferQueueDelay>+Arc<dyn Clock>as constructor params, so afuture construction path can't silently skip it.
What changed
Wire format
event.proto: addedgoogle.protobuf.Timestamp enq_tm = 4toEventArray. Field isoptional (proto3 default-None), so pre-upgrade disk records decode with no
timestamp and the metric reads zero residency until the buffer drains.
proto.rs: the symmetricFromconversions stay unchanged, so the native codec andvector↔vector RPC wire output are unaffected.
Wrapper + clock
vector-buffers::Timed<T> { inner, enq_tm: Option<SystemTime> }. DelegatesByteSizeOf/EventCount/AddBatchNotifier/FinalizabletoT.Clocktrait +SystemClock(default) + tests use aTokioBackedClockbacked bytokio::time::Instantso paused-time gives exact, deterministic timing assertions.Duration::ZEROfor clock backsteps andenq_tm == None).Encodable, via blanket-impl pattern (no orphan rule violation)
TimedEncodable: Encodabletrait invector-buffers.impl<T: TimedEncodable> Encodable for Timed<T>—Timed<T>getsEncodablefor free when the inner T can describe how to attach the timestamp.
impl<T: FixedEncodable> TimedEncodable for T— pass-through (dropstimestamp on encode, returns
Noneon decode) so test types usingFixedEncodableneed no code changes.
impl TimedEncodable for EventArrayinvector-core— uses the new proto field;this is the only place that actually serializes the timestamp on the wire. Orphan
rule is satisfied because
EventArrayis local tovector-core.Buffer plumbing
SenderAdapter/ReceiverAdapterchannels carryTimed<T>internally; externalAPI still takes/returns
T.BufferSender::sendwraps viaTimed::stamped;send_stampedis an internalrecursive helper that preserves
enq_tmthrough overflow.BufferReceiver::nextunwraps, callswith_telemetry(histogram emit + existingbuffer-usage counter), returns inner
T.BufferQueueDelayregistered_event invector-buffers/src/internal_events.rsemits
topology_queue_delay_secondstagged withcomponent_id+stage.BufferConfig::build/TopologyBuilder::build/standalone_memoryall gainimpl Into<ComponentKey>IDs and a siblingbuild_with_clockfor tests.buffer_send_duration_seconds(
with_send_duration_instrumentationsetter) is also made a required constructorparam so it can't be silently skipped either.
Backwards compat — verified, not assumed
lib/vector-core/tests/data/fixtures/legacy_disk_buffer_v2/)was generated on master, before the proto change, and committed. The generator
test (
legacy_disk_buffer_fixture_gen.rs) stays gated#[ignore]forregeneration if the ledger format ever changes.
Tests
event::ser::tests(4)EventArraydecoder ignores tag 4; pre-tag-4 bytes decode asTimed { enq_tm: None }timed::tests(5)buffer_disk_v2_compat::tests(3)buffer_histogram_demo::tests(3)TokioBackedClocktopology::test::queue_delay(1)demo_logs → remap → remap → blackholetopology loaded from TOML; per-component_idhistograms verified viaController::capture_metrics()