Package io.vertigo.core.impl.analytics
Class AnalyticsManagerImpl
- java.lang.Object
-
- io.vertigo.core.impl.analytics.AnalyticsManagerImpl
-
- All Implemented Interfaces:
AnalyticsManager
,Component
,CoreComponent
,Manager
,DefinitionProvider
,SimpleDefinitionProvider
public final class AnalyticsManagerImpl extends Object implements AnalyticsManager, SimpleDefinitionProvider
Main analytics manager implementation.- Author:
- pchretien
-
-
Constructor Summary
Constructors Constructor Description AnalyticsManagerImpl(List<AnalyticsConnectorPlugin> processConnectorPlugins)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProcess(AProcess process)
Adds an already built AProcess (via the builder) for tracking process that are not executed in a single thread environnement.HealthStatus
aggregate(List<HealthCheck> healthChecks)
Generates an aggregated status from a list of health checks.Optional<ProcessAnalyticsTracer>
getCurrentTracer()
List<HealthCheck>
getHealthChecks()
List<Metric>
getMetrics()
List<? extends Definition>
provideDefinitions(DefinitionSpace definitionSpace)
Provide definitions to be registered in the definitionSpacevoid
sendHealthChecks()
Daemon to retrieve healthChecks and add them to the connectorsvoid
sendMetrics()
Daemon to retrieve metrics and add them to the connectorsvoid
trace(String category, String name, Consumer<ProcessAnalyticsTracer> consumer)
Traces a process and collects metrics during its execution.<O> O
traceWithReturn(String category, String name, Function<ProcessAnalyticsTracer,O> function)
Traces a process that has a return value (and collects metrics during its execution).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.vertigo.core.node.definition.DefinitionProvider
addDefinitionResourceConfig
-
Methods inherited from interface io.vertigo.core.node.definition.SimpleDefinitionProvider
get
-
-
-
-
Constructor Detail
-
AnalyticsManagerImpl
@Inject public AnalyticsManagerImpl(List<AnalyticsConnectorPlugin> processConnectorPlugins)
Constructor.- Parameters:
processConnectorPlugins
- list of connectors to trace processes
-
-
Method Detail
-
provideDefinitions
public List<? extends Definition> provideDefinitions(DefinitionSpace definitionSpace)
Description copied from interface:SimpleDefinitionProvider
Provide definitions to be registered in the definitionSpace- Specified by:
provideDefinitions
in interfaceSimpleDefinitionProvider
- Parameters:
definitionSpace
- the actual definitionSpace- Returns:
- the list of new definition to register
-
trace
public void trace(String category, String name, Consumer<ProcessAnalyticsTracer> consumer)
Traces a process and collects metrics during its execution. A traced process is stored by categories.- Specified by:
trace
in interfaceAnalyticsManager
- Parameters:
category
- the category of the processname
- the name of the processconsumer
- the function to execute within the tracer
-
traceWithReturn
public <O> O traceWithReturn(String category, String name, Function<ProcessAnalyticsTracer,O> function)
Traces a process that has a return value (and collects metrics during its execution). A traced process is stored by categories.- Specified by:
traceWithReturn
in interfaceAnalyticsManager
- Parameters:
category
- the category of the processname
- the name of the processfunction
- the function to execute within the tracer- Returns:
- the result of the traced function
-
addProcess
public void addProcess(AProcess process)
Adds an already built AProcess (via the builder) for tracking process that are not executed in a single thread environnement. Prefer the use of method trace and traceWithReturn for commons cases (easier)- Specified by:
addProcess
in interfaceAnalyticsManager
- Parameters:
process
- the built process
-
getCurrentTracer
public Optional<ProcessAnalyticsTracer> getCurrentTracer()
- Specified by:
getCurrentTracer
in interfaceAnalyticsManager
- Returns:
- the current tracer if it has been created before
-
sendHealthChecks
public void sendHealthChecks()
Daemon to retrieve healthChecks and add them to the connectors
-
getHealthChecks
public List<HealthCheck> getHealthChecks()
- Specified by:
getHealthChecks
in interfaceAnalyticsManager
- Returns:
- the list of health checks
-
aggregate
public HealthStatus aggregate(List<HealthCheck> healthChecks)
Description copied from interface:AnalyticsManager
Generates an aggregated status from a list of health checks.- Specified by:
aggregate
in interfaceAnalyticsManager
- Parameters:
healthChecks
- the list of halth checks.- Returns:
- the global health status
-
sendMetrics
public void sendMetrics()
Daemon to retrieve metrics and add them to the connectors
-
getMetrics
public List<Metric> getMetrics()
- Specified by:
getMetrics
in interfaceAnalyticsManager
- Returns:
- the list of metrics
-
-