Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit 9ade98b

Browse files
CORTX-34147: Add time stamp for consul process state updated in bq (#2163)
Problem: HARE bq messages in Support Bundle do not contain timestamps. This is needed for effective offline debug using logs from Support bundle. Solution: Add timestamps to bq publisher; also add the consul kv dump so generated to Support Bundle. Signed-off-by: pavankrishnat <[email protected]>
1 parent 7e9dea9 commit 9ade98b

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

hax/hax/handler.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
1+
# Copyright (c) 2020-2022 Seagate Technology LLC and/or its Affiliates
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
1616
1717
#
1818

19+
import datetime
1920
import logging
2021
from typing import List, Any
2122
from hax.message import (BroadcastHAStates, Die, EntrypointRequest,
@@ -78,7 +79,10 @@ def broadcast_process_state(self, event: ConfHaProcess):
7879
'state': ha_process_events[event.chp_event],
7980
'type': event_type}
8081
payload = dump_json(data)
81-
res = self.bq_publisher.publish('PROCESS-STATE-UPDATE', payload)
82+
now_time = str(datetime.datetime.now())
83+
res = self.bq_publisher.publish(now_time,
84+
'PROCESS-STATE-UPDATE',
85+
payload)
8286
LOG.debug('PROCESS-STATE-UPDATE event JSON: %s res: %d',
8387
payload, res)
8488

hax/hax/queue/publish.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# XXX do we want to make payload definition more strict?
77
# E.g. there could be a type hierarchy for payload objects that depends
88
# on the type name.
9-
Message = NamedTuple('Message', [('message_type', str),
9+
Message = NamedTuple('Message', [('timestamp', str),
10+
('message_type', str),
1011
('payload', Dict[str, Any])])
1112

1213

@@ -22,10 +23,12 @@ def __init__(self,
2223
self.epoch_key = epoch_key
2324

2425
@repeat_if_fails(wait_seconds=0.1)
25-
def publish(self, message_type: str, payload: str) -> int:
26+
def publish(self, timestamp: str, message_type: str, payload: str) -> int:
2627
"""Publishes the given message to the queue."""
2728
data = simplejson.loads(payload)
28-
message = Message(message_type=message_type, payload=data)
29+
message = Message(timestamp=timestamp,
30+
message_type=message_type,
31+
payload=data)
2932
data = simplejson.dumps(message)
3033

3134
while True:

utils/hare-reportbug

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
3+
# Copyright (c) 2020-2022 Seagate Technology LLC and/or its Affiliates
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -130,6 +130,9 @@ sudo systemctl --all --full --no-pager status {hare,m0,motr,s3}\* \
130130

131131
running_process_list
132132

133+
# consul kv output
134+
consul kv get --recurse > consul_kv.log
135+
133136
# cluster status
134137
sudo timeout --kill-after 30 15 hctl status \
135138
> hctl-status.txt || true

0 commit comments

Comments
 (0)