diff --git a/pom.xml b/pom.xml index 7c3b00456fb..a79398fa8f9 100644 --- a/pom.xml +++ b/pom.xml @@ -43,15 +43,7 @@ - - - - - - - - - + org.glassfish.jaxb jaxb-runtime 2.3.8 @@ -364,6 +356,14 @@ 1.13.3 + + + io.micrometer + micrometer-registry-prometheus-simpleclient + 1.13.3 + + + com.zaxxer HikariCP diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 394c97b0382..25e4d1349e3 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,31 +1,37 @@ #Uncomment the "servlet" and "context-path" lines below to make the fhir endpoint available at /example/path/fhir instead of the default value of /fhir server: -# servlet: -# context-path: /example/path + # servlet: + # context-path: /example/path port: 8080 #Adds the option to go to eg. http://localhost:8080/actuator/health for seeing the running configuration #see https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints management: + #The following configuration will enable the actuator endpoints at /actuator/health, /actuator/info, /actuator/prometheus + endpoints: + enabled-by-default: false + web: + exposure: + include: 'info,health' # or e.g. 'info,health,prometheus,metrics' or '*' for all' endpoint: - endpoints: - enabled-by-default: false - web: - exposure: - include: health,prometheus + info: + enabled: true + metrics: + enabled: true health: enabled: true probes: enabled: true - livenessState: - enabled: true - readinessState: - enabled: true + group: + liveness: + include: + - livenessState + - readinessState prometheus: enabled: true - metrics: - export: - enabled: true - + prometheus: + metrics: + export: + enabled: true spring: main: allow-circular-references: true diff --git a/src/main/resources/cds.application.yaml b/src/main/resources/cds.application.yaml index b1703d86c4c..a6cf7a3eed1 100644 --- a/src/main/resources/cds.application.yaml +++ b/src/main/resources/cds.application.yaml @@ -6,10 +6,32 @@ server: #Adds the option to go to eg. http://localhost:8080/actuator/health for seeing the running configuration #see https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints management: + #The following configuration will enable the actuator endpoints at /actuator/health, /actuator/info, /actuator/prometheus endpoints: + enabled-by-default: false web: exposure: - include: "health,prometheus" + include: 'info,health' # or e.g. 'info,health,prometheus,metrics' or '*' for all' + endpoint: + info: + enabled: true + metrics: + enabled: true + health: + enabled: true + probes: + enabled: true + group: + liveness: + include: + - livenessState + - readinessState + prometheus: + enabled: true + prometheus: + metrics: + export: + enabled: true spring: main: allow-circular-references: true diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java index d7b46315dbd..a8039809243 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java @@ -13,6 +13,10 @@ import jakarta.websocket.ContainerProvider; import jakarta.websocket.Session; import jakarta.websocket.WebSocketContainer; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r4.model.Bundle; @@ -29,6 +33,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; @@ -306,6 +312,17 @@ private int activeSubscriptionCount() { .size(); } + @ParameterizedTest + @ValueSource(strings = {"prometheus", "health", "metrics", "info"}) + void testActuatorEndpointExists(String endpoint) throws IOException { + + CloseableHttpClient httpclient = HttpClients.createDefault(); + CloseableHttpResponse response = httpclient.execute(new HttpGet("http://localhost:" + port + "/actuator/" + endpoint)); + int statusCode = response.getStatusLine().getStatusCode(); + assertEquals(200, statusCode); + + } + @BeforeEach void beforeEach() { diff --git a/src/test/resources/application.yaml b/src/test/resources/application.yaml index 911d9709034..6fffa35089c 100644 --- a/src/test/resources/application.yaml +++ b/src/test/resources/application.yaml @@ -1,3 +1,30 @@ +management: + #The following configuration will enable the actuator endpoints at /actuator/health, /actuator/info, /actuator/prometheus + endpoints: + enabled-by-default: false + web: + exposure: + include: 'info,health,prometheus,metrics' # or '*' for all' + endpoint: + info: + enabled: true + metrics: + enabled: true + health: + enabled: true + probes: + enabled: true + group: + liveness: + include: + - livenessState + - readinessState + prometheus: + enabled: true + prometheus: + metrics: + export: + enabled: true spring: main: allow-circular-references: true