enhancement(buffers): Instrument buffer total bytes/events received, sent, dropped (#9327)
* Add internal_event dependency Signed-off-by: 001wwang <will.wang@datadoghq.com> * Add EventsReceived, Sent, Dropped skeletons Signed-off-by: 001wwang <will.wang@datadoghq.com> * Implement emit_metrics for relevant InternalEvents Signed-off-by: 001wwang <will.wang@datadoghq.com> * Instrument EventsSent for in-memory buffer Signed-off-by: 001wwang <will.wang@datadoghq.com> * Instrument EventsSent for disk buffer Signed-off-by: 001wwang <will.wang@datadoghq.com> * Instrument EventsDropped Signed-off-by: 001wwang <will.wang@datadoghq.com> * Addd instrumentation wrapper for blocking buffer Signed-off-by: 001wwang <will.wang@datadoghq.com> * Fix clippy errors Signed-off-by: 001wwang <will.wang@datadoghq.com> * Update cue data for docs Signed-off-by: 001wwang <will.wang@datadoghq.com> * Update dependencies Signed-off-by: 001wwang <will.wang@datadoghq.com> * Use encoded byte size for disk buffer EventsSent Signed-off-by: 001wwang <will.wang@datadoghq.com> * Emit EventsReceived in writer for disk buffer We emit in try_send which calculates event size to avoid an expensive recalculation Signed-off-by: 001wwang <will.wang@datadoghq.com> * Add ByteSizeOf trait bound for calculating byte size for memory buffer events Rewrites comment for BlockWhenFull. Refactor DropWhenFull start_send Signed-off-by: 001wwang <will.wang@datadoghq.com> * Use appropriate byte size for blocking buffers Signed-off-by: 001wwang <will.wang@datadoghq.com> * Refactor instrumentation wrapper to avoid repetition Signed-off-by: 001wwang <will.wang@datadoghq.com> * Fix type errors Signed-off-by: 001wwang <will.wang@datadoghq.com> * Remove unnecessary comment Signed-off-by: 001wwang <will.wang@datadoghq.com> * Fix formatting Signed-off-by: 001wwang <will.wang@datadoghq.com> * Rename events with buffer prefix Signed-off-by: 001wwang <will.wang@datadoghq.com> * Update sink telemetry docs Signed-off-by: 001wwang <will.wang@datadoghq.com> * Update transform telemetry docs Signed-off-by: 001wwang <will.wang@datadoghq.com> * Remove transform telemetry cue update Signed-off-by: 001wwang <will.wang@datadoghq.com> * Add tracing span to buffer variant struct Signed-off-by: 001wwang <will.wang@datadoghq.com> * Use span for correct tagging in memory buffer buffer_received_ metrics Also replaces Option<Span> with the notion of enabled/disabled spans. The disabled span serves as a flag for whether or not to instrument a memory buffer (not in the case of buffers attached to transforms). Signed-off-by: 001wwang <will.wang@datadoghq.com> * Disable instrumentation for memory buffers when span is disabled Signed-off-by: 001wwang <will.wang@datadoghq.com> * Use span for correct tagging in disk buffer buffer_received_ metrics Signed-off-by: 001wwang <will.wang@datadoghq.com> * Remove emit_log in impl Signed-off-by: 001wwang <will.wang@datadoghq.com> * Replace allocated_bytes with size_of Signed-off-by: 001wwang <will.wang@datadoghq.com> * Refactor span usage for buffer instrumentation to fix errors Instead of passing spans in as part of buffer variants, we pass them as additional arguments in the buffer build function. This simplifies the wiring and better separates concerns for the variant type. Signed-off-by: 001wwang <will.wang@datadoghq.com> * Add DebuggingRecorder to buffer benchmarks To properly benchmark instrumented buffers, a metrics recorder needs to be installed. Otherwise, metrics related logic is a noop and performance overhead is not accurately reflected. Signed-off-by: 001wwang <will.wang@datadoghq.com> * Add metrics tracing layer dependencies to buffer benchmarking Signed-off-by: 001wwang <will.wang@datadoghq.com> * Use flag for disabling instrumentation in transform memory buffers Signed-off-by: 001wwang <will.wang@datadoghq.com> * Use shared state and tokio task for metrics emission Signed-off-by: 001wwang <will.wang@datadoghq.com> * Update tokio runtime in buffer benchmarks Signed-off-by: 001wwang <will.wang@datadoghq.com> * Organize code and fix linting issues Signed-off-by: 001wwang <will.wang@datadoghq.com> * Remove unnecessary file Signed-off-by: 001wwang <will.wang@datadoghq.com> * Move init_instrumentation into new for buffer usage data Signed-off-by: 001wwang <will.wang@datadoghq.com> * Use u64 instead of usize when possible Signed-off-by: 001wwang <will.wang@datadoghq.com> * Use batched instrumentation mechanism for disk buffers Signed-off-by: 001wwang <will.wang@datadoghq.com> * Use swap instead of load to avoid overcounting metrics Signed-off-by: 001wwang <will.wang@datadoghq.com> * Add buffer_events, buffer_byte_size gauge Signed-off-by: 001wwang <will.wang@datadoghq.com> * Resolve clippy errors for cast precision loss (allow) Signed-off-by: 001wwang <will.wang@datadoghq.com> * Add buffer_events and buffer_byte_size to cue docs Signed-off-by: 001wwang <will.wang@datadoghq.com> * Combine event and byte size increment functions Signed-off-by: 001wwang <will.wang@datadoghq.com> * Rename _bytes metrics to _event_bytes to match component style Signed-off-by: 001wwang <will.wang@datadoghq.com>
W
Will committed
16a16be7b8c8fdf3e3b69b38f5ac2ec0d7ef6016
Parent: 18c3b27
Committed by GitHub <noreply@github.com>
on 10/13/2021, 1:25:20 AM