Skip to content

Commit

Permalink
Made code reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
mamartinezmejia committed Sep 26, 2024
1 parent e74f80f commit 7304409
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* MetricConfiguration sets up custom metrics and configuration for the application's meter
* registry using Micrometer.
*

Check warning on line 17 in src/main/java/ca/bc/gov/api/oracle/legacy/configuration/MetricConfiguration.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck

Empty line should be followed by <p> tag on the next line.
* It applies common tags to all metrics, configures percentile distribution statistics,
* and manages Prometheus meter registry configuration. This class also provides a
* {@link TimedAspect} bean to support @Timed annotations for methods.
*/
@Configuration
public class MetricConfiguration {

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

/**
* Creates a {@link TimedAspect} bean for timing method executions using the @Timed annotation.
*
* @param registry the {@link MeterRegistry} to register the aspect with.
* @return a {@link TimedAspect} configured to record method execution times.
*/
@Bean
public TimedAspect timedAspect(MeterRegistry registry) {
return new TimedAspect(registry);
}

/**
* Adds common tags like version, app name, and zone to all metrics registered with the
* {@link MeterRegistry}.
*
* @return a {@link MeterRegistryCustomizer} to configure common tags and filters for metrics.
*/
@Bean
public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
return registry -> registry.config()
Expand All @@ -40,15 +60,31 @@ public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
.meterFilter(distribution());
}

/**
* Configures the {@link PrometheusMeterRegistry} for use with Prometheus metrics.
*
* @return a {@link MeterRegistryCustomizer} for Prometheus meter registry configuration.
*/
@Bean
public MeterRegistryCustomizer<PrometheusMeterRegistry> prometheusConfiguration() {
return MeterRegistry::config;
}

/**
* Creates a meter filter that ignores the "type" tag in all registered metrics.
*
* @return a {@link MeterFilter} that ignores the "type" tag.
*/
public MeterFilter ignoreTag() {
return MeterFilter.ignoreTags("type");
}

/**
* Configures a meter filter to enable percentile histograms and track percentiles (0.5, 0.95,
* 0.99) for distribution statistics.
*
* @return a {@link MeterFilter} that configures percentile statistics and enables histograms.
*/
public MeterFilter distribution() {
return new MeterFilter() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public Mono<ClientPublicViewDto> findByClientNumber(
*/
@GetMapping("/findByClientNumberOrName/{clientNumberOrName}")
@Operation(
summary = "Search clients by client number or client name."
+ " It will return active and inactive",
summary = "Search clients by client number or client name."
+ " It will return active and inactive",
responses = {
@ApiResponse(
responseCode = "200",
Expand Down

0 comments on commit 7304409

Please sign in to comment.