From 48c5b36e82970a292f28dd25122a313bb83a1b8b Mon Sep 17 00:00:00 2001 From: Joe Elliott Date: Thu, 22 Feb 2024 10:15:53 -0500 Subject: [PATCH] spiky graphs and local blocks config Signed-off-by: Joe Elliott --- source/mythical-beasts-requester/index.js | 20 +++++++++++++++++++- tempo/tempo.yaml | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/source/mythical-beasts-requester/index.js b/source/mythical-beasts-requester/index.js index 05f401c..adf91b1 100644 --- a/source/mythical-beasts-requester/index.js +++ b/source/mythical-beasts-requester/index.js @@ -176,11 +176,29 @@ const makeRequest = async (tracingObj, sendMessage, logEntry) => { requestSpan.end(); }); + // The following awful code creates spikes in the request rate which makes for more interesting graphs + // Joe Elliott did not write this. Do not check the blame. + counter++; + if (counter >= 3000) { + counter = 0; + } + + var nextReqIn; + if (counter < 2000) { + // Choose low values in the first minute of every 5-minute interval + nextReqIn = Math.floor(Math.random() * 50); + } else { + // Choose high values for the next 4 minutes + nextReqIn = Math.floor(Math.random() * 1000) + 100; + } + // Sometime in the next two seconds, but larger than 100ms - const nextReqIn = (Math.random() * 1000) + 100; + //const nextReqIn = (Math.random() * 1000) + 100; setTimeout(() => makeRequest(tracingObj, sendMessage, logEntry), nextReqIn); }; +let counter = 0; + (async () => { const tracingObj = await tracingUtils(); const { sendMessage } = await queueUtils(tracingObj); diff --git a/tempo/tempo.yaml b/tempo/tempo.yaml index 76c9455..9c8f1c5 100644 --- a/tempo/tempo.yaml +++ b/tempo/tempo.yaml @@ -58,6 +58,9 @@ storage: metrics_generator: # Specifies which processors to use. processor: + # keep all spans in the local blocks. this will allow for traceql metrics using structural queries + local_blocks: + filter_server_spans: false # Span metrics create metrics based on span type, duration, name and service. span_metrics: # Configure extra dimensions to add as metric labels.