From 63f56d33aa1910903151c79cd231ee3fdae2107d Mon Sep 17 00:00:00 2001 From: chris meyers Date: Tue, 14 Apr 2020 16:59:34 -0400 Subject: [PATCH] show user unsafe name * We log stats using a safe hostname because of prometheus requirements. However, when we display users the hostname we should use the Instance hostname. This change outputs the Instance.hostname instead of the safe prometheus name. --- awx/main/management/commands/run_wsbroadcast.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/awx/main/management/commands/run_wsbroadcast.py b/awx/main/management/commands/run_wsbroadcast.py index 2e60d945e8..62f571921d 100644 --- a/awx/main/management/commands/run_wsbroadcast.py +++ b/awx/main/management/commands/run_wsbroadcast.py @@ -56,8 +56,8 @@ class Command(BaseCommand): host_stats = [('hostname', 'state', 'start time', 'duration (sec)')] for h in hostnames: connection_color = '91' # red - h = safe_name(h) - prefix = f'awx_{h}' + h_safe = safe_name(h) + prefix = f'awx_{h_safe}' connection_state = data.get(f'{prefix}_connection', 'N/A') connection_started = 'N/A' connection_duration = 'N/A' @@ -80,8 +80,8 @@ class Command(BaseCommand): def get_connection_stats(cls, me, hostnames, data): host_stats = [('hostname', 'total', 'per minute')] for h in hostnames: - h = safe_name(h) - prefix = f'awx_{h}' + h_safe = safe_name(h) + prefix = f'awx_{h_safe}' messages_total = data.get(f'{prefix}_messages_received', '0') messages_per_minute = data.get(f'{prefix}_messages_received_per_minute', '0')