Skip to content

Commit

Permalink
fix(metrics): update mobc to latest version (#4193)
Browse files Browse the repository at this point in the history
It also fixes reporting of initial values of aliased metrics, which otherwise wouldn't be reported until emitted by mobc.

Co-authored-by: Jan Piotrowski <[email protected]>
  • Loading branch information
alencardc and janpio authored Sep 8, 2023
1 parent 09a821d commit 9b21b9f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions query-engine/black-box-tests/tests/metrics/smoke_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,21 @@ mod smoke_tests {
.await
.unwrap();

// counters
assert!(metrics.contains("prisma_client_queries_total counter"));
assert!(metrics.contains("prisma_datasource_queries_total counter"));
assert!(metrics.contains("prisma_pool_connections_open counter"));
assert!(metrics.contains("prisma_client_queries_active gauge"));
assert!(metrics.contains("prisma_client_queries_wait gauge"));
assert!(metrics.contains("prisma_pool_connections_opened_total counter"));
assert!(metrics.contains("prisma_pool_connections_closed_total counter"));
// gauges
assert!(metrics.contains("prisma_pool_connections_open gauge"));
assert!(metrics.contains("prisma_pool_connections_busy gauge"));
assert!(metrics.contains("prisma_pool_connections_idle gauge"));
assert!(metrics.contains("prisma_pool_connections_opened_total gauge"));
assert!(metrics.contains("prisma_datasource_queries_duration_histogram_ms_bucket"));
assert!(metrics.contains("prisma_client_queries_active gauge"));
assert!(metrics.contains("prisma_client_queries_wait gauge"));
// histograms
assert!(metrics.contains("prisma_client_queries_duration_histogram_ms histogram"));
assert!(metrics.contains("prisma_client_queries_wait_histogram_ms histogram"));
assert!(metrics.contains("prisma_datasource_queries_duration_histogram_ms histogram"));
})
.await
}
Expand Down
11 changes: 9 additions & 2 deletions query-engine/metrics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,18 @@ const ACCEPT_LIST: &[&str] = &[
MOBC_POOL_CONNECTIONS_IDLE,
MOBC_POOL_WAIT_COUNT,
MOBC_POOL_WAIT_DURATION,
PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS,
PRISMA_CLIENT_QUERIES_TOTAL,
PRISMA_DATASOURCE_QUERIES_DURATION_HISTOGRAM_MS,
PRISMA_DATASOURCE_QUERIES_TOTAL,
PRISMA_POOL_CONNECTIONS_OPENED_TOTAL,
PRISMA_POOL_CONNECTIONS_CLOSED_TOTAL,
PRISMA_POOL_CONNECTIONS_OPEN,
PRISMA_POOL_CONNECTIONS_BUSY,
PRISMA_POOL_CONNECTIONS_IDLE,
PRISMA_CLIENT_QUERIES_WAIT,
PRISMA_CLIENT_QUERIES_ACTIVE,
PRISMA_CLIENT_QUERIES_DURATION_HISTOGRAM_MS,
PRISMA_CLIENT_QUERIES_WAIT_HISTOGRAM_MS,
PRISMA_DATASOURCE_QUERIES_DURATION_HISTOGRAM_MS,
];

// Some of the metrics we receive have their internal names, and we need to expose them under a different
Expand Down

0 comments on commit 9b21b9f

Please sign in to comment.