use of com.linkedin.databus.client.pub.monitoring.events.ConsumerCallbackStatsEvent in project databus by linkedin.
the class DatabusV2ClusterRegistrationImpl method initializeStatsCollectors.
protected synchronized void initializeStatsCollectors() {
//some safety against null pointers coming from unit tests
MBeanServer mbeanServer = null;
int ownerId = -1;
long pullerThreadDeadnessThresholdMs = UnifiedClientStats.DEFAULT_DEADNESS_THRESHOLD_MS;
if (null != _client) {
mbeanServer = _client.getMbeanServer();
ownerId = _client.getContainerStaticConfig().getId();
pullerThreadDeadnessThresholdMs = _client.getClientStaticConfig().getPullerThreadDeadnessThresholdMs();
}
String regId = null != _id ? _id.getId() : "unknownReg";
ConsumerCallbackStats relayConsumerStats = new ConsumerCallbackStats(ownerId, regId + ".callback.relay", regId, true, false, new ConsumerCallbackStatsEvent());
ConsumerCallbackStats bootstrapConsumerStats = new ConsumerCallbackStats(ownerId, regId + ".callback.bootstrap", regId, true, false, new ConsumerCallbackStatsEvent());
UnifiedClientStats unifiedClientStats = new UnifiedClientStats(ownerId, regId + ".callback.unified", regId, true, false, pullerThreadDeadnessThresholdMs, new UnifiedClientStatsEvent());
_relayCallbackStatsMerger = new StatsCollectors<ConsumerCallbackStats>(relayConsumerStats);
_bootstrapCallbackStatsMerger = new StatsCollectors<ConsumerCallbackStats>(bootstrapConsumerStats);
_unifiedClientStatsMerger = new StatsCollectors<UnifiedClientStats>(unifiedClientStats);
_relayEventStatsMerger = new StatsCollectors<DbusEventsStatisticsCollector>(new AggregatedDbusEventsStatisticsCollector(ownerId, regId + ".inbound", true, false, mbeanServer));
_bootstrapEventStatsMerger = new StatsCollectors<DbusEventsStatisticsCollector>(new AggregatedDbusEventsStatisticsCollector(ownerId, regId + ".inbound.bs", true, false, mbeanServer));
if (null != _client) {
_client.getBootstrapEventsStats().addStatsCollector(regId, _bootstrapEventStatsMerger.getStatsCollector());
_client.getInBoundStatsCollectors().addStatsCollector(regId, _relayEventStatsMerger.getStatsCollector());
_client.getRelayConsumerStatsCollectors().addStatsCollector(regId, _relayCallbackStatsMerger.getStatsCollector());
_client.getBootstrapConsumerStatsCollectors().addStatsCollector(regId, _bootstrapCallbackStatsMerger.getStatsCollector());
_client.getUnifiedClientStatsCollectors().addStatsCollector(regId, _unifiedClientStatsMerger.getStatsCollector());
_client.getGlobalStatsMerger().registerStatsCollector(_relayEventStatsMerger);
_client.getGlobalStatsMerger().registerStatsCollector(_bootstrapEventStatsMerger);
_client.getGlobalStatsMerger().registerStatsCollector(_relayCallbackStatsMerger);
_client.getGlobalStatsMerger().registerStatsCollector(_bootstrapCallbackStatsMerger);
_client.getGlobalStatsMerger().registerStatsCollector(_unifiedClientStatsMerger);
}
}
use of com.linkedin.databus.client.pub.monitoring.events.ConsumerCallbackStatsEvent in project databus by linkedin.
the class DatabusV2RegistrationImpl method initializeStatsCollectors.
/**
* Initialize Statistics Collectors
*/
protected void initializeStatsCollectors(String regId, int ownerId, MBeanServer mbeanServer) {
_inboundEventsStatsCollector = new DbusEventsStatisticsCollector(ownerId, regId + STREAM_EVENT_STATS_SUFFIX_NAME, true, false, mbeanServer);
_bootstrapEventsStatsCollector = new DbusEventsStatisticsCollector(ownerId, regId + BOOTSTRAP_EVENT_STATS_SUFFIX_NAME, true, false, mbeanServer);
_relayConsumerStats = new ConsumerCallbackStats(ownerId, regId + RELAY_CONSUMER_STATS_SUFFIX_NAME, regId, true, false, new ConsumerCallbackStatsEvent());
_bootstrapConsumerStats = new ConsumerCallbackStats(ownerId, regId + BOOTSTRAP_CONSUMER_STATS_SUFFIX_NAME, regId, true, false, new ConsumerCallbackStatsEvent());
_unifiedClientStats = new UnifiedClientStats(ownerId, regId + UNIFIED_CLIENT_STATS_SUFFIX_NAME, regId, true, false, _client.getClientStaticConfig().getPullerThreadDeadnessThresholdMs(), new UnifiedClientStatsEvent());
}
use of com.linkedin.databus.client.pub.monitoring.events.ConsumerCallbackStatsEvent in project databus by linkedin.
the class ConsumerCallbackStats method doMergeStats.
@Override
protected void doMergeStats(Object eventData) {
if (!(eventData instanceof ConsumerCallbackStatsEvent)) {
if (!(eventData instanceof ConsumerCallbackStats)) {
LOG.warn("Attempt to merge unknown event class" + eventData.getClass().getName());
return;
}
eventData = ((ConsumerCallbackStats) eventData)._event;
}
ConsumerCallbackStatsEvent e = (ConsumerCallbackStatsEvent) eventData;
_event.numDataEventsReceived += e.numDataEventsReceived;
_event.numDataEventsProcessed += e.numDataEventsProcessed;
_event.numDataErrorsProcessed += e.numDataErrorsProcessed;
_event.numEventsReceived += e.numEventsReceived;
_event.numEventsProcessed += e.numEventsProcessed;
_event.numErrorsReceived += e.numErrorsReceived;
_event.numErrorsProcessed += e.numErrorsProcessed;
_event.numSysEventsProcessed += e.numSysEventsProcessed;
_event.numSysEventsReceived += e.numSysEventsReceived;
_event.numSysErrorsProcessed += e.numSysErrorsProcessed;
_event.latencyEventsProcessed += e.latencyEventsProcessed;
_event.minSeenWinScn = _event.minSeenWinScn != 0 ? Math.min(_event.minSeenWinScn, e.minSeenWinScn) : e.minSeenWinScn;
_event.maxSeenWinScn = _event.maxSeenWinScn != 0 ? Math.max(_event.maxSeenWinScn, e.maxSeenWinScn) : e.maxSeenWinScn;
_event.timestampLastMergeMs = System.currentTimeMillis();
_event.timestampLastEventProcessed = _event.timestampLastEventProcessed != 0 ? Math.max(_event.timestampLastEventProcessed, e.timestampLastEventProcessed) : e.timestampLastEventProcessed;
_event.timestampLastEventReceived = _event.timestampLastEventReceived != 0 ? Math.max(_event.timestampLastEventReceived, e.timestampLastEventReceived) : e.timestampLastEventReceived;
_event.timestampOfLastEventProcessed = _event.timestampOfLastEventProcessed != 0 ? Math.max(_event.timestampOfLastEventProcessed, e.timestampOfLastEventProcessed) : e.timestampOfLastEventProcessed;
_event.timestampOfLastEventReceived = _event.timestampOfLastEventReceived != 0 ? Math.max(_event.timestampOfLastEventReceived, e.timestampOfLastEventReceived) : e.timestampOfLastEventReceived;
_event.scnOfLastEventProcessed = 0 != _event.scnOfLastEventProcessed ? Math.max(_event.scnOfLastEventProcessed, e.scnOfLastEventProcessed) : e.scnOfLastEventProcessed;
_event.maxSeenWinTimestamp = 0 != _event.maxSeenWinTimestamp ? Math.max(_event.maxSeenWinTimestamp, e.maxSeenWinTimestamp) : e.maxSeenWinTimestamp;
}
Aggregations