DataSourcePublicMetrics Not Available in Spring boot 2.1.3 - spring-boot

We are using a sharded database where we want to have metrics about each shard. We were using Spring Boot 1.5.9 and recently we upgraded to Spring Boot 2.1.3. For the metrics in the sharded database we were extending org.springframework.boot.actuate.endpoint.DataSourcePublicMetrics, but it seems this is gone now with the new Spring Boot version.
That class allowed the method ``public Collection> metrics()` to be added whhich adds custom metrics.
How can we achieve this same behavior with the new version?
Thanks a lot in advance

Related

Are there plans for a spring cloud update that is compatible with spring boot 2.5?

I am using both spring cloud and spring boot in my project. We are adding a feature that will require the Spring Boot 2.5 release, however the latest supported Spring Boot version supported by the most recent Spring Cloud snapshot is 2.4.6-SNAPSHOT. Are there any plans to support spring boot version 2.5 in a new Spring Cloud update or snapshot? If so, when is that projected to be released?

Metrics of redis and solr in spring boot

I have services built in spring boot 2.0.2. I`m using redis and solrj.
Now if i want to get metrics of redis and solr. It don`t show in
http://localhost:8080/actuator/metrics
Is there any way e.g making custom endpoint to get redis and solr metrics?
Any help would be appreciated..
Yes, it should be possible.
Spring boot 2's default metrics framework is Micrometer
When this framework is integrated into spring boot application (via starter as usual), any metrics reported to micrometer will immediately appear in spring boot actuator.
So the question is whether the redis/solrj integration expose Metrics or not.
If they are not, you'll have to understand what exactly you want to measure and plug in the integration.
Here is the example:
import io.micrometer.core.annotation;
#Timed("my-redis-calls")
public void doSomethingInMyCode() {
//call redis here
}
Of course, there is also a programmatic interface, using annotations in not mandatory
The code shown in Mark Bramnik's answer doesn't specifically give you timing for Redis client calls, it gives you timing for doSomethingInMyCode method, which can be different.
Micrometer support seems to be available in the Lettuce 6.1 release.
MeterRegistry meterRegistry = …;
MicrometerOptions options = MicrometerOptions.create();
ClientResources resources = ClientResources.builder().commandLatencyRecorder(new MicrometerCommandLatencyRecorder(meterRegistry, options)).build();
RedisClient client = RedisClient.create(resources);
https://lettuce.io/core/release/reference/index.html#command.latency.metrics.micrometer

Implement Spring Cloud Sleuth's TracingWebFillter in Spring WebFlux

I have a Spring Boot Reactive application using Functional Endpoints ( Kotlin) that uses Spring Cloud Sleuth. I want to customize the response headers to include the trace id. I looked at the manual and saw the section on using the TraceFilter : 1
I tried to do the same using a TraceWebFilter, but it doesn't expose the constructors. Is there a way to implement this customization when using the Reactive Web Framework.
I am using version 2.0.0.M5 for Spring Cloud Sleuth
Thanks in advance!
Please check out the latest master - we've migrated to Brave. You can write your WebFilter that will delegate to TraceWebFilter. Or you can just copy our TraceWebFilter and alter it in the way you need to.

Spring Boot (v1.5.1.RELEASE) and Spring ElasticSearch 3.0.0

Are Spring boot v1.5.1 and Spring data elastic search 3.0.0 compatible.
We can only use Elastic search 5 if we have spring data elastic search 3.0.0 but the equivalent spring boot version 2.0 is not yet released.
So would like to know whether it could work with current spring boot version 1.5.1.
You will end up in dependency hell if you try to get Spring Data Kay into Spring Boot 1.x — see also Spring Boot application with current elasticsearch version
Either use the latest milestone of Spring Boot 2.0 (it should reach GA until the end of the year from what I've heard) or use Elastic's high level REST client and avoid any coupling to Spring Data.

What's the proper spring cloud release working with current spring boot 2.0.0M3

I would like to use spring boot 2.0.0M3(which includes Spring 5 RC3) for my new project. I'm wondering which release of spring cloud I should use to have compatible with spring 5.
I did not find any resource talking about it. Should I use latest Dalston SR2 or Finchley snapshot to having spring cloud capability?
I generated my new project via start.spring.io.
The Finchley.M1 of spring cloud works fine with spring boot 2.0.0.M3.

Resources