Skip to content

Commit

Permalink
chore: Added prometheus + fix openApi handling
Browse files Browse the repository at this point in the history
  • Loading branch information
antonioT90 committed Jan 13, 2025
1 parent 03713f6 commit 0c84d53
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ RUN mkdir -p src/main/java && \

USER ${APP_USER}

RUN gradle openApiGenerate dependencies --no-daemon
RUN gradle dependenciesBuild dependencies --no-daemon

#
# 🏗️ Build Stage
Expand Down
17 changes: 14 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("io.micrometer:micrometer-tracing-bridge-otel:$micrometerVersion")
implementation("io.micrometer:micrometer-registry-prometheus")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:$springDocOpenApiVersion")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
implementation("org.openapitools:jackson-databind-nullable:$openApiToolsVersion")
Expand Down Expand Up @@ -82,7 +83,16 @@ configurations {
}

tasks.compileJava {
dependsOn("openApiGenerate")
dependsOn("dependenciesBuild")
}

tasks.register("dependenciesBuild") {
group = "AutomaticallyGeneratedCode"
description = "grouping all together automatically generate code tasks"

dependsOn(
"openApiGenerate"
)
}

configure<SourceSetContainer> {
Expand All @@ -107,8 +117,9 @@ openApiGenerate {
"useSpringBoot3" to "true",
"interfaceOnly" to "true",
"useTags" to "true",
"generateConstructorWithAllArgs" to "false",
"useBeanValidation" to "true",
"generateConstructorWithAllArgs" to "true",
"generatedConstructorWithRequiredArgs" to "true",
"additionalModelTypeAnnotations" to "@lombok.Data @lombok.Builder @lombok.AllArgsConstructor"
"additionalModelTypeAnnotations" to "@lombok.Builder"
))
}
5 changes: 5 additions & 0 deletions gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ io.micrometer:micrometer-commons:1.14.2=compileClasspath
io.micrometer:micrometer-core:1.14.2=compileClasspath
io.micrometer:micrometer-jakarta9:1.14.2=compileClasspath
io.micrometer:micrometer-observation:1.14.2=compileClasspath
io.micrometer:micrometer-registry-prometheus:1.14.2=compileClasspath
io.micrometer:micrometer-tracing-bridge-otel:1.4.1=compileClasspath
io.micrometer:micrometer-tracing:1.4.1=compileClasspath
io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-incubator:2.9.0-alpha=compileClasspath
Expand All @@ -30,6 +31,10 @@ io.opentelemetry:opentelemetry-sdk-logs:1.43.0=compileClasspath
io.opentelemetry:opentelemetry-sdk-metrics:1.43.0=compileClasspath
io.opentelemetry:opentelemetry-sdk-trace:1.43.0=compileClasspath
io.opentelemetry:opentelemetry-sdk:1.43.0=compileClasspath
io.prometheus:prometheus-metrics-config:1.3.5=compileClasspath
io.prometheus:prometheus-metrics-core:1.3.5=compileClasspath
io.prometheus:prometheus-metrics-model:1.3.5=compileClasspath
io.prometheus:prometheus-metrics-tracer-common:1.3.5=compileClasspath
io.swagger.core.v3:swagger-annotations-jakarta:2.2.25=compileClasspath
io.swagger.core.v3:swagger-core-jakarta:2.2.25=compileClasspath
io.swagger.core.v3:swagger-models-jakarta:2.2.25=compileClasspath
Expand Down
31 changes: 26 additions & 5 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
server:
http: "\${SERVER_PORT:8080}"

spring:
application:
name: ${artifactId}
Expand All @@ -8,14 +11,32 @@ spring:
enabled: "\${VIRTUAL_THREADS_ENABLED:true}"

management:
endpoints:
jmx:
exposure.include: "*"
web:
exposure:
include: health, info, prometheus, metrics
base-path: /actuator
endpoint:
health:
probes.enabled: true
group:
readiness.include: "*"
liveness.include: livenessState,diskSpace,ping
endpoints:
jmx:
exposure.include: "*"
web:
exposure.include: info, health
prometheus:
enabled: true
metrics:
tags:
application: ${artifactId}
export:
prometheus:
enabled: true
step: 1m
descriptions: true
enable:
jvm: true
process: true
system: true
http: true
logback: true

0 comments on commit 0c84d53

Please sign in to comment.