From 05a3ba3fefe11dfb09a00d4dec4a1075d2c4f920 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Thu, 12 Aug 2021 16:20:05 +0100 Subject: [PATCH] Fix/expand a few comments --- .../telemetry_core/src/aggregator/aggregator_set.rs | 2 +- backend/telemetry_core/src/main.rs | 7 +++++-- backend/telemetry_core/tests/soak_tests.rs | 10 +++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/backend/telemetry_core/src/aggregator/aggregator_set.rs b/backend/telemetry_core/src/aggregator/aggregator_set.rs index 7dd368d..c5a324d 100644 --- a/backend/telemetry_core/src/aggregator/aggregator_set.rs +++ b/backend/telemetry_core/src/aggregator/aggregator_set.rs @@ -63,7 +63,7 @@ impl AggregatorSet { }; // Lock, update the stored metrics and drop the lock immediately. - // We discard any error; if somethign went wrong talking to the inner loop, + // We discard any error; if something went wrong talking to the inner loop, // it's probably a fatal error { inner.metrics.lock().unwrap()[idx] = metrics; diff --git a/backend/telemetry_core/src/main.rs b/backend/telemetry_core/src/main.rs index 91308b0..9be898f 100644 --- a/backend/telemetry_core/src/main.rs +++ b/backend/telemetry_core/src/main.rs @@ -485,13 +485,16 @@ where async fn return_prometheus_metrics(aggregator: AggregatorSet) -> Response { let metrics = aggregator.latest_metrics(); - // Instead of using the rust prometheus library, we just split out the text format that prometheus expects - // ourselves, using whatever the latest metrics that we've captured so far are. See: + // Instead of using the rust prometheus library (which is optimised around global variables updated across a codebase), + // we just split out the text format that prometheus expects ourselves, using whatever the latest metrics that we've + // captured so far from the aggregators are. See: // // https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md#text-format-details // // For an example and explanation of this text based format. The minimal output we produce here seems to // be handled correctly when pointing a current version of prometheus at it. + // + // Note: '{{' and '}}' are just escaped versions of '{' and '}' in Rust fmt strings. let mut s = String::new(); for (idx, m) in metrics.iter().enumerate() { s.push_str(&format!( diff --git a/backend/telemetry_core/tests/soak_tests.rs b/backend/telemetry_core/tests/soak_tests.rs index d033a74..2aef316 100644 --- a/backend/telemetry_core/tests/soak_tests.rs +++ b/backend/telemetry_core/tests/soak_tests.rs @@ -46,17 +46,17 @@ use test_utils::workspace::{start_server, CoreOpts, ServerOpts, ShardOpts}; /// /// To start up 4 telemetry_shards and 1 telemetry_core with 10 feeds and 100 nodes: /// ```sh -/// SOAK_TEST_ARGS='--feeds 10 --nodes 100 --shards 4' cargo test --release -- realistic_soak_test --ignored --nocapture +/// SOAK_TEST_ARGS='--feeds 10 --nodes 100 --shards 4' cargo test --release -- soak_test --ignored --nocapture /// ``` /// /// You can also run this test against the pre-sharding actix binary with something like this: /// ```sh -/// TELEMETRY_BIN=~/old_telemetry_binary SOAK_TEST_ARGS='--feeds 100 --nodes 100 --shards 4' cargo test --release -- realistic_soak_test --ignored --nocapture +/// TELEMETRY_BIN=~/old_telemetry_binary SOAK_TEST_ARGS='--feeds 100 --nodes 100 --shards 4' cargo test --release -- soak_test --ignored --nocapture /// ``` /// /// Or, you can run it against existing processes on the network with something like this: /// ```sh -/// TELEMETRY_SUBMIT_HOSTS='127.0.0.1:8001' TELEMETRY_FEED_HOST='127.0.0.1:8000' SOAK_TEST_ARGS='--feeds 100 --nodes 100 --shards 4' cargo test --release -- realistic_soak_test --ignored --nocapture +/// TELEMETRY_SUBMIT_HOSTS='127.0.0.1:8001' TELEMETRY_FEED_HOST='127.0.0.1:8000' SOAK_TEST_ARGS='--feeds 100 --nodes 100 --shards 4' cargo test --release -- soak_test --ignored --nocapture /// ``` /// #[ignore] @@ -70,14 +70,14 @@ pub fn soak_test() { .thread_name("telemetry_test_runner") .build() .unwrap() - .block_on(run_realistic_soak_test(opts)); + .block_on(run_soak_test(opts)); } /// A general soak test runner. /// This test sends realistic messages from connected nodes /// so that we can see how things react under more normal /// circumstances -async fn run_realistic_soak_test(opts: SoakTestOpts) { +async fn run_soak_test(opts: SoakTestOpts) { let mut server = start_server( ServerOpts { release_mode: true,