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 voidaddProcess(AProcess process)Adds an already built AProcess (via the builder) for tracking process that are not executed in a single thread environnement.HealthStatusaggregate(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 definitionSpacevoidsendHealthChecks()Daemon to retrieve healthChecks and add them to the connectorsvoidsendMetrics()Daemon to retrieve metrics and add them to the connectorsvoidtrace(String category, String name, Consumer<ProcessAnalyticsTracer> consumer)Traces a process and collects metrics during its execution.<O> OtraceWithReturn(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:SimpleDefinitionProviderProvide definitions to be registered in the definitionSpace- Specified by:
provideDefinitionsin 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:
tracein 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:
traceWithReturnin 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:
addProcessin interfaceAnalyticsManager- Parameters:
process- the built process
-
getCurrentTracer
public Optional<ProcessAnalyticsTracer> getCurrentTracer()
- Specified by:
getCurrentTracerin 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:
getHealthChecksin interfaceAnalyticsManager- Returns:
- the list of health checks
-
aggregate
public HealthStatus aggregate(List<HealthCheck> healthChecks)
Description copied from interface:AnalyticsManagerGenerates an aggregated status from a list of health checks.- Specified by:
aggregatein 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:
getMetricsin interfaceAnalyticsManager- Returns:
- the list of metrics
-
-