Currently, i have 2 custom spring artefacts- metrics-util
and web-utils
. metrics-util contains all the functions related to measuring the metrics such as a web-filter to calculate the metrics of all rest controller. Web-utils uses some functions from metrics-util to measure the metrics inside the function.
My main spring program calls web-utils functions within it. And i am using same name with different tags. The issue i am facing is i can see the metrics and the different tags at /actuator/metrics/{metric_name}
but only the first instance of metric name is being displayed at the endpoint where Prometheus scrapes.
Micrometer version:
implementation 'io.micrometer:micrometer-core:1.12.3'
implementation 'io.micrometer:micrometer-registry-prometheus:1.12.3'
My config for registry:
@Configuration
@ComponentScan(basePackages = ["co.hyperface.ark.metricsutil.*"])
class BaseMetricsConfig {
@Bean
MeterRegistry meterRegistry() {
return new PrometheusMeterRegistry(PrometheusConfig.DEFAULT)
}
}
How im injecting in my program:
class MetricsUtil {
private MeterRegistry meterRegistry
@Autowired
MetricsUtil (MeterRegistry meterRegistry) {
this.meterRegistry = meterRegistry
}
}
Expected result:
For any endpoint, web-filter gets activated first so its callcount{call_type='rest_controller'}
must increase then since im calling web-utils function inside that controller, the calls callcount{call_type='external'}
must be increased.
But at the scraping endpoint im getting only callcount{call_type='rest_controller'}
. but im able to see both of them at /actuator/metrics/callcount