diff --git a/build.gradle b/build.gradle index 3c1d4f5..b146760 100644 --- a/build.gradle +++ b/build.gradle @@ -38,13 +38,21 @@ dependencies { implementation ('io.sentry:sentry-log4j2:1.7.30') { exclude group: "org.apache.logging.log4j" } + compile 'io.micrometer:micrometer-core:1.4.0' + compile 'io.micrometer:micrometer-registry-influx:1.4.0' /* GraphQL */ implementation 'com.graphql-java-kickstart:graphql-spring-boot-starter:7.0.0' implementation 'com.graphql-java:graphql-java-tools:5.2.4' compile group: 'com.graphql-java-kickstart', name: 'playground-spring-boot-starter', version: '7.0.0' + compile 'com.careykevin:graphql-actuator:0.0.3' /* Spring */ + implementation (group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '2.2.6.RELEASE') { + exclude group: "commons-logging", module: "commons-logging" + exclude module: "spring-boot-starter-logging" + } + implementation ('org.springframework.boot:spring-boot-starter') { exclude group: "commons-logging", module: "commons-logging" exclude module: "spring-boot-starter-logging" diff --git a/docker-compose.yml b/docker-compose.yml index 0953641..fc44ae5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,21 @@ -# Please fill out with content - version: '3.6' services: + influxdb: + image: influxdb:latest + ports: + - "8086:8086" + + gateway_grafana: + image: grafana/grafana:latest + ports: + - "3000:3000" + user: "0" + links: + - influxdb + volumes: + - /srv/docker/grafana/data:/var/lib/grafana + gateway: image: eedu/gateway container_name: eedu-gateway @@ -13,3 +26,8 @@ services: SERVICE_SECRET: SECRET PRODUCTIVE: "false" SENTRY_ENABLED: "${SENTRY_ENABLED}" + INFLUX_URI: "http://influxdb:8086" + INFLUX_USERNAME: 0 + INFLUX_PASSWORD: "" + INFLUX_DB: "gateway" + INFLUX_STEP: "1m" diff --git a/src/main/java/de/themorpheus/edu/gateway/GatewayApplication.java b/src/main/java/de/themorpheus/edu/gateway/GatewayApplication.java index 7e32aac..7bf3627 100644 --- a/src/main/java/de/themorpheus/edu/gateway/GatewayApplication.java +++ b/src/main/java/de/themorpheus/edu/gateway/GatewayApplication.java @@ -1,6 +1,7 @@ package de.themorpheus.edu.gateway; import de.themorpheus.edu.gateway.util.GitInfo; +import com.careykevin.graphql.actuator.instrumentation.EnableGraphQLActuator; import com.jcabi.manifests.Manifests; import io.sentry.Sentry; import io.sentry.SentryClient; @@ -13,6 +14,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.io.IOException; +@EnableGraphQLActuator @SpringBootApplication public class GatewayApplication { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d090f14..cd84dfa 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,3 +1,9 @@ security.basic.enable=false server.port=80 graphql.playground.settings.request.credentials=Same-Origin +management.metrics.export.influx.db=${INFLUX_DB} +management.metrics.export.influx.username=${INFLUX_USERNAME} +management.metrics.export.influx.password=${INFLUX_PASSWORD} +management.metrics.export.influx.step=${INFLUX_STEP} +management.metrics.export.influx.uri=${INFLUX_URI} +management.metrics.web.server.auto-time-request=true diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml index dfb1dc5..27746f3 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -38,6 +38,8 @@ + +