Skip to content

Commit

Permalink
chore: enable health and prom (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjungling authored Feb 3, 2023
1 parent 8325cf1 commit cf62a45
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ dependencies {
implementation("com.graphql-java:graphql-java-extended-scalars:18+")

implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-rsocket")

implementation("com.netflix.graphql.dgs:graphql-dgs-webflux-starter:5+") {
exclude(module = "snakeyaml")
Expand All @@ -70,6 +71,9 @@ dependencies {
exclude(module = "snakeyaml")
}

implementation("io.micrometer:micrometer-core:1.+")
implementation("io.micrometer:micrometer-registry-prometheus:1.+")

testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation(platform("org.junit:junit-bom:latest.release"))
testImplementation("org.junit.jupiter:junit-jupiter-api")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@
import com.netflix.graphql.dgs.InputArgument;
import io.moderne.organizations.types.Organization;
import io.moderne.organizations.types.RepositoryInput;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.io.IOException;
import java.util.List;

@DgsComponent
public class OrganizationDataFetcher implements HealthIndicator {
public class OrganizationDataFetcher {
List<OrganizationRepositories> ownership;

public OrganizationDataFetcher(ObjectMapper mapper) throws IOException {
Expand All @@ -42,8 +40,4 @@ Mono<Organization> defaultOrganization(@InputArgument String email) {
.map(org -> new Organization(org.name(), org.name()));
}

@Override
public Health health() {
return Health.up().build();
}
}
3 changes: 3 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
management.endpoints.web.exposure.include: prometheus,health
management.endpoint.prometheus.enabled: true
management.endpoint.health.enabled: true

0 comments on commit cf62a45

Please sign in to comment.