From 2e7afe21671e79766a41cc7954497f4ffb6a9fa8 Mon Sep 17 00:00:00 2001 From: Katie Armstrong Date: Thu, 23 Mar 2023 10:08:56 +0000 Subject: [PATCH] chore: log version --- src/transmitter/index.ts | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/transmitter/index.ts b/src/transmitter/index.ts index 30aeca3cf..ee4a7f1cf 100644 --- a/src/transmitter/index.ts +++ b/src/transmitter/index.ts @@ -371,15 +371,15 @@ export async function sendClusterMetadata(): Promise { namespace: config.NAMESPACE, }; + const logContext = { + userLocator: payload.userLocator, + cluster: payload.cluster, + agentId: payload.agentId, + version: payload.version, + }; + try { - logger.info( - { - userLocator: payload.userLocator, - cluster: payload.cluster, - agentId: payload.agentId, - }, - 'attempting to send cluster metadata', - ); + logger.info(logContext, 'attempting to send cluster metadata'); const request: KubernetesUpstreamRequest = { method: 'post', @@ -395,9 +395,7 @@ export async function sendClusterMetadata(): Promise { logger.info( { - userLocator: payload.userLocator, - cluster: payload.cluster, - agentId: payload.agentId, + ...logContext, attempt, }, 'cluster metadata sent upstream successfully', @@ -405,10 +403,8 @@ export async function sendClusterMetadata(): Promise { } catch (error) { logger.error( { + ...logContext, error, - userLocator: payload.userLocator, - cluster: payload.cluster, - agentId: payload.agentId, }, 'could not send cluster metadata', );