fixing gateway prometheus
This commit is contained in:
@@ -98,7 +98,6 @@ kotlin {
|
|||||||
"-Xwasm-debugger-custom-formatters", // Optimize debug info for smaller size
|
"-Xwasm-debugger-custom-formatters", // Optimize debug info for smaller size
|
||||||
"-Xwasm-enable-array-range-checks", // Optimize array bounds checking
|
"-Xwasm-enable-array-range-checks", // Optimize array bounds checking
|
||||||
"-Xwasm-generate-wat=false", // Skip WAT generation for smaller output
|
"-Xwasm-generate-wat=false", // Skip WAT generation for smaller output
|
||||||
"-Xwasm-target=wasm32", // Explicit WASM32 target
|
|
||||||
"-opt-in=kotlin.ExperimentalStdlibApi", // Enable stdlib optimizations
|
"-opt-in=kotlin.ExperimentalStdlibApi", // Enable stdlib optimizations
|
||||||
"-opt-in=kotlin.js.ExperimentalJsExport" // Enable JS export optimizations
|
"-opt-in=kotlin.js.ExperimentalJsExport" // Enable JS export optimizations
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ ENV JAVA_OPTS="-XX:MaxRAMPercentage=80.0 \
|
|||||||
-Dspring.backgroundpreinitializer.ignore=true \
|
-Dspring.backgroundpreinitializer.ignore=true \
|
||||||
-Dmanagement.endpoints.web.exposure.include=health,info,metrics,prometheus,gateway \
|
-Dmanagement.endpoints.web.exposure.include=health,info,metrics,prometheus,gateway \
|
||||||
-Dmanagement.endpoint.health.show-details=always \
|
-Dmanagement.endpoint.health.show-details=always \
|
||||||
-Dmanagement.metrics.export.prometheus.enabled=true"
|
-Dmanagement.prometheus.metrics.export.enabled=true"
|
||||||
|
|
||||||
# Spring Boot configuration
|
# Spring Boot configuration
|
||||||
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
|
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ ENV JAVA_OPTS="-XX:MaxRAMPercentage=75.0 \
|
|||||||
-Dspring.backgroundpreinitializer.ignore=true \
|
-Dspring.backgroundpreinitializer.ignore=true \
|
||||||
-Dmanagement.endpoints.web.exposure.include=health,info,metrics,prometheus \
|
-Dmanagement.endpoints.web.exposure.include=health,info,metrics,prometheus \
|
||||||
-Dmanagement.endpoint.health.show-details=always \
|
-Dmanagement.endpoint.health.show-details=always \
|
||||||
-Dmanagement.metrics.export.prometheus.enabled=true"
|
-Dmanagement.prometheus.metrics.export.enabled=true"
|
||||||
|
|
||||||
# Spring Boot configuration
|
# Spring Boot configuration
|
||||||
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
|
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ springdoc-openapi-starter-common = { module = "org.springdoc:springdoc-openapi-s
|
|||||||
springdoc-openapi-starter-webmvc-ui = { module = "org.springdoc:springdoc-openapi-starter-webmvc-ui", version.ref = "springdoc" }
|
springdoc-openapi-starter-webmvc-ui = { module = "org.springdoc:springdoc-openapi-starter-webmvc-ui", version.ref = "springdoc" }
|
||||||
|
|
||||||
# --- Spring Cloud ---
|
# --- Spring Cloud ---
|
||||||
spring-cloud-starter-gateway = { module = "org.springframework.cloud:spring-cloud-starter-gateway" }
|
spring-cloud-starter-gateway-server-webflux = { module = "org.springframework.cloud:spring-cloud-starter-gateway-server-webflux" }
|
||||||
spring-cloud-starter-consul-discovery = { module = "org.springframework.cloud:spring-cloud-starter-consul-discovery" }
|
spring-cloud-starter-consul-discovery = { module = "org.springframework.cloud:spring-cloud-starter-consul-discovery" }
|
||||||
|
|
||||||
# --- Database & Persistence ---
|
# --- Database & Persistence ---
|
||||||
@@ -271,7 +271,7 @@ monitoring-client = [
|
|||||||
]
|
]
|
||||||
# Bündelt die Kernabhängigkeiten für das Spring Cloud Gateway.
|
# Bündelt die Kernabhängigkeiten für das Spring Cloud Gateway.
|
||||||
spring-cloud-gateway = [
|
spring-cloud-gateway = [
|
||||||
"spring-cloud-starter-gateway",
|
"spring-cloud-starter-gateway-server-webflux",
|
||||||
"spring-cloud-starter-consul-discovery"
|
"spring-cloud-starter-consul-discovery"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
+5
-9
@@ -29,7 +29,7 @@ class GatewayMetricsConfig {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
// Metric Namen als Konstanten für bessere Wartbarkeit
|
// Metric Namen als Konstanten für bessere Wartbarkeit
|
||||||
const val GATEWAY_REQUEST_TIMER = "gateway_request_duration"
|
const val GATEWAY_REQUEST_TIMER = "gateway_custom_request_duration"
|
||||||
const val GATEWAY_ERROR_COUNTER = "gateway_errors_total"
|
const val GATEWAY_ERROR_COUNTER = "gateway_errors_total"
|
||||||
const val GATEWAY_REQUESTS_COUNTER = "gateway_requests_total"
|
const val GATEWAY_REQUESTS_COUNTER = "gateway_requests_total"
|
||||||
const val GATEWAY_CIRCUIT_BREAKER_COUNTER = "gateway_circuit_breaker_events_total"
|
const val GATEWAY_CIRCUIT_BREAKER_COUNTER = "gateway_circuit_breaker_events_total"
|
||||||
@@ -72,15 +72,11 @@ class GatewayMetricsConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bean für Request Duration Timer - ermöglicht manuelle Messungen.
|
* Bean für Request Duration Timer - entfernt um Konflikte mit dem WebFilter zu vermeiden.
|
||||||
|
* Die Request-Zeiten werden automatisch im GatewayMetricsWebFilter erfasst.
|
||||||
*/
|
*/
|
||||||
@Bean
|
// @Bean - Entfernt um Prometheus Meter-Konflikte zu vermeiden
|
||||||
fun requestTimer(meterRegistry: MeterRegistry): Timer {
|
// fun requestTimer(meterRegistry: MeterRegistry): Timer { ... }
|
||||||
return Timer.builder(GATEWAY_REQUEST_TIMER)
|
|
||||||
.description("Gateway Request-Verarbeitungszeit")
|
|
||||||
.tag("type", "http")
|
|
||||||
.register(meterRegistry)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bean für Error Counter - ermöglicht manuelles Error Tracking.
|
* Bean für Error Counter - ermöglicht manuelles Error Tracking.
|
||||||
|
|||||||
@@ -225,21 +225,19 @@ management:
|
|||||||
metrics:
|
metrics:
|
||||||
distribution:
|
distribution:
|
||||||
percentiles-histogram:
|
percentiles-histogram:
|
||||||
spring.cloud.gateway.requests: true
|
|
||||||
http.server.requests: true
|
http.server.requests: true
|
||||||
percentiles:
|
percentiles:
|
||||||
spring.cloud.gateway.requests: 0.5,0.90,0.95,0.99
|
|
||||||
http.server.requests: 0.5,0.90,0.95,0.99
|
http.server.requests: 0.5,0.90,0.95,0.99
|
||||||
minimum-expected-value:
|
minimum-expected-value:
|
||||||
spring.cloud.gateway.requests: 1ms
|
|
||||||
http.server.requests: 1ms
|
http.server.requests: 1ms
|
||||||
maximum-expected-value:
|
maximum-expected-value:
|
||||||
spring.cloud.gateway.requests: 30s
|
|
||||||
http.server.requests: 30s
|
http.server.requests: 30s
|
||||||
tags:
|
tags:
|
||||||
application: ${spring.application.name}
|
application: ${spring.application.name}
|
||||||
environment: ${spring.profiles.active}
|
environment: ${spring.profiles.active}
|
||||||
instance: ${spring.cloud.consul.discovery.instance-id}
|
instance: ${spring.cloud.consul.discovery.instance-id}
|
||||||
|
service: gateway
|
||||||
|
component: infrastructure
|
||||||
gateway: api-gateway
|
gateway: api-gateway
|
||||||
info:
|
info:
|
||||||
env:
|
env:
|
||||||
@@ -252,12 +250,15 @@ management:
|
|||||||
enabled: true
|
enabled: true
|
||||||
# Tracing-Konfiguration - Aktiviert (Micrometer Tracing + Zipkin)
|
# Tracing-Konfiguration - Aktiviert (Micrometer Tracing + Zipkin)
|
||||||
tracing:
|
tracing:
|
||||||
enabled: true
|
enabled: ${TRACING_ENABLED:false}
|
||||||
sampling:
|
sampling:
|
||||||
probability: ${TRACING_SAMPLING_PROBABILITY:1.0}
|
probability: ${TRACING_SAMPLING_PROBABILITY:1.0}
|
||||||
zipkin:
|
zipkin:
|
||||||
tracing:
|
tracing:
|
||||||
endpoint: ${ZIPKIN_TRACING_ENDPOINT:http://zipkin:9411/api/v2/spans}
|
endpoint: ${ZIPKIN_TRACING_ENDPOINT:http://localhost:9411/api/v2/spans}
|
||||||
|
# Reduziert Verbindungsfehler wenn Zipkin nicht verfügbar ist
|
||||||
|
connect-timeout: 1s
|
||||||
|
read-timeout: 10s
|
||||||
|
|
||||||
# Erweiterte Logging-Konfiguration
|
# Erweiterte Logging-Konfiguration
|
||||||
logging:
|
logging:
|
||||||
@@ -274,7 +275,7 @@ logging:
|
|||||||
console: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr([%X{correlationId:-}]){yellow} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"
|
console: "%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr([%X{correlationId:-}]){yellow} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"
|
||||||
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%X{correlationId:-}] %logger{36} - %msg%n"
|
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%X{correlationId:-}] %logger{36} - %msg%n"
|
||||||
file:
|
file:
|
||||||
name: logs/gateway.log
|
name: infrastructure/gateway/logs/gateway.log
|
||||||
logback:
|
logback:
|
||||||
rolling policy:
|
rolling policy:
|
||||||
clean-history-on-start: true
|
clean-history-on-start: true
|
||||||
|
|||||||
Reference in New Issue
Block a user