Skip to content

Commit

Permalink
table: add metric for number of bytes inserted (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
asubiotto authored Oct 19, 2023
1 parent b5930d1 commit 92877c7
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit 92877c7

Please sign in to comment.