Riptide: Micrometer adds metrics support to Riptide. It allows to record metrics for all remote requests and responses.
Http.builder()
.plugin(new MicrometerPlugin(meterRegistry))
.build();
- adds request metrics to Riptide
- Riptide Core
- Micrometer
Add the following dependency to your project:
<dependency>
<groupId>org.zalando</groupId>
<artifactId>riptide-micrometer</artifactId>
<version>${riptide.version}</version>
</dependency>
Http.builder()
.baseUrl("https://www.example.com")
.plugin(new MicrometerPlugin(meterRegistry)
.build();
It's also possible to specify a custom metrics name with http.client.requests
being the default
and default tags:
new MicrometerPlugin(meterRegistry)
.withMetricName("http.outgoing-requests")
.withDefaultTags(Tag.of("aws.region", "eu-central-1"))
The MicrometerPlugin
does NOT configure any histograms or percentiles for two reasons:
- It would require Riptide to effectively replicate Micrometer's API and also maintain compatibility without providing any additional value that would justify it.
- It should be left to users to decide which strategy they want to use: percentiles per instance (non-aggregatable), percentiles per cluster (aggregated centrally) or percentiles per cluster (pre-aggregated per instance)
The preferred solution is to register a custom MeterFilter
and configure percentiles that way:
registry.config().meterFilter(
new MeterFilter() {
@Override
public DistributionStatisticConfig configure(Meter.Id id, DistributionStatisticConfig config) {
if(id.getName().startsWith("myservice")) {
return DistributionStatisticConfig.builder()
.percentiles(0.95)
.build()
.merge(config);
}
return config;
}
});
For additional information on percentiles and histograms check the docs of Micrometer and Prometheus.
The plugin will measure network communication but exclude any logic that is part of the local routing tree, i.e. greet
in the following example:
http.get("/users/me")
.dispatch(series(),
on(SUCCESSFUL).call(User.class, this::greet),
anySeries().call(problemHandling()))
If you have questions, concerns, bug reports, etc., please file an issue in this repository's Issue Tracker.
To contribute, simply open a pull request and add a brief description (1-2 sentences) of your addition or change. For more details, check the contribution guidelines.