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 SummaryConstructorsConstructorDescriptionMetricsRecorderServiceImpl(org.slf4j.Logger logger, SpyLoggerService spyLoggerService, SystemActivityService systemActivityService) 
- 
Method SummaryModifier 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- 
MetricsRecorderServiceImplpublic MetricsRecorderServiceImpl(org.slf4j.Logger logger, SpyLoggerService spyLoggerService, SystemActivityService systemActivityService) 
 
- 
- 
Method Details- 
setEnabled@Value("${nice2.metrics.enabled}") public void setEnabled(boolean enabled) 
- 
startRecordingpublic 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 interface- MetricsRecorderService
 
- 
startRecordingpublic MetricsData startRecording(ActivityType activityType, Supplier<String> name, Supplier<String> details, Supplier<CategoryData> categoryData, @Nullable @Nullable String requestOrigin) - Specified by:
- startRecordingin interface- MetricsRecorderService
 
- 
updateCategoryOfActiveRecordingDescription copied from interface:MetricsRecorderServiceChange theCategoryDataof the currently active recording- Specified by:
- updateCategoryOfActiveRecordingin interface- MetricsRecorderService
 
- 
updateExceptionOfActiveRecordingDescription copied from interface:MetricsRecorderServiceUpdate the exception of the currently active recording- Specified by:
- updateExceptionOfActiveRecordingin interface- MetricsRecorderService
 
- 
recordingInProgresspublic boolean recordingInProgress()- Specified by:
- recordingInProgressin interface- MetricsRecorderService
- Returns:
- true if metrics are already being collected for the current thread
 
- 
threadDidDiscardService@PreDestroy public void threadDidDiscardService()
 
-