@ParametersAreNonnullByDefault public class

DefaultInstrumentationLogger

extends Object
implements FeatureFlagProvider InstrumentationLogger
java.lang.Object
   ↳ com.atlassian.jira.instrumentation.DefaultInstrumentationLogger

Class Overview

Logs the instrumentation data that we have collected to various collection mechanisms.

Summary

Constants
String JIRA_INSTRUMENTATION_LAAS
String PARENT_SPAN_ID
String REQUEST_EXECUTION_TIME
String SPAN_ID
Public Constructors
DefaultInstrumentationLogger(JiraProperties jiraProperties, FeatureManager featureManager)
Public Methods
void clearMemoryBuffer()
Clear all the data collected in the memory buffer.
Set<FeatureFlag> getFeatureFlags()
List<LogEntry> getLogEntriesFromBuffer()
Fetch the current list of statistics stored in memory.
void save(String traceId, Optional<String> spanId, Optional<String> parentSpanId, String path, List<? extends Statistics> requestData, Optional<Long> requestTime)
Saves request data to the queue above.
void save(String traceId, String path, List<? extends Statistics> requestData, Optional<Long> requestTime)
Saves request data to the queue above.
Protected Methods
void cleanMdc()
String getJsonString(Optional<String> spanId, Optional<String> parentSpanId, LogEntry entry, Optional<Long> requestTime)
Generates the JSON string object that we can log.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.config.FeatureFlagProvider
From interface com.atlassian.jira.instrumentation.InstrumentationLogger

Constants

protected static final String JIRA_INSTRUMENTATION_LAAS

Constant Value: "jira.instrumentation.laas"

public static final String PARENT_SPAN_ID

Constant Value: "parentSpanId"

protected static final String REQUEST_EXECUTION_TIME

Constant Value: "requestExecutionTime"

public static final String SPAN_ID

Constant Value: "spanId"

Public Constructors

public DefaultInstrumentationLogger (JiraProperties jiraProperties, FeatureManager featureManager)

Public Methods

public void clearMemoryBuffer ()

Clear all the data collected in the memory buffer.

public Set<FeatureFlag> getFeatureFlags ()

public List<LogEntry> getLogEntriesFromBuffer ()

Fetch the current list of statistics stored in memory.

Returns
  • A copy of the current list.

public void save (String traceId, Optional<String> spanId, Optional<String> parentSpanId, String path, List<? extends Statistics> requestData, Optional<Long> requestTime)

Saves request data to the queue above. The queue will store the last 100 requests by default. As new requests are received the oldest are removed.

Parameters
traceId The ID for this request.
spanId The Zipkin spanId from the request
parentSpanId The Zipkin parent span Id for the request
path the path of the URL.
requestData The list of cache statistics.
requestTime The time of the request in nanoseconds. If zero, we did not collect any time.

public void save (String traceId, String path, List<? extends Statistics> requestData, Optional<Long> requestTime)

Saves request data to the queue above. The queue will store the last 100 requests by default. As new requests are received the oldest are removed.

Parameters
traceId The ID for this request.
path the path of the URL.
requestData The list of cache statistics.
requestTime The time in nanoseconds that the request took to complete.

Protected Methods

protected void cleanMdc ()

protected String getJsonString (Optional<String> spanId, Optional<String> parentSpanId, LogEntry entry, Optional<Long> requestTime)

Generates the JSON string object that we can log.

Parameters
spanId The Zipkin spanId (if there is one, null otherwise
parentSpanId The Zipkin parent spanId (if there is on, null otherwise).
entry The LogEntry data
requestTime An Optional that may contain the total request time in nanoseconds if applicable.
Returns
  • The JSON object as a string.