From 7b98d82e11942ae9bfa26c63ae6359e5fa475296 Mon Sep 17 00:00:00 2001 From: Graham Whaley Date: Tue, 13 Aug 2019 17:08:03 +0100 Subject: [PATCH] metrics: scaling: add datestamps to stats samples Add invididual date entries to each statistics sample, to suppliment the top level date entry. This helps order the samples if we are flattening the data into say Elasticsearch. Signed-off-by: Graham Whaley --- metrics/scaling/k8s_parallel.sh | 4 ++++ metrics/scaling/k8s_scale.sh | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/metrics/scaling/k8s_parallel.sh b/metrics/scaling/k8s_parallel.sh index 15bb36a..191b3fb 100755 --- a/metrics/scaling/k8s_parallel.sh +++ b/metrics/scaling/k8s_parallel.sh @@ -102,6 +102,10 @@ save_stats() { local json="$(cat << EOF { + "date": { + "ns": $(date +%s%N), + "Date": "$(date -u +"%Y-%m-%dT%T.%3N")" + }, "n_pods": { "Result": ${n_pods}, "Units" : "int" diff --git a/metrics/scaling/k8s_scale.sh b/metrics/scaling/k8s_scale.sh index 26e86ae..f27ea92 100755 --- a/metrics/scaling/k8s_scale.sh +++ b/metrics/scaling/k8s_scale.sh @@ -46,6 +46,15 @@ grab_stats() { local mem_free=() info "And grab some stats" + local date_json="$(cat << EOF + "date": { + "ns": $(date +%s%N), + "Date": "$(date -u +"%Y-%m-%dT%T.%3N")" + } +EOF + )" + metrics_json_add_array_fragment "$date_json" + local pods_json="$(cat << EOF "n_pods": { "Result": ${n_pods},