Feature/fixing prometheus (#745)
* Fixing prometheus so that it actually works. Also seems related to https://github.com/micrometer-metrics/micrometer/issues/5093 * cleaning up override * Limiting exposure * Added docs * Added smoketest for prometheus endpoint * Removing metrics and prometheus exposure by default * Removing 'info' Adding parameterized tests for endpoints * Reintroduced 'info' * Remove info * Adjusted comment
This commit is contained in:
committed by
GitHub
parent
e2d2ea7726
commit
40e5b4c10d
@@ -13,6 +13,10 @@ import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
|
||||
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.hl7.fhir.r4.model.Subscription;
|
||||
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 @@ class ExampleServerR4IT implements IServerSupport {
|
||||
.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() {
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user