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

PD-220325-Add-logs-for-the-megabus-for-debugging-purpose #785

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public class MegabusRefProducer extends AbstractScheduledService {
private final Meter _eventMeter;
private final Meter _errorMeter;

private static final Logger logger = LoggerFactory.getLogger(MegabusRefProducer.class);

public MegabusRefProducer(MegabusRefProducerConfiguration config, DatabusEventStore eventStore,
RateLimitedLogFactory logFactory, MetricRegistry metricRegistry,
Producer<String, JsonNode> producer, ObjectMapper objectMapper, Topic topic,
Expand Down Expand Up @@ -147,6 +149,9 @@ boolean peekAndAckEvents() {
.map(ref -> new MegabusRef(ref.getTable(), ref.getKey(), ref.getChangeId(), _clock.instant(), MegabusRef.RefType.NORMAL))
.collect(Collectors.groupingBy(ref -> {
String key = Coordinate.of(ref.getTable(), ref.getKey()).toString();
if(ref.getTable().contains("apikey")){
logger.info("debugging mega-bus delay while provisioning apikey in MegabusRefProducer: = {}",key);
}
return Utils.toPositive(Utils.murmur2(key.getBytes())) % _topic.getPartitions();
}, Collectors.toList()))
.entrySet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class TableEventProcessor extends AbstractScheduledService {

private static final int FUTURE_BATCH_SIZE = 10000;

private static final Logger _log = LoggerFactory.getLogger(TableEventProcessor.class);
private static final Logger logger = LoggerFactory.getLogger(TableEventProcessor.class);

private final TableEventRegistry _tableEventRegistry;
private final MetricRegistry _metricRegistry;
Expand Down Expand Up @@ -80,11 +80,13 @@ protected void runOneIteration() throws Exception {
}

private void processTableEvent(String table, String uuid, MegabusRef.RefType refType) {

Iterator<Future<RecordMetadata>> futures = _tableEventTools.getIdsForStorage(table, uuid)
.map(key -> new MegabusRef(table, key, TimeUUIDs.minimumUuid(), null, refType))
.map(ref -> {
String key = Coordinate.of(ref.getTable(), ref.getKey()).toString();
if(table.contains("apikey")){
logger.info("debugging mega-bus delay while provisioning apikey in TableEventProcessor: = {}",key);
}
return new ProducerRecord<String, JsonNode>(_topic.getName(),
Utils.toPositive(Utils.murmur2(key.getBytes())) % _topic.getPartitions(),
TimeUUIDs.newUUID().toString(),_objectMapper.valueToTree(Collections.singletonList(ref)));
Expand Down