Package io.mats3.intercept.logging
Class MatsMetricsLoggingInterceptor
java.lang.Object
io.mats3.intercept.logging.MatsMetricsLoggingInterceptor
- All Implemented Interfaces:
MatsInitiateInterceptor
,MatsInterceptable.MatsLoggingInterceptor
,MatsStageInterceptor
public class MatsMetricsLoggingInterceptor
extends Object
implements MatsInterceptable.MatsLoggingInterceptor, MatsInitiateInterceptor, MatsStageInterceptor
A logging interceptor that writes loglines to two SLF4J loggers, including multiple pieces of information on the MDC
(initiatorId, endpointId and stageIds, and timings and sizes), so that it hopefully is easy to reason about and debug
all Mats flows, and to be able to use the logging system (e.g. Kibana over ElasticSearch) to create statistics.
Two loggers are used, which are
"io.mats3.log.init"
and "io.mats3.log.stage"
.
All loglines' message-part is prepended with "#MATSLOG#"
.
Log lines and their metadata
There are 5 different type of log lines emitted by this logging interceptor - but note that the "Per Message" log line can be combined with the "Initiate Complete" or "Stage Complete" loglines if the initiation or stage only produce a single message - read more at end.- Initiate Complete
- Message Received (on Stage)
- Stage Complete
- Per Created/Sent message (both for initiations and stage produced messages)
- Metrics set from the user lambda during initiation and stages
"mats.AppName"
: The app-name which the MatsFactory was created with"mats.AppVersion"
: The app-version which the MatsFactory was created with- Either, or both, of
"mats.Init"
(set to 'true' on initiation enter, and cleared on exit) and"mats.Stage"
(set fixed to 'true' for all Mats Stage processors). If initiation within a stage, both are set. "mats.CallNo"
: The "Call Number", which starts at 0 for the initiation, and then 1 for first stage processing. (It refers to the "calls", i.e. passed messages.)- For Stage processors:
"mats.StageId"
: Set fixed to the stageId for all Mats Stage processors. - For Stage processors:
"mats.StageIndex"
: Set fixed to the stage index for all Mats Stage processors - '0' for the initial Stage, '1' for stage1 etc.
MDC Properties for Initiate Complete:
Notice: Initiate Complete is rather similar to Stage Complete."mats.InitiateCompleted"
: Present on a single logline per completed initiation - can be used to count initiations. The value is same as"mats.exec.Total.ms"
, see Metrics below. Assuming each initiation produces one message, and hence one flow, this count should be identical to the count ofMDC_MATS_FLOW_COMPLETED
. However, an initiation can produce multiple messages (or zero), as described inMDC_MATS_COMPLETE_QUANTITY_OUT
, thus if you sum the quantity value of lines that have this property set, the result should actually be identical to flows completed."mats.InitOrStageId"
: The initiatorId ("fromId") from the first (typically sole) message in an initiation. It should be common that all messages in a single initiation have the same initiatorId. If there are no sent messages, the value for an initiation will be"_no_outgoing_messages_"
. This property is also set on the sent messages. For an initiation, this will be identical to"mats.init.Id"
, see below."traceId"
: (Flow prop) Set for an initiation from when it is set in the user code performing the initiation (reset to whatever it was upon exit of initiation lambda)"mats.init.App"
: (Flow prop) For an initiation, this is the current app, so identical to"mats.AppName"
."mats.init.Id"
: (Flow prop) For an initiation, this will be identical to"mats.InitOrStageId"
, see above."mats.Interactive"
: (Flow prop) This will be the value of the interactive flag of the first (typically sole) message of an initiation. It should be common that all messages in a single initiation have the same value. If there are no sent messages, the value for an initiation will befalse
.
"mats.Version"
: Mats implementation version, as gotten byMatsFactory.FactoryConfig.getMatsImplementationVersion()
."mats.exec.Total.ms"
: Total time taken for the initiation to complete - including both user code and all system code including commits. The same value is present on"mats.InitiateCompleted"
, see above."mats.exec.UserLambda.ms"
: Part of total time taken for the actual user lambda, including e.g. any external IO like DB, but excluding all system code, in particular message creation, and commits."mats.exec.Out.ms"
: Part of total time taken for the creation and serialization of Mats messages, and production and sending of "message system messages" (e.g. creating and populating JMS Message plusjmsProducer.send(..)
for the JMS implementation)."mats.exec.Out.quantity"
: Number of messages sent in this initiation. Should most often be 1, but can be multiple, and also zero."mats.exec.Out.TotalWire.bytes"
: The sum ofMDC_MATS_OUT_SIZE_TOTAL_WIRE
for all messages sent in this initiation."mats.exec.DbCommit.ms"
: Part of total time taken for committing DB."mats.exec.MsgSysCommit.ms"
: Part of total time taken for committing the message system (e.g.jmsSession.commit()
for the JMS implementation)
"mats.exec.ops.time."
+{metricId}+".ms"
and for measurements
"mats.exec.ops.measure."
+{metricId} + '.' + {baseUnit}
. If
labels/tags are set on a metric, the MDC-key will be {metric MDC-key} + ".tag." + {labelKey}
. The name
of the constructed metric MDC-key is made available as value of the MDC-key "mats.exec.ops.key"
, this so that the metrics keys employed can be found more easily by searching for this static
key (Elastic have no easy way to find key names in an index using the query language itself). The description of the
metric is available under the MDC-key "mats.exec.ops.description"
.MDC Properties for Message Received:
"mats.MessageReceived"
: Present on a single logline per received message - can be used to count received messages. This count should be identical to the count ofMDC_MATS_STAGE_COMPLETED
. The value is the same as"mats.in.TotalPreprocDeserial.ms"
, see Metrics below."mats.StageId"
: Always set on the Processor threads for a stage, so any logline output inside a Mats stage will have this set."traceId"
: The Mats flow's traceId, set from the initiation."mats.in.MsgSysId"
: The messageId the messaging system assigned the message when it was produced on the sender side (e.g JMSMessageID for the JMS implementation)"mats.in.MatsMsgId"
: The messageId the Mats system assigned the message when it was produced on the sender side. Note that it consists of the Mats flow id + an individual part per message in the flow."mats.in.MessageType"
: TheMessageType
of the incoming message, for example "SEND", "REQUEST" or "REPLY"."mats.in.from.App"
: Which app this incoming message is from."mats.in.from.Id"
: Which initiatorId, endpointId or stageId this message is from.- NOTICE: NOT using
"mats.in.to.app"
, as that is "this" App, and thus identical to"mats.AppName"
. - NOTICE: NOT using
"mats.in.to.id"
, as that is "this" StageId, and thus identical to"mats.StageId"
.
"mats.init.App"
: Which App initiated this Mats flow."mats.init.Id"
: The initiatorId of this MatsFlow;matsInitiate.from(initiatorId)
."mats.Audit"
: Whether this Mats flow should be audited."mats.Interactive"
: Whether this Mats flow should be treated as "interactive", meaning that a human is actively waiting for its execution."mats.Persistent"
: Whether the messaging system should use persistent (as opposed to non-persistent) message passing, i.e. store to disk to survive a crash.
"mats.in.SinceSent.ms"
: Time taken from message was sent to it was received. This metric gives the queue time, plus any other latency wrt. sending and committing on the sending side and the transfer and reception on the receiving side.This metric is susceptible to time skews between nodes."mats.in.PrecedEpStage.ms"
: Time taken from the sending of a message from the Stage immediately preceding this Stage on the same Endpoint, to the reception of a message on this Stage, i.e. the time between stages of an Endpoint (but also between an Initiation REQUEST and the replyTo-reception on the Terminator). This timing includes queue times and processing times of requested endpoints happening in between the send and the receive, as well as any other latencies. For example, it is the time between when EndpointA.Stage2 performs a REQUEST to AnotherEndpointB, till the REPLY from that endpoint is received on EndpointA.Stage3 (There might be dozens of message passing and processings in between those two stages of the same endpoint, as AnotherEndpointB might itself have a dozen stages, each performing some requests to yet other endpoints). This metric is susceptible to time skews between nodes."mats.in.TotalPreprocDeserial.ms"
: Total time taken to preprocess and deserialize the incoming message. The same value is present on"mats.MessageReceived"
, see above."mats.in.MsgSysDeconstruct.ms"
: Part of total time taken to pick out the Mats pieces from the incoming message system message."mats.in.EnvelopeWire.bytes"
: How big the incoming Mats envelope ("MatsTrace") was in the incoming message system message, i.e. "on the wire"."mats.in.EnvelopeDecompress.ms"
: Part of total time taken to decompress the Mats envelope (will be 0 if it was sent plain, and > 0 if it was compressed)."mats.in.EnvelopeSerial.bytes"
: How big the incoming Mats envelope ("MatsTrace") is in its serialized form, after decompression."mats.in.EnvelopeDeserial.ms"
: Part of total time taken to deserialize the incoming serialized Mats envelope."mats.in.DataAndStateDeserial.ms"
: Part of total time taken to deserialize the data and state objects (DTO and STO) from the Mats envelope."mats.in.TotalWire.bytes"
: Best approximation of the total message system wire size (envelope + sideloads + any meta info set on the message). The overhead of the message system itself will probably not be included."mats.in.StateSerial.bytes"
: The serialized size of the incoming state object (STO). If there is no incoming state,0
is returned - this is normal for initial stage of an endpoint, unless an initiation sets initialState. If the serializer employs Strings, the returned value isString.length()
, which might not exactly be the number of bytes depending on the String contents."mats.in.DataSerial.bytes"
: The serialized size of the incoming data object (DTO). Note thatnull
might not return0
bytes, depending on how the serializer works. If the serializer employs Strings, the returned value isString.length()
, which might not exactly be the number of bytes depending on the String contents.
MDC Properties for Stage Complete:
Notice: Stage Complete is rather similar to Initiate Complete."mats.StageCompleted"
: Present on a single logline per completed stage - can be used to count stage processings. This count should be identical to the count ofMDC_MATS_MESSAGE_RECEIVED
. The value is same as"mats.exec.Total.ms"
, see Metrics below."mats.StageId"
: Always set on the Processor threads for a stage, so any logline output inside a Mats stage will have this set."mats.ProcessResult"
: the ProcessResult enum"mats.InitOrStageId"
: The StageId for the completed stage, thus identical to "mats.StageId". The rationale for having this one more time is so that you can search for it across initiation complete and stage complete, using a common key, as they are rather similar processes. Note that it is also set on message sending."traceId"
: (Flow prop) The Mats flow's traceId, set from the initiation."mats.init.App"
: (Flow prop) The application that initiated this Mats Flow."mats.init.Id"
: (Flow prop) The initiatorId for this Mats Flow, i.e. the value ofmatsInitiate.from(initiatorId)
."mats.Interactive"
: (Flow prop) The value of the interactive flag for this Mats Flow.
"mats.Version"
: Same as for initiation."mats.exec.Total.ms"
: Total time taken for the stage to complete - including both user code and all system code including commits. The same value is present on"mats.StageCompleted"
, see above."mats.exec.TotalPreprocDeserial.ms"
: Part of the total time taken for the preprocessing and deserialization of the incoming message, same as the message received logline's"mats.in.TotalPreprocDeserial.ms"
, as that piece is also part of the stage processing."mats.exec.UserLambda.ms"
: Same as for initiation."mats.exec.Out.ms"
: Same as for initiation."mats.exec.Out.quantity"
: Same as for initiation."mats.exec.Out.TotalWire.bytes"
: Same as for initiation."mats.exec.DbCommit.ms"
: Same as for initiation."mats.exec.MsgSysCommit.ms"
: Same as for initiation
Extra Properties for Endpoint Complete:
When any Stage of an Endpoint (typically the last) either REPLYs, or stops the flow (neither sending a REQUEST, NEXT nor GOTO), the endpoint is completed."mats.EndpointCompleted"
: Present on the same single logline as Stage Completed if this also is the endpoint completion. Notice that the span from an initiation REQUEST to the replyTo-reception on a Terminator is also counted as a EndpointCompleted. The value is the time taken from entry on the initial stage of an endpoint, to stage completed on the final stage (or from Initiation REQUEST to replyTo-reception on the Terminator). This metric is susceptible to time skews between nodes.
Extra Properties for Flow Complete:
When a Stage doesn't send any REPLY, REQUEST, NEXT or GOTO, it stops the flow. This is the normal situation for a Terminator, but technically a flow may stop anywhere if the stage doesn't send a flow message."mats.FlowCompleted"
: Present on the same single logline as Stage Completed if this also is flow completion. can be used to count mats flows. This count has a very tight relationship withMDC_MATS_INITIATE_COMPLETED
, read above. The value is the time taken from the flow was initiated at aMatsInitiator
, or from within a flow, to it ends. This metric is susceptible to time skews between nodes.
MDC Properties for Per created Message (both initiations and stage produced messages):
"mats.MessageSent"
: Present on single logline per sent message - can be used to count sent messages. The value is the same as"mats.out.Total.ms"
, see below."mats.DispatchType"
: The DispatchType enum; INIT, STAGE, STAGE_INIT"mats.out.MatsMsgId"
: The messageId the Mats system gave the message. Note that it consists of the Mats flow id + an individual part per message in the flow."mats.out.MsgSysId"
: The messageId that the messaging system gave the message - for the JMS Implementation, it is the JMSMessageId.- NOTICE: NOT using "mats.out.from.app", as that is 'this' App, and thus identical to:
"mats.AppName"
. - NOTICE: NOT using "mats.out.from.Id", as that is identical to "mats.InitOrStageId".
"mats.InitOrStageId"
: "this" StageId or InitiatorId: Who created this message."mats.out.to.Id"
: target EndpointId/StageId- NOTICE: NOT using "mats.out.to.app", since we do not know which app will consume it.
"mats.init.App"
: Which App initiated this Mats flow."mats.init.Id"
: The initiatorId of this MatsFlow;matsInitiate.from(initiatorId)
."mats.Audit"
: Whether this Mats flow should be audited."mats.Interactive"
: Whether this Mats flow should be treated as "interactive", meaning that a human is actively waiting for its execution."mats.Persistent"
: Whether the messaging system should use persistent (as opposed to non-persistent) message passing, i.e. store to disk to survive a crash.
"mats.out.Total.ms"
: Total time taken to produce the message, all of the Mats envelope ("MatsTrace"), serializing, compressing and producing the message system message (sum of the below parts). The same value is present on"mats.MessageSent"
, see above."mats.out.EnvelopeProduce.ms"
: Part of the total time taken to produce the Mats envelope ("MatsTrace"), including serialization of all constituents: DTO, STO and any Trace Properties."mats.out.EnvelopeSerial.ms"
: Part of the total time taken to serialize the Mats envelope."mats.out.EnvelopeSerial.bytes"
: Size of the serialized Mats envelope."mats.out.EnvelopeCompress.ms"
: Part of the total time taken to compress the serialized Mats envelope"mats.out.EnvelopeWire.bytes"
: Size of the compressed serialized Mats envelope."mats.out.MsgSys.ms"
: Part of the total time taken to produce and send the message system message."mats.out.TotalWire.bytes"
: Best approximation of the total message system wire size (envelope + sideloads + any meta info set on the message). The overhead of the message system itself will probably not be included."mats.out.DataSerial.bytes"
: The serialized size of the outgoing data object (DTO). Note thatnull
might not return0
bytes, depending on how the serializer works. If the serializer employs Strings, the returned value isString.length()
, which might not exactly be the number of bytes depending on the String contents.- NOTICE: NOT using
"mats.out.StateSerial.bytes"
, as it felt confusing what any outgoing state relates to: It is not the target/receiving stage, as specified inMDC_MATS_OUT_TO_ID
. The outgoing state (if any) is a part of the stack, and relates to the next stage of the current endpoint. However, this metric is available on the incoming side, viaMDC_MATS_IN_SIZE_STATE_SERIAL
.
Trace Property
MatsInterceptable.MatsLoggingInterceptor.SUPPRESS_LOGGING_TRACE_PROPERTY_KEY
and the Endpoint Attribute
MatsInterceptable.MatsLoggingInterceptor.SUPPRESS_LOGGING_ENDPOINT_ALLOWS_ATTRIBUTE_KEY
. Number of suppressed log outputs per
matsFactoryName/initAppName/initiatorId/stageId will be logged every 30 minutes (stageId = "INIT" for initiations),
on the LOG_STAGE_NAME
logger. The first logging for each combo after logging the number of suppressions will
also be logged in full.
Note: This interceptor (SLF4J Logger with Metrics on MDC) has special support in JmsMatsFactory
: If
present on the classpath, it is automatically installed using the install(MatsInterceptable)
install
method. This interceptor implements the special marker-interface MatsInterceptable.MatsLoggingInterceptor
of which there
can only be one instance installed in a JmsMatsFactory
- implying that if you want a different type of
logging, you may implement a custom variant (either subclassing this, on your own risk, or start from scratch), and
simply install it, leading to this instance being removed (or just not have this variant on the classpath).-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface io.mats3.api.intercept.MatsInitiateInterceptor
MatsInitiateInterceptor.InitiateCompletedContext, MatsInitiateInterceptor.InitiateInterceptContext, MatsInitiateInterceptor.InitiateInterceptOutgoingMessagesContext, MatsInitiateInterceptor.InitiateInterceptUserLambdaContext, MatsInitiateInterceptor.InitiateStartedContext, MatsInitiateInterceptor.MatsInitiateInterceptOutgoingMessages, MatsInitiateInterceptor.MatsInitiateInterceptUserLambda
Nested classes/interfaces inherited from interface io.mats3.api.intercept.MatsStageInterceptor
MatsStageInterceptor.MatsStageInterceptOutgoingMessages, MatsStageInterceptor.MatsStageInterceptUserLambda, MatsStageInterceptor.StageCommonContext, MatsStageInterceptor.StageCompletedContext, MatsStageInterceptor.StageInterceptContext, MatsStageInterceptor.StageInterceptOutgoingMessageContext, MatsStageInterceptor.StageInterceptUserLambdaContext, MatsStageInterceptor.StagePreprocessAndDeserializeErrorContext, MatsStageInterceptor.StageReceivedContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ConcurrentHashMap<String,
AtomicInteger> static final MatsMetricsLoggingInterceptor
protected static final org.slf4j.Logger
static final String
static final String
protected static final org.slf4j.Logger
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final int
protected static final String
static final String
Fields inherited from interface io.mats3.api.intercept.MatsInterceptable.MatsLoggingInterceptor
SUPPRESS_LOGGING_ENDPOINT_ALLOWS_ATTRIBUTE_KEY, SUPPRESS_LOGGING_TRACE_PROPERTY_KEY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
commonStageAndInitiateCompleted
(CommonCompletedContext ctx, String matsVersion, String initOrStageId, String initiatingAppName, String initatorId, boolean interactive, String extraResult, org.slf4j.Logger logger, List<MatsOutgoingMessage.MatsSentOutgoingMessage> outgoingMessages, String messageSenderName, String extraBreakdown, long extraNanosBreakdown, Map<String, String> completedMDC) protected void
commonStageAndInitiateCompleted_inner
(CommonCompletedContext ctx, String matsVersion, String initOrStageId, String initiatingAppName, String initiatorId, boolean interactive, String logPrefix, String extraBreakdown, long extraNanosBreakdown, List<MatsOutgoingMessage.MatsSentOutgoingMessage> outgoingMessages, MatsMetricsLoggingInterceptor.Level level, org.slf4j.Logger log, Throwable t, String logPostfix, Map<String, String> completedMDC) void
static void
install
(MatsInterceptable matsInterceptableMatsFactory) Adds the singletonINSTANCE
as both Initiation and Stage interceptors.protected static double
ms
(long nanosTaken) Converts nanos to millis with a sane number of significant digits ("3.5" significant digits), but assuming that this is not used to measure things that take less than 0.001 milliseconds (in which case it will be "rounded" to 0.0001, 1e-4, as a special value).protected void
msgLog_AddMsgMdcs
(MatsOutgoingMessage.MatsSentOutgoingMessage msg, Runnable runnable) protected String
msgLog_CreateMsgLogLine
(String messageSenderName, MatsOutgoingMessage.MatsSentOutgoingMessage msg) protected static String
msS
(long nanosTake) protected void
outputMeasurementLogline
(org.slf4j.Logger logger, String what, String mdcPrefix, String metricId, String baseUnit, String measure, String metricDescription, String[] labelKeyValue) protected void
outputMeasurementsLoglines
(org.slf4j.Logger logger, CommonCompletedContext ctx) static void
remove
(MatsInterceptable matsInterceptableMatsFactory) Removes the singletonINSTANCE
as both Initiation and Stage interceptors.protected boolean
void
Invoked after the stage is fully completed, outgoing messages sent, db and messaging system committed.void
Invoked right after message have been received, preprocessed and deserialized, before invoking the user lambda.protected void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.mats3.api.intercept.MatsInitiateInterceptor
initiateStarted
Methods inherited from interface io.mats3.api.intercept.MatsStageInterceptor
stageCompletedNextDirect, stagePreprocessAndDeserializeError
-
Field Details
-
LOG_INIT_NAME
- See Also:
-
LOG_STAGE_NAME
- See Also:
-
NUMBER_OF_MILLIS_BETWEEN_SUPPRESSION_LOG
public static final int NUMBER_OF_MILLIS_BETWEEN_SUPPRESSION_LOG- See Also:
-
log_init
protected static final org.slf4j.Logger log_init -
log_stage
protected static final org.slf4j.Logger log_stage -
SUPPRESS_LOGGING_INTERCEPT_CONTEXT_ATTRIBUTE
- See Also:
-
LOG_PREFIX
- See Also:
-
SUPPRESSION_MDC_KEY_PARTS_SEPARATOR
- See Also:
-
MDC_TRACE_ID
- See Also:
-
INSTANCE
-
MDC_MATS_VERSION
- See Also:
-
MDC_INIT_OR_STAGE_ID
- See Also:
-
MDC_MATS_COMPLETE_TIME_TOTAL
- See Also:
-
MDC_MATS_COMPLETE_TIME_USER_LAMBDA
- See Also:
-
MDC_MATS_COMPLETE_TIME_OUT
- See Also:
-
MDC_MATS_COMPLETE_QUANTITY_OUT
- See Also:
-
MDC_MATS_COMPLETE_SIZE_OUT_TOTAL_WIRE
- See Also:
-
MDC_MATS_COMPLETE_TIME_DB_COMMIT
- See Also:
-
MDC_MATS_COMPLETE_TIME_MSGSYS_COMMIT
- See Also:
-
MDC_MATS_COMPLETE_OPS_KEYNAME
- See Also:
-
MDC_MATS_COMPLETE_OPS_DESCRIPTION
- See Also:
-
MDC_MATS_COMPLETE_OPS_TIMING_PREFIX
- See Also:
-
MDC_MATS_COMPLETE_OPS_MEASURE_PREFIX
- See Also:
-
MDC_MATS_INITIATE_COMPLETED
- See Also:
-
MDC_MATS_MESSAGE_RECEIVED
- See Also:
-
MDC_MATS_IN_FROM_APP_NAME
- See Also:
-
MDC_MATS_IN_FROM_ID
- See Also:
-
MDC_MATS_IN_MATS_MESSAGE_ID
- See Also:
-
MDC_MATS_IN_MESSAGE_TYPE
- See Also:
-
MDC_MATS_IN_TIME_SINCE_SENT
- See Also:
-
MDC_MATS_IN_TIME_SINCE_PRECEDING_ENDPOINT_STAGE
- See Also:
-
MDC_MATS_IN_SIZE_TOTAL_WIRE
- See Also:
-
MDC_MATS_IN_TIME_TOTAL_PREPROC_AND_DESERIAL
- See Also:
-
MDC_MATS_IN_TIME_MSGSYS_DECONSTRUCT
- See Also:
-
MDC_MATS_IN_SIZE_ENVELOPE_WIRE
- See Also:
-
MDC_MATS_IN_TIME_ENVELOPE_DECOMPRESS
- See Also:
-
MDC_MATS_IN_SIZE_ENVELOPE_SERIAL
- See Also:
-
MDC_MATS_IN_TIME_ENVELOPE_DESERIAL
- See Also:
-
MDC_MATS_IN_TIME_DATA_AND_STATE_DESERIAL
- See Also:
-
MDC_MATS_IN_SIZE_STATE_SERIAL
- See Also:
-
MDC_MATS_IN_SIZE_DATA_SERIAL
- See Also:
-
MDC_MATS_STAGE_COMPLETED
- See Also:
-
MDC_MATS_PROCESS_RESULT
- See Also:
-
MDC_MATS_COMPLETE_TIME_TOTAL_PREPROC_AND_DESERIAL
- See Also:
-
MDC_MATS_ENDPOINT_COMPLETED
- See Also:
-
MDC_MATS_ENDPOINT_COMPLETE_TIME_TOTAL
- See Also:
-
MDC_MATS_FLOW_COMPLETED
- See Also:
-
MDC_MATS_FLOW_COMPLETE_TIME_TOTAL
- See Also:
-
MDC_MATS_MESSAGE_SENT
- See Also:
-
MDC_MATS_DISPATCH_TYPE
- See Also:
-
MDC_MATS_OUT_MATS_MESSAGE_ID
- See Also:
-
MDC_MATS_OUT_MESSAGE_SYSTEM_ID
- See Also:
-
MDC_MATS_OUT_FROM_ID
- See Also:
-
MDC_MATS_OUT_TO_ID
- See Also:
-
MDC_MATS_OUT_TIME_TOTAL
- See Also:
-
MDC_MATS_OUT_SIZE_DATA_SERIAL
- See Also:
-
MDC_MATS_OUT_TIME_ENVELOPE_PRODUCE
- See Also:
-
MDC_MATS_OUT_TIME_ENVELOPE_SERIAL
- See Also:
-
MDC_MATS_OUT_SIZE_ENVELOPE_SERIAL
- See Also:
-
MDC_MATS_OUT_TIME_ENVELOPE_COMPRESS
- See Also:
-
MDC_MATS_OUT_SIZE_ENVELOPE_WIRE
- See Also:
-
MDC_MATS_OUT_SIZE_TOTAL_WIRE
- See Also:
-
MDC_MATS_OUT_TIME_MSGSYS
- See Also:
-
MDC_MATS_INIT_APP
- See Also:
-
MDC_MATS_INIT_ID
- See Also:
-
MDC_MATS_AUDIT
- See Also:
-
MDC_MATS_INTERACTIVE
- See Also:
-
MDC_MATS_PERSISTENT
- See Also:
-
_suppressions
-
-
Constructor Details
-
MatsMetricsLoggingInterceptor
protected MatsMetricsLoggingInterceptor()
-
-
Method Details
-
install
Adds the singletonINSTANCE
as both Initiation and Stage interceptors.- Parameters:
matsInterceptableMatsFactory
- theMatsInterceptable
MatsFactory to add it to.
-
remove
Removes the singletonINSTANCE
as both Initiation and Stage interceptors.- Parameters:
matsInterceptableMatsFactory
- theMatsInterceptable
to remove it from.
-
suppressionSummarizerThreadRunnable
protected void suppressionSummarizerThreadRunnable() -
initiateCompleted
- Specified by:
initiateCompleted
in interfaceMatsInitiateInterceptor
-
shouldSuppressStageLogging
-
stageReceived
Description copied from interface:MatsStageInterceptor
Invoked right after message have been received, preprocessed and deserialized, before invoking the user lambda. (If any error occurs during preprocess or deserialization, thenMatsStageInterceptor.stagePreprocessAndDeserializeError(StagePreprocessAndDeserializeErrorContext)
is invoked instead).- Specified by:
stageReceived
in interfaceMatsStageInterceptor
-
stageCompleted
Description copied from interface:MatsStageInterceptor
Invoked after the stage is fully completed, outgoing messages sent, db and messaging system committed. You cannot anymore modify any outgoing messages etc - for this, implementMatsStageInterceptor.MatsStageInterceptOutgoingMessages
.- Specified by:
stageCompleted
in interfaceMatsStageInterceptor
- See Also:
-
outputMeasurementsLoglines
-
outputMeasurementLogline
-
commonStageAndInitiateCompleted
protected void commonStageAndInitiateCompleted(CommonCompletedContext ctx, String matsVersion, String initOrStageId, String initiatingAppName, String initatorId, boolean interactive, String extraResult, org.slf4j.Logger logger, List<MatsOutgoingMessage.MatsSentOutgoingMessage> outgoingMessages, String messageSenderName, String extraBreakdown, long extraNanosBreakdown, Map<String, String> completedMDC) -
commonStageAndInitiateCompleted_inner
protected void commonStageAndInitiateCompleted_inner(CommonCompletedContext ctx, String matsVersion, String initOrStageId, String initiatingAppName, String initiatorId, boolean interactive, String logPrefix, String extraBreakdown, long extraNanosBreakdown, List<MatsOutgoingMessage.MatsSentOutgoingMessage> outgoingMessages, MatsMetricsLoggingInterceptor.Level level, org.slf4j.Logger log, Throwable t, String logPostfix, Map<String, String> completedMDC) -
msgLog_AddMsgMdcs
protected void msgLog_AddMsgMdcs(MatsOutgoingMessage.MatsSentOutgoingMessage msg, Runnable runnable) -
msgLog_CreateMsgLogLine
protected String msgLog_CreateMsgLogLine(String messageSenderName, MatsOutgoingMessage.MatsSentOutgoingMessage msg) -
msS
-
ms
protected static double ms(long nanosTaken) Converts nanos to millis with a sane number of significant digits ("3.5" significant digits), but assuming that this is not used to measure things that take less than 0.001 milliseconds (in which case it will be "rounded" to 0.0001, 1e-4, as a special value). Takes care of handling the difference between 0 and > 0 nanoseconds when rounding - in that 1 nanosecond will become 0.0001 (1e-4 ms, which if used to measure things that are really short lived might be magnitudes wrong), while 0 will be 0.0 exactly. Note that printing of a double always include the at least one decimal (unless scientific notation kicks in), which can lead your interpretation slightly astray wrt. accuracy/significant digits when running this over e.g. nanos 555_555_555, which will print as "556.0" (milliseconds), and 5_555_555_555 prints "5560.0".
-