spring-metrics-grabber publish metrics with value on single endpoint '/metricx'
$ ./gradlew clean build
- Add dependency in you application from local repository
compile("org.springframework.boot:spring-metrics-grabber:1.0.0-SNAPSHOT");
compile("org.springframework.boot:spring-boot-starter-actuator");
- Add
MetricxEndpoint.class
to@SpringBootApplication
scan path
import org.springframework.metricx.controller.MetricxEndpoint;
@SpringBootApplication(scanBasePackageClasses = { MetricxEndpoint.class, YourSpringBootApplication.class })
public class YourSpringBootApplication {
public static void main(String[] args) {
new SpringApplication(YourSpringBootApplication.class).run(args);
}
}
-
Alternatively provide a
@Bean
of typeMetricxEndpoint
in your application configuration -
All Metrics will be published on '/metricx' endpoint with name and value both
-
Pattern search is also supported e.g. '/metricx/jvm.*'
- 'metricx.exposure.prefix' :
Default empty so it will publish all metrics.
if configured, only those metrics will be published which has matches configured prefix.
Example: metricx.exposure.prefix=counter,
only those metrics will be published which are starting with 'counter'