From 101a666557df537920f0c281b2b0d1bf11bedce2 Mon Sep 17 00:00:00 2001 From: Lucas Kent Date: Mon, 23 Sep 2024 14:52:49 +1000 Subject: [PATCH] Readd old metric as deprecated --- docs/src/user-guide/observability.md | 5 ++--- .../tests/runner/observability_int_tests.rs | 11 +++++++++++ shotover/src/transforms/chain.rs | 3 +++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/src/user-guide/observability.md b/docs/src/user-guide/observability.md index 84ac08af8..a823024d0 100644 --- a/docs/src/user-guide/observability.md +++ b/docs/src/user-guide/observability.md @@ -10,11 +10,10 @@ This optional interface will serve Prometheus metrics from `/metrics`. It will b | `shotover_chain_total_count` | `chain` | [counter](#counter) | Counts the amount of times `chain` is used | | `shotover_chain_failures_count` | `chain` | [counter](#counter) | Counts the amount of times `chain` fails | | `shotover_chain_latency_seconds` | `chain` | [histogram](#histogram) | The latency for running `chain` | -| `shotover_available_connections_count` | `source` | [gauge](#gauge) | How many more connections can be opened to `source` before new connections will be rejected. | -| `connections_opened` | `source` | [counter](#counter) | Counts the total number of connections that clients have opened against this source. | | `shotover_chain_requests_batch_size` | `chain` | [histogram](#histogram) | The number of requests in each request batch passing through `chain`. | | `shotover_chain_responses_batch_size` | `chain` | [histogram](#histogram) | The number of responses in each response batch passing through `chain`. | -| `shotover_available_connections_count` | `source` | [gauge](#gauge) | The number of connections currently connected to `source` | +| `shotover_available_connections_count` | `source` | [gauge](#gauge) | How many more connections can be opened to `source` before new connections will be rejected. | +| `connections_opened` | `source` | [counter](#counter) | Counts the total number of connections that clients have opened against this source. | | `shotover_source_to_sink_latency_seconds` | `sink` | [histogram](#histogram) | The milliseconds between reading a request from a source TCP connection and writing it to a sink TCP connection | | `shotover_sink_to_source_latency_seconds` | `source` | [histogram](#histogram) | The milliseconds between reading a response from a sink TCP connection and writing it to a source TCP connection | diff --git a/shotover-proxy/tests/runner/observability_int_tests.rs b/shotover-proxy/tests/runner/observability_int_tests.rs index 79eaac1d5..dab8f7591 100644 --- a/shotover-proxy/tests/runner/observability_int_tests.rs +++ b/shotover-proxy/tests/runner/observability_int_tests.rs @@ -14,6 +14,7 @@ async fn test_metrics() { # TYPE connections_opened counter # TYPE shotover_available_connections_count gauge # TYPE shotover_chain_failures_count counter +# TYPE shotover_chain_messages_per_batch_count summary # TYPE shotover_chain_requests_batch_size summary # TYPE shotover_chain_responses_batch_size summary # TYPE shotover_chain_total_count counter @@ -25,6 +26,16 @@ async fn test_metrics() { connections_opened{source="redis"} shotover_available_connections_count{source="redis"} shotover_chain_failures_count{chain="redis"} +shotover_chain_messages_per_batch_count_count{chain="redis"} +shotover_chain_messages_per_batch_count_sum{chain="redis"} +shotover_chain_messages_per_batch_count{chain="redis",quantile="0"} +shotover_chain_messages_per_batch_count{chain="redis",quantile="0.1"} +shotover_chain_messages_per_batch_count{chain="redis",quantile="0.5"} +shotover_chain_messages_per_batch_count{chain="redis",quantile="0.9"} +shotover_chain_messages_per_batch_count{chain="redis",quantile="0.95"} +shotover_chain_messages_per_batch_count{chain="redis",quantile="0.99"} +shotover_chain_messages_per_batch_count{chain="redis",quantile="0.999"} +shotover_chain_messages_per_batch_count{chain="redis",quantile="1"} shotover_chain_requests_batch_size_count{chain="redis"} shotover_chain_requests_batch_size_sum{chain="redis"} shotover_chain_requests_batch_size{chain="redis",quantile="0"} diff --git a/shotover/src/transforms/chain.rs b/shotover/src/transforms/chain.rs index 2dfd5db34..35a9b2e91 100644 --- a/shotover/src/transforms/chain.rs +++ b/shotover/src/transforms/chain.rs @@ -246,6 +246,9 @@ impl TransformChainBuilder { } ).collect(); + // This is deprecated but give users some time to migrate to the requests/responses versions that have replaced this metric + histogram!("shotover_chain_messages_per_batch_count", "chain" => name).record(0); + let chain_requests_batch_size = histogram!("shotover_chain_requests_batch_size", "chain" => name); let chain_responses_batch_size =