Class MetricsRecorderServiceImpl
java.lang.Object
ch.tocco.nice2.metrics.impl.query.MetricsRecorderServiceImpl
- All Implemented Interfaces:
MetricsRecorderService
This is a threaded service so we can simply cache the
MetricsData
for the current thread.-
Constructor Summary
ConstructorsConstructorDescriptionMetricsRecorderServiceImpl(org.slf4j.Logger logger, SpyLoggerService spyLoggerService, SystemActivityService systemActivityService) -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidsetEnabled(boolean enabled) startRecording(ActivityType activityType, Supplier<String> name, Supplier<String> details, Supplier<CategoryData> categoryData) Start collecting metrics for the current thread.startRecording(ActivityType activityType, Supplier<String> name, Supplier<String> details, Supplier<CategoryData> categoryData, @Nullable String requestOrigin) voidvoidupdateCategoryOfActiveRecording(Supplier<CategoryData> categoryData) Change theCategoryDataof the currently active recordingvoidupdateExceptionOfActiveRecording(Exception exception) Update the exception of the currently active recording
-
Constructor Details
-
MetricsRecorderServiceImpl
public MetricsRecorderServiceImpl(org.slf4j.Logger logger, SpyLoggerService spyLoggerService, SystemActivityService systemActivityService)
-
-
Method Details
-
setEnabled
@Value("${nice2.metrics.enabled}") public void setEnabled(boolean enabled) -
startRecording
public MetricsData startRecording(ActivityType activityType, Supplier<String> name, Supplier<String> details, Supplier<CategoryData> categoryData) Description copied from interface:MetricsRecorderServiceStart collecting metrics for the current thread.MetricsData.close()must be called to stop the recording.- Specified by:
startRecordingin interfaceMetricsRecorderService
-
startRecording
public MetricsData startRecording(ActivityType activityType, Supplier<String> name, Supplier<String> details, Supplier<CategoryData> categoryData, @Nullable @Nullable String requestOrigin) - Specified by:
startRecordingin interfaceMetricsRecorderService
-
updateCategoryOfActiveRecording
Description copied from interface:MetricsRecorderServiceChange theCategoryDataof the currently active recording- Specified by:
updateCategoryOfActiveRecordingin interfaceMetricsRecorderService
-
updateExceptionOfActiveRecording
Description copied from interface:MetricsRecorderServiceUpdate the exception of the currently active recording- Specified by:
updateExceptionOfActiveRecordingin interfaceMetricsRecorderService
-
recordingInProgress
public boolean recordingInProgress()- Specified by:
recordingInProgressin interfaceMetricsRecorderService- Returns:
- true if metrics are already being collected for the current thread
-
threadDidDiscardService
@PreDestroy public void threadDidDiscardService()
-