Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: report stream chunk size as partition_input_bytes for workload generator #13284

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/connector/src/source/monitor/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ impl Default for EnumeratorMetrics {
#[derive(Debug, Clone)]
pub struct SourceMetrics {
pub partition_input_count: GenericCounterVec<AtomicU64>,

// **Note**: for normal messages, the metric is the message's payload size.
// For messages from load generator, the metric is the size of stream chunk.
pub partition_input_bytes: GenericCounterVec<AtomicU64>,
/// Report latest message id
pub latest_message_id: GenericGaugeVec<AtomicI64>,
Expand Down
12 changes: 9 additions & 3 deletions src/connector/src/source/nexmark/source/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use nexmark::event::EventType;
use nexmark::EventGenerator;
use risingwave_common::array::{Op, StreamChunk};
use risingwave_common::error::RwError;
use risingwave_common::estimate_size::EstimateSize;
use tokio::time::Instant;

use crate::parser::ParserConfig;
Expand Down Expand Up @@ -114,13 +115,18 @@ impl SplitReader for NexmarkSplitReader {
// Will buffer at most 4 event chunks.
const BUFFER_SIZE: usize = 4;
spawn_data_generation_stream(
self.into_native_stream()
.inspect_ok(move |chunk_with_states| {
self.into_native_stream().inspect_ok(
move |chunk_with_states: &StreamChunkWithState| {
metrics
.partition_input_count
.with_label_values(&[&actor_id, &source_id, &split_id])
.inc_by(chunk_with_states.chunk.cardinality() as u64);
}),
metrics
.partition_input_bytes
.with_label_values(&[&actor_id, &source_id, &split_id])
.inc_by(chunk_with_states.chunk.estimated_size() as u64);
},
),
BUFFER_SIZE,
)
.boxed()
Expand Down
Loading