Class LocalStatsMatsInterceptor

java.lang.Object
io.mats3.localinspect.LocalStatsMatsInterceptor
All Implemented Interfaces:
MatsInitiateInterceptor, MatsInitiateInterceptor.MatsInitiateInterceptOutgoingMessages, MatsStageInterceptor, MatsStageInterceptor.MatsStageInterceptOutgoingMessages

Interceptor that collects "local stats" for Initiators and Stages of Endpoints, which can be used in conjunction with a MatsFactory report generator, LocalHtmlInspectForMatsFactory.

To install, invoke the install(MatsInterceptable) method, supplying the MatsFactory. The report generator will fetch the interceptor from the MatsFactory.

Implementation note: Mats allows Initiators and Endpoints to be defined "runtime" - there is no specific setup time vs. run time. This implies that the set of Endpoints and Initiators in a MatsFactory can increase from one run of a report generation to the next (Endpoint may even be deleted, but this is really only meant for testing). Moreover, this stats collecting class only collects stats for Initiators and Endpoints that have had traffic, since it relies on the interceptors API. This means that while the MatsFactory might know about an Initiator or an Endpoint, this stats class might not yet have picked it up. This is why all methods return Optional. On the other hand, the set of Stages of an endpoint cannot change after it has been finishedSetup() (and it cannot be start()'ed before it has been finishedSetup()) - thus if e.g. only the initial stage of an Endpoint has so far seen traffic, this class has nevertheless created stats objects for all of the Endpoint's stages.