Class RuntimeStatisticCollector
- java.lang.Object
-
- org.apache.synapse.aspects.flow.statistics.collectors.RuntimeStatisticCollector
-
- Direct Known Subclasses:
CallbackStatisticCollector
,CloseEventCollector
,FaultStatisticCollector
,OpenEventCollector
public abstract class RuntimeStatisticCollector extends Object
RuntimeStatisticCollector receives statistic events and responsible for handling each of these events.
-
-
Field Summary
Fields Modifier and Type Field Description static long
eventExpireTime
-
Constructor Summary
Constructors Constructor Description RuntimeStatisticCollector()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static void
addEvent(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to just add event without changing counts.protected static void
addEventAndCloseFlow(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to add event and close the message flow static collection.protected static void
addEventAndDecrementCallbackCount(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to add event and decrement call back count, which denotes, call back has been received.protected static void
addEventAndDecrementCount(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to add event and decrement stat count, which denotes, closing event happened.protected static void
addEventAndIncrementCallbackCount(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to add event and increment call back count, which notifies that a callback has been registeredprotected static void
addEventAndIncrementCount(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to add event and increment stat count so that it denotes, open event is added.static void
init()
Initialize statistics collection when ESB starts.static boolean
isCollectingAllStatistics()
Return whether collecting statistics for all artifacts is enabled (this also needs isStatisticsEnabled)static boolean
isCollectingPayloads()
Return whether collecting payloads is enabled.static boolean
isCollectingProperties()
Return whether collecting message-properties is enabled.static boolean
isMediationFlowStatisticsEnabled()
Returns whether mediation flow statistics (Analytics profile) has been enabled.static boolean
isOpenTelemetryEnabled()
Returns whether OpenTelemetry has been enabled.static boolean
isStatisticsEnabled()
Returns whether statistics collection is enabled globally for the esb as specified in the synapse.properties file.static void
setCollectingAllStatistics(boolean state)
Allow external to alter state of collecting statistics for all artifacts, during runtimeprotected static void
setStatisticsTraceId(MessageContext msgCtx)
Set message Id of the message context as statistic trace Id at the beginning of the statistic flow.static boolean
shouldReportStatistic(MessageContext messageContext)
Returns true if statistics is collected in this message flow path.
-
-
-
Method Detail
-
init
public static void init()
Initialize statistics collection when ESB starts.
-
setStatisticsTraceId
protected static void setStatisticsTraceId(MessageContext msgCtx)
Set message Id of the message context as statistic trace Id at the beginning of the statistic flow.- Parameters:
msgCtx
- synapse message context.
-
shouldReportStatistic
public static boolean shouldReportStatistic(MessageContext messageContext)
Returns true if statistics is collected in this message flow path.- Parameters:
messageContext
- synapse message context.- Returns:
- true if statistics is collected in the message flow.
-
isStatisticsEnabled
public static boolean isStatisticsEnabled()
Returns whether statistics collection is enabled globally for the esb as specified in the synapse.properties file.- Returns:
- true if statistics collection is enabled.
-
isOpenTelemetryEnabled
public static boolean isOpenTelemetryEnabled()
Returns whether OpenTelemetry has been enabled.- Returns:
- true if open telemetry has been enabled.
-
isMediationFlowStatisticsEnabled
public static boolean isMediationFlowStatisticsEnabled()
Returns whether mediation flow statistics (Analytics profile) has been enabled.- Returns:
- true if mediation flow statistics has been enabled.
-
isCollectingPayloads
public static boolean isCollectingPayloads()
Return whether collecting payloads is enabled.- Returns:
- true if need to collect payloads.
-
isCollectingProperties
public static boolean isCollectingProperties()
Return whether collecting message-properties is enabled.- Returns:
- true if need to collect message-properties.
-
isCollectingAllStatistics
public static boolean isCollectingAllStatistics()
Return whether collecting statistics for all artifacts is enabled (this also needs isStatisticsEnabled)- Returns:
- true if need to collect statistics for all artifacts
-
setCollectingAllStatistics
public static void setCollectingAllStatistics(boolean state)
Allow external to alter state of collecting statistics for all artifacts, during runtime
-
addEventAndIncrementCount
protected static void addEventAndIncrementCount(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to add event and increment stat count so that it denotes, open event is added.- Parameters:
messageContext
-event
-
-
addEventAndDecrementCount
protected static void addEventAndDecrementCount(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to add event and decrement stat count, which denotes, closing event happened.- Parameters:
messageContext
-event
-
-
addEventAndIncrementCallbackCount
protected static void addEventAndIncrementCallbackCount(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to add event and increment call back count, which notifies that a callback has been registered- Parameters:
messageContext
-event
-
-
addEventAndDecrementCallbackCount
protected static void addEventAndDecrementCallbackCount(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to add event and decrement call back count, which denotes, call back has been received.- Parameters:
messageContext
-event
-
-
addEvent
protected static void addEvent(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to just add event without changing counts.- Parameters:
messageContext
-event
-
-
addEventAndCloseFlow
protected static void addEventAndCloseFlow(MessageContext messageContext, StatisticsReportingEvent event)
Helper method to add event and close the message flow static collection.- Parameters:
messageContext
-event
-
-
-