It seems as though when adding @Timed to a jpa repository; the http.server.requets metric stops publishing.

I can upload an example quite yet; but here is the general gist.

// Gradle
sourceCompatibility = '17'

// Plugin
id 'org.springframework.boot' version '2.7.0'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'

// Dependencies
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.cloud:spring-cloud-starter-sleuth'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'com.h2database:h2:2.1.210'
// MyCoolController.java
@RestController
@RequestMapping(
        value = "${context-path}/v1",
        produces = MediaType.APPLICATION_JSON_VALUE,
        consumes = MediaType.APPLICATION_JSON_VALUE)
@Validated
@RequiredArgsConstructor
// @Timed // Not expecting this to be needed; Doesnt work either way
public class MyCoolController {
...
}
// MyCoolRepository.java
@Repository
@Timed("timed.repository.my-cool-repository")
public interface MyCoolRepository
        extends JpaRepository<MyCoolRepoPojo, Long> {}

Comment From: bguedel

This seems to be more of an issue when deployed to an environment (k8s)? when running locally; it seems to be ok.

Comment From: bguedel

Removing the @Timed from the repository brings the http.server.request metric back

Comment From: wilkinsona

I can't think why the deployment environment would have any effect on the behavior of @Timed. To allow us to investigate the problem and hopefully understand it, please provide a complete yet minimal example that reproduces it.

Comment From: bguedel

I agree; makes no sense to me.

i can provide one maybe eod tomorrow sometime. You wont be able to reproduce with bootrun. Not sure if this is an everywhere k8s problem, or if you guys have a way to make an oci and push it to a k8s cluster.

to be clear With @Timed does not work on k8s but does on local Without @Timed does work in both k8s and local

Comment From: bguedel

https://github.com/bguedel/demo_metrics

This SHOULD show the issue; Not able to confirm quite yet; I did check this with docker and it seems ok. Going to see if it shows similar issues in K8s Monday.

to reproduce: (note running locally seems to work ok; change localhost:8080 to k8s url) curl -X 'GET' 'http://localhost:8080/v1/hello?name=world' curl -X 'GET' 'http://localhost:8080/v1/hello?name=wade' curl -X 'GET' 'http://localhost:8080/v1/hello?name=zzz'

http://localhost:8080/actuator/metrics -- check for http.server.requests

Comment From: bguedel

yeah built and deployed my demo to the same system i am having a problem in my other repository.

this one doesnt seem to have any issues; so might be between the user and the keyboard. Ill close this for now. If i find out more ill reopen with new information.

Comment From: bguedel

incase anyone comes to this with something similar;

boot 2.7.0 has an issue with the http.server.request metric; go to 2.7.1+ and it seems to resolve it.