Skip to content

Commit 7304409

Browse files
Made code reviews
1 parent e74f80f commit 7304409

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

src/main/java/ca/bc/gov/api/oracle/legacy/configuration/MetricConfiguration.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
import org.springframework.context.annotation.Bean;
1212
import org.springframework.context.annotation.Configuration;
1313

14+
/**
15+
* MetricConfiguration sets up custom metrics and configuration for the application's meter
16+
* registry using Micrometer.
17+
*
18+
* It applies common tags to all metrics, configures percentile distribution statistics,
19+
* and manages Prometheus meter registry configuration. This class also provides a
20+
* {@link TimedAspect} bean to support @Timed annotations for methods.
21+
*/
1422
@Configuration
1523
public class MetricConfiguration {
1624

@@ -23,11 +31,23 @@ public class MetricConfiguration {
2331
@Value("${info.app.zone}")
2432
private String appZone;
2533

34+
/**
35+
* Creates a {@link TimedAspect} bean for timing method executions using the @Timed annotation.
36+
*
37+
* @param registry the {@link MeterRegistry} to register the aspect with.
38+
* @return a {@link TimedAspect} configured to record method execution times.
39+
*/
2640
@Bean
2741
public TimedAspect timedAspect(MeterRegistry registry) {
2842
return new TimedAspect(registry);
2943
}
3044

45+
/**
46+
* Adds common tags like version, app name, and zone to all metrics registered with the
47+
* {@link MeterRegistry}.
48+
*
49+
* @return a {@link MeterRegistryCustomizer} to configure common tags and filters for metrics.
50+
*/
3151
@Bean
3252
public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
3353
return registry -> registry.config()
@@ -40,15 +60,31 @@ public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
4060
.meterFilter(distribution());
4161
}
4262

63+
/**
64+
* Configures the {@link PrometheusMeterRegistry} for use with Prometheus metrics.
65+
*
66+
* @return a {@link MeterRegistryCustomizer} for Prometheus meter registry configuration.
67+
*/
4368
@Bean
4469
public MeterRegistryCustomizer<PrometheusMeterRegistry> prometheusConfiguration() {
4570
return MeterRegistry::config;
4671
}
4772

73+
/**
74+
* Creates a meter filter that ignores the "type" tag in all registered metrics.
75+
*
76+
* @return a {@link MeterFilter} that ignores the "type" tag.
77+
*/
4878
public MeterFilter ignoreTag() {
4979
return MeterFilter.ignoreTags("type");
5080
}
5181

82+
/**
83+
* Configures a meter filter to enable percentile histograms and track percentiles (0.5, 0.95,
84+
* 0.99) for distribution statistics.
85+
*
86+
* @return a {@link MeterFilter} that configures percentile statistics and enables histograms.
87+
*/
5288
public MeterFilter distribution() {
5389
return new MeterFilter() {
5490

src/main/java/ca/bc/gov/api/oracle/legacy/controller/ClientController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ public Mono<ClientPublicViewDto> findByClientNumber(
105105
*/
106106
@GetMapping("/findByClientNumberOrName/{clientNumberOrName}")
107107
@Operation(
108-
summary = "Search clients by client number or client name."
109-
+ " It will return active and inactive",
108+
summary = "Search clients by client number or client name."
109+
+ " It will return active and inactive",
110110
responses = {
111111
@ApiResponse(
112112
responseCode = "200",

0 commit comments

Comments
 (0)