Skip to content

Commit

Permalink
chore: add fields metrics (#1176)
Browse files Browse the repository at this point in the history
## Rationale

## Detailed Changes
Add write fields metrics.


## Test Plan
No need
  • Loading branch information
jiacai2050 authored Aug 28, 2023
1 parent 12d8b01 commit 92abd71
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v3
with:
name: CI-${{ github.head_ref }}.${{ github.sha }}
name: CI-${{ github.sha }}
path: |
/tmp/ceresdb-stdout.log
/tmp/ceresmeta.log
Expand Down Expand Up @@ -250,7 +250,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v3
with:
name: sdk-test-${{ github.head_ref }}.${{ github.sha }}
name: sdk-test-${{ github.sha }}
path: |
/tmp/ceresdb-stdout.log
Expand Down
3 changes: 2 additions & 1 deletion analytic_engine/src/instance/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,10 @@ impl<'a> Writer<'a> {
table_data.set_last_sequence(sequence);

// Collect metrics.
let num_columns = row_group.schema().num_columns();
table_data
.metrics
.on_write_request_done(row_group.num_rows());
.on_write_request_done(row_group.num_rows(), num_columns);

Ok(())
}
Expand Down
9 changes: 8 additions & 1 deletion analytic_engine/src/table/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ lazy_static! {
)
.unwrap();

static ref TABLE_WRITE_FIELDS_COUNTER: IntCounter = register_int_counter!(
"table_write_fields_counter",
"Fields counter of table write"
)
.unwrap();

static ref TABLE_READ_REQUEST_COUNTER: IntCounter = register_int_counter!(
"table_read_request_counter",
"Read request counter of table"
Expand Down Expand Up @@ -208,8 +214,9 @@ impl Metrics {
}

#[inline]
pub fn on_write_request_done(&self, num_rows: usize) {
pub fn on_write_request_done(&self, num_rows: usize, num_columns: usize) {
TABLE_WRITE_BATCH_HISTOGRAM.observe(num_rows as f64);
TABLE_WRITE_FIELDS_COUNTER.inc_by((num_columns * num_rows) as u64);
}

#[inline]
Expand Down

0 comments on commit 92abd71

Please sign in to comment.