Skip to content

Commit b07062d

Browse files
hush-hushtruthbk
authored andcommitted
Log metadata payload as debug to be added to flares
When debugging some support case, having the metadata payload in the logs can be very useful.
1 parent cbebaf6 commit b07062d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

checks/collector.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,18 @@ def run(self, checksd=None, start_event=True, configs_reloaded=False):
519519
self.continue_running)
520520
self.emit_duration = timer.step()
521521

522+
if self._is_first_run():
523+
# This is not the exact payload sent to the backend as minor post
524+
# processing is done, but this will give us a good idea of what is sent
525+
# to the backend.
526+
data = payload.payload # deep copy and merge of meta and metric data
527+
data['apiKey'] = '*************************' + data.get('apiKey', '')[-5:]
528+
# removing unused keys for the metadata payload
529+
del data['metrics']
530+
del data['events']
531+
del data['service_checks']
532+
log.debug("Metadata payload: %s", json.dumps(data))
533+
522534
# Persist the status of the collection run.
523535
try:
524536
CollectorStatus(check_statuses, emitter_statuses,

0 commit comments

Comments
 (0)