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

table: add metric for number of bytes inserted #567

Merged
merged 1 commit into from
Oct 19, 2023
Merged
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
6 changes: 6 additions & 0 deletions table.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ type tableMetrics struct {
blockPersisted prometheus.Counter
blockRotated prometheus.Counter
rowsInserted prometheus.Counter
rowBytesInserted prometheus.Counter
zeroRowsInserted prometheus.Counter
rowInsertSize prometheus.Histogram
lastCompletedBlockTx prometheus.Gauge
Expand Down Expand Up @@ -295,6 +296,10 @@ func newTable(
Name: "frostdb_table_rows_inserted_total",
Help: "Number of rows inserted into table.",
}),
rowBytesInserted: promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "frostdb_table_row_bytes_inserted_total",
Help: "Number of bytes inserted into table.",
}),
zeroRowsInserted: promauto.With(reg).NewCounter(prometheus.CounterOpts{
Name: "frostdb_table_zero_rows_inserted_total",
Help: "Number of times it was attempted to insert zero rows into the table.",
Expand Down Expand Up @@ -875,6 +880,7 @@ func (t *TableBlock) InsertRecord(ctx context.Context, tx uint64, record arrow.R
defer func() {
t.table.metrics.rowsInserted.Add(float64(record.NumRows()))
t.table.metrics.rowInsertSize.Observe(float64(record.NumRows()))
t.table.metrics.rowBytesInserted.Add(float64(recordSize))
}()

if record.NumRows() == 0 {
Expand Down
Loading