@ParametersAreNonnullByDefault public class DefaultInstrumentationLogger extends Object implements InstrumentationLogger, InitializingComponent
| Modifier and Type | Field and Description |
|---|---|
protected static String |
JIRA_INSTRUMENTATION_LAAS_PROPERTY |
static String |
PARENT_SPAN_ID |
protected static String |
REQUEST_EXECUTION_TIME |
static String |
SPAN_ID |
| Constructor and Description |
|---|
DefaultInstrumentationLogger(JiraProperties jiraProperties,
FeatureManager featureManager,
com.atlassian.event.api.EventPublisher eventPublisher) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterInstantiation() |
protected void |
cleanMdc() |
void |
clearMemoryBuffer()
Clear all the data collected in the memory buffer.
|
protected String |
getJsonString(Optional<String> spanId,
Optional<String> parentSpanId,
LogEntry entry,
Optional<Long> requestTime,
Optional<Long> startNanoTime)
Generates the JSON string object that we can log.
|
List<LogEntry> |
getLogEntriesFromBuffer()
Fetch the current list of statistics stored in memory.
|
protected boolean |
isEnabled() |
void |
pluginFrameworkShuttingDown(com.atlassian.plugin.event.events.PluginFrameworkShuttingDownEvent pluginFrameworkShuttingDownEvent) |
void |
save(RequestData requestData,
List<? extends Statistics> requestStats,
Optional<Long> requestTime)
Saves request data to the queue above.
|
void |
save(RequestData requestData,
List<? extends Statistics> requestStats,
Optional<Long> requestTime,
Exception exception)
Saves request data to the queue above and generates a stacktrace that it inserts in the log.
|
void |
save(String traceId,
String path,
List<? extends Statistics> requestStats,
Optional<Long> requestTime)
Saves request data to the queue above.
|
protected static final String REQUEST_EXECUTION_TIME
protected static final String JIRA_INSTRUMENTATION_LAAS_PROPERTY
public static final String SPAN_ID
public static final String PARENT_SPAN_ID
public DefaultInstrumentationLogger(JiraProperties jiraProperties, FeatureManager featureManager, com.atlassian.event.api.EventPublisher eventPublisher)
public void afterInstantiation()
throws Exception
afterInstantiation in interface InitializingComponentException@EventListener public void pluginFrameworkShuttingDown(com.atlassian.plugin.event.events.PluginFrameworkShuttingDownEvent pluginFrameworkShuttingDownEvent)
public void save(String traceId, String path, List<? extends Statistics> requestStats, Optional<Long> requestTime)
InstrumentationLoggersave in interface InstrumentationLoggertraceId - The ID for this request.path - the path of the URL.requestStats - The list of cache statistics.requestTime - The time in nanoseconds that the request took to complete.public void save(RequestData requestData, List<? extends Statistics> requestStats, Optional<Long> requestTime)
InstrumentationLoggersave in interface InstrumentationLoggerrequestData - data associated with the request.requestStats - The list of cache statistics.requestTime - The time of the request in nanoseconds. If zero, we did not collect any time.public void save(RequestData requestData, List<? extends Statistics> requestStats, Optional<Long> requestTime, @Nullable Exception exception)
InstrumentationLoggersave in interface InstrumentationLoggerrequestData - data associated with the request.requestStats - The list of cache statistics.requestTime - The time of the request in nanoseconds. If zero, we did not collect any time.exception - An exception to be included with the log. This can be used if you require a stack trace to be
recorded.protected String getJsonString(Optional<String> spanId, Optional<String> parentSpanId, LogEntry entry, Optional<Long> requestTime, Optional<Long> startNanoTime)
spanId - The Zipkin spanId (if there is one, null otherwiseparentSpanId - The Zipkin parent spanId (if there is on, null otherwise).entry - The LogEntry datarequestTime - An Optional that may contain the total request time in nanoseconds if applicable.protected void cleanMdc()
public List<LogEntry> getLogEntriesFromBuffer()
InstrumentationLoggergetLogEntriesFromBuffer in interface InstrumentationLoggerpublic void clearMemoryBuffer()
InstrumentationLoggerclearMemoryBuffer in interface InstrumentationLoggerprotected boolean isEnabled()
Copyright © 2002-2019 Atlassian. All Rights Reserved.