Class ApmServerConfigurationSource
- java.lang.Object
-
- org.stagemonitor.configuration.source.AbstractConfigurationSource
-
- co.elastic.apm.agent.configuration.ApmServerConfigurationSource
-
- All Implemented Interfaces:
LifecycleListener,org.stagemonitor.configuration.source.ConfigurationSource
public class ApmServerConfigurationSource extends org.stagemonitor.configuration.source.AbstractConfigurationSource implements LifecycleListener
-
-
Constructor Summary
Constructors Constructor Description ApmServerConfigurationSource(PayloadSerializer payloadSerializer, ApmServerClient apmServerClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetName()java.lang.StringgetValue(java.lang.String key)voidinit(ElasticApmTracer tracer)Callback for tracer initialization.voidpause()Callback for whenElasticApmTracer.pause()has been called.voidreload()We want to reload the configuration in intervals which are determined based on the Cache-Control header from the APM Server That's why we can't rely on the generalConfigurationRegistryscheduled reloadvoidresume()Callback for whenElasticApmTracer.resume()has been called.voidstart(ElasticApmTracer tracer)Callback for when theElasticApmTracerstarts.voidstop()Callback for whenElasticApmTracer.stop()has been called.
-
-
-
Constructor Detail
-
ApmServerConfigurationSource
public ApmServerConfigurationSource(PayloadSerializer payloadSerializer, ApmServerClient apmServerClient)
-
-
Method Detail
-
reload
public void reload()
We want to reload the configuration in intervals which are determined based on the Cache-Control header from the APM Server That's why we can't rely on the generalConfigurationRegistryscheduled reload- Specified by:
reloadin interfaceorg.stagemonitor.configuration.source.ConfigurationSource- Overrides:
reloadin classorg.stagemonitor.configuration.source.AbstractConfigurationSource
-
init
public void init(ElasticApmTracer tracer) throws java.lang.Exception
Description copied from interface:LifecycleListenerCallback for tracer initialization. As opposed toLifecycleListener.start(ElasticApmTracer), which may be called in a delay, this callback is called at the bootstrap of the JVM, before anything else start. This may be useful for listeners that need to operate very early on, for example such that setup class loading requirement to support OSGi systems.- Specified by:
initin interfaceLifecycleListener- Parameters:
tracer- the tracer- Throws:
java.lang.Exception
-
start
public void start(ElasticApmTracer tracer)
Description copied from interface:LifecycleListenerCallback for when theElasticApmTracerstarts.- Specified by:
startin interfaceLifecycleListener- Parameters:
tracer- The tracer.
-
getValue
public java.lang.String getValue(java.lang.String key)
- Specified by:
getValuein interfaceorg.stagemonitor.configuration.source.ConfigurationSource
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceorg.stagemonitor.configuration.source.ConfigurationSource
-
pause
public void pause()
Description copied from interface:LifecycleListenerCallback for whenElasticApmTracer.pause()has been called.Typically, this method is used to reduce overhead on the application to a minimum. This can be done by cleaning up resources like object pools, as well as by avoiding tracing-related overhead.
Exceptions thrown from this method are caught and handled so that they don't prevent further cleanup actions.
- Specified by:
pausein interfaceLifecycleListener
-
resume
public void resume()
Description copied from interface:LifecycleListenerCallback for whenElasticApmTracer.resume()has been called.Typically, used in order to revert the actions taken by the
LifecycleListener.pause()method, allowing the agent to restore all tracing capabilitiesExceptions thrown from this method are caught and handled so that they don't prevent further resume actions.
- Specified by:
resumein interfaceLifecycleListener
-
stop
public void stop()
Description copied from interface:LifecycleListenerCallback for whenElasticApmTracer.stop()has been called.Typically, this method is used to clean up resources like thread pools so that there are no class loader leaks when a webapp is redeployed in an application server.
Exceptions thrown from this method are caught and handled so that they don't prevent further cleanup actions.
The order of the shutdown process is as follows:
-
The
LifecycleListener.stop()method of all lifecycle listeners is called. The order in which lifecycle listeners are called is non-deterministic. -
The
ElasticApmTracer.getSharedSingleThreadedPool()is shut down gracefully, waiting a moment for the already scheduled tasks to be completed. This means that implementations of this method can schedule a last command to this pool that is executed before shutdown. TheTracer.getState()will still beTracer.TracerState.RUNNINGin the tasks scheduled toElasticApmTracer.getSharedSingleThreadedPool()within this method. -
The tracer state is set to
Tracer.TracerState.STOPPED. -
The
Reporteris closed.
- Specified by:
stopin interfaceLifecycleListener
-
The
-
-