private Optional < DurationThresholdTracker > requestDurationThresholdTracker ( MetricId id , String endpoint ) { return durationThresholdConfig . getDurationThresholdForEndpoint ( endpoint ) . map ( threshold -> Optional . of ( new DurationThresholdTracker ( id , metricRegistry , threshold ) ) ) . orElse ( Optional . empty ( ) ) ; }
Checks for endpoint - duration - goal configuration options and sets up metrics that track how many requests meet a certain duration threshold goal .