Skip to content
Draft
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ Some of the connection pool configurations can be adjusted dynamically. Each con
- `mobc_pool_connections_open` - Number of currently open Pool Connections
- `mobc_pool_connections_busy` - Number of currently busy Pool Connections (executing a database query)"
- `mobc_pool_connections_idle` - Number of currently unused Pool Connections (waiting for the next pool query to run)
- `mobc_client_queries_wait` - Number of queries currently waiting for a connection
- `mobc_queries_wait` - Number of queries currently waiting for a connection
- Histograms
- `mobc_client_queries_wait_histogram_ms` - Histogram of the wait time of all queries in ms
- `mobc_queries_wait_histogram_ms` - Histogram of the wait time of all queries in ms

## Compatibility

Expand Down
10 changes: 7 additions & 3 deletions src/metrics_utils.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
use metrics::{describe_counter, describe_gauge, describe_histogram};

// counters
pub const OPENED_TOTAL: &str = "mobc_pool_connections_opened_total";
pub const CLOSED_TOTAL: &str = "mobc_pool_connections_closed_total";
pub const OPEN_CONNECTIONS: &str = "mobc_pool_connections_open";

// gauges
pub const OPEN_CONNECTIONS: &str = "mobc_pool_connections_open";
pub const ACTIVE_CONNECTIONS: &str = "mobc_pool_connections_busy";
pub const IDLE_CONNECTIONS: &str = "mobc_pool_connections_idle";
pub const WAIT_COUNT: &str = "mobc_client_queries_wait";
pub const WAIT_DURATION: &str = "mobc_client_queries_wait_histogram_ms";
pub const WAIT_COUNT: &str = "mobc_queries_wait";

// histogram
pub const WAIT_DURATION: &str = "mobc_queries_wait_histogram_ms";

pub fn describe_metrics() {
describe_counter!(OPENED_TOTAL, "Total number of Pool Connections opened");
Expand Down