public class

DefaultInstrumentationListenerManager

extends Object
implements InstrumentationListenerManager
java.lang.Object
   ↳ com.atlassian.jira.instrumentation.DefaultInstrumentationListenerManager

Class Overview

Processes instrumentation listeners.

Summary

Public Constructors
DefaultInstrumentationListenerManager(InstrumentationLogger instrumentationLogger, VCacheLifecycleManager vCacheLifecycleManager, JiraVCacheRequestContextSupplier contextSupplier, CacheManager cacheManager)
Public Methods
@NotNull void addRequestListener(RequestListener listener)
Add a listener
void applyToAllListeners(Consumer<RequestListener> apply)
Apply function to each listener.
static void endContext()
End of the context where we are not timing the execution.
static void endContext(Optional<Long> requestTime)
Called at the end of the request to flush to the currently selected persistence mechanism.
@Nonnull String getCurrentPath()
@Nonnull String getCurrentTraceId()
void processOnEndListeners(String path, String traceId, Optional<Long> requestTime)
Runs all the registered RequestListeners at the end of the Request processing.
void processOnStartListeners()
Run all the listeners at request start up.
@NotNull void removeRequestListener(RequestListener listener)
Remove a listener.
static void startContext(String path, String traceId, String spanId, String parentSpanId)
Called at the beginning of a request to handle the setup.
static void startContext(String path)
Called at the beginning of a request to handle the setup.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.instrumentation.InstrumentationListenerManager

Public Constructors

public DefaultInstrumentationListenerManager (InstrumentationLogger instrumentationLogger, VCacheLifecycleManager vCacheLifecycleManager, JiraVCacheRequestContextSupplier contextSupplier, CacheManager cacheManager)

Public Methods

@NotNull public void addRequestListener (RequestListener listener)

Add a listener

Parameters
listener The listener to add.

public void applyToAllListeners (Consumer<RequestListener> apply)

Apply function to each listener.

Parameters
apply Run a function on each listener.

public static void endContext ()

End of the context where we are not timing the execution.

public static void endContext (Optional<Long> requestTime)

Called at the end of the request to flush to the currently selected persistence mechanism. By default, 50 requests are stored in memory.

Parameters
requestTime An Optional that may contain the request time

@Nonnull public String getCurrentPath ()

@Nonnull public String getCurrentTraceId ()

public void processOnEndListeners (String path, String traceId, Optional<Long> requestTime)

Runs all the registered RequestListeners at the end of the Request processing.

Parameters
path The request path
traceId If the request has an X-B3-traceId header then we use this as the unique ID.
requestTime An @{link Optional} that may contain the request time.

public void processOnStartListeners ()

Run all the listeners at request start up.

@NotNull public void removeRequestListener (RequestListener listener)

Remove a listener.

Parameters
listener The listener to remove.

public static void startContext (String path, String traceId, String spanId, String parentSpanId)

Called at the beginning of a request to handle the setup.

Parameters
path An identifier for the request. This will be the path for HttpRequests and the thread name for threads.
traceId Pass in a traceId. If it is null, then we will generate our own.

public static void startContext (String path)

Called at the beginning of a request to handle the setup.

Parameters
path An identifier for the request. This will be the path for HttpRequests and the thread name for threads.