diff --git a/roles/fedora-messaging-utils/files/simple_message_to_bus b/roles/fedora-messaging-utils/files/simple_message_to_bus index 7091968fc0..2e8a17f157 100644 --- a/roles/fedora-messaging-utils/files/simple_message_to_bus +++ b/roles/fedora-messaging-utils/files/simple_message_to_bus @@ -1,6 +1,10 @@ -#!/bin/sh -MSGTOPIC_PREFIX="${MSGTOPIC_PREFIX:-logging.stats}" -topic="${MSGTOPIC_PREFIX}.$1" +#!/bin/bash + +# To set a common prefix for all messages, do `export MSGTOPIC_PREFIX=...` in callers. +if [ -n "$MSGTOPIC_PREFIX" -a "${MSGTOPIC_PREFIX%.}" = "$MSGTOPIC_PREFIX" ]; then + MSGTOPIC_PREFIX="${MSGTOPIC_PREFIX}." +fi +topic="${MSGTOPIC_PREFIX}$1" shift sent_at="$(TZ=UTC date -Iseconds)" id="$(uuidgen -r)" diff --git a/roles/web-data-analysis/files/combineHttpLogs.sh b/roles/web-data-analysis/files/combineHttpLogs.sh index ee03b81e98..73d1f5d8c9 100644 --- a/roles/web-data-analysis/files/combineHttpLogs.sh +++ b/roles/web-data-analysis/files/combineHttpLogs.sh @@ -19,6 +19,7 @@ # along with Fedora Project Infrastructure Ansible Repository. If # not, see . +export MSGTOPIC_PREFIX=logging.stats RUN_ID="$(uuidgen -r)" simple_message_to_bus combinehttplogs.start run_id="$RUN_ID" diff --git a/roles/web-data-analysis/files/condense-mirrorlogs.sh b/roles/web-data-analysis/files/condense-mirrorlogs.sh index ab78fcc469..7d5f7dd862 100644 --- a/roles/web-data-analysis/files/condense-mirrorlogs.sh +++ b/roles/web-data-analysis/files/condense-mirrorlogs.sh @@ -25,6 +25,8 @@ # we are 5 days behind. # We have dropped this down to 3 days on 2019-10-01 + +export MSGTOPIC_PREFIX=logging.stats RUN_ID="$(uuidgen -r)" simple_message_to_bus condense-mirrorlogs.start run_id="$RUN_ID" diff --git a/roles/web-data-analysis/files/countme-update.sh b/roles/web-data-analysis/files/countme-update.sh index 43238ffcc2..9f3281d96c 100644 --- a/roles/web-data-analysis/files/countme-update.sh +++ b/roles/web-data-analysis/files/countme-update.sh @@ -1,5 +1,6 @@ #!/bin/bash +export MSGTOPIC_PREFIX=logging.stats RUN_ID="$(uuidgen -r)" simple_message_to_bus countme-update.start run_id="$RUN_ID"