Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fixing prometheus #745

Merged
merged 10 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,7 @@
<dependencyManagement>
<dependencies>

<!-- Temporarily override CR depedencies for debugging -->
<!-- <dependency>-->
<!-- <groupId>org.opencds.cqf.fhir</groupId>-->
<!-- <artifactId>cqf-fhir-bom</artifactId>-->
<!-- <version>3.4.0</version>-->
<!-- <type>pom</type>-->
<!-- <scope>import</scope>-->
<!-- </dependency>-->
<dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.8</version>
Expand Down Expand Up @@ -364,6 +356,14 @@
<version>1.13.3</version>
</dependency>

<!-- https://mvnrepository.com/artifact/io.micrometer/micrometer-registry-prometheus-simpleclient -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus-simpleclient</artifactId>
<version>1.13.3</version>
</dependency>


<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
Expand Down
34 changes: 19 additions & 15 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
#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
dotasek marked this conversation as resolved.
Show resolved Hide resolved
endpoints:
enabled-by-default: false
web:
exposure:
include: 'health,info,prometheus,metrics' # or '*' for all'
endpoint:
endpoints:
enabled-by-default: false
web:
exposure:
include: health,prometheus
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
Expand Down
22 changes: 21 additions & 1 deletion src/main/resources/cds.application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,30 @@ 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: 'health,info,prometheus,metrics' # or '*' for all'
endpoint:
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
Expand Down
14 changes: 14 additions & 0 deletions src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -306,6 +310,16 @@ private int activeSubscriptionCount() {
.size();
}

@Test
void testPrometheusEndpoint() throws IOException {

CloseableHttpClient httpclient = HttpClients.createDefault();
CloseableHttpResponse response = httpclient.execute(new HttpGet("http://localhost:" + port + "/actuator/prometheus"));
int statusCode = response.getStatusLine().getStatusCode();
assertEquals(200, statusCode);

}

@BeforeEach
void beforeEach() {

Expand Down
25 changes: 25 additions & 0 deletions src/test/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
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,info,prometheus,metrics' # or '*' for all'
endpoint:
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
Expand Down
Loading