diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/checksums/checksums.lock b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/checksums/checksums.lock new file mode 100755 index 00000000..4fdf42d4 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/checksums/checksums.lock differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/checksums/md5-checksums.bin b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/checksums/md5-checksums.bin new file mode 100755 index 00000000..4bedbd9e Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/checksums/md5-checksums.bin differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/checksums/sha1-checksums.bin b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/checksums/sha1-checksums.bin new file mode 100755 index 00000000..21015ab6 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/checksums/sha1-checksums.bin differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/dependencies-accessors/gc.properties b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/dependencies-accessors/gc.properties new file mode 100755 index 00000000..e69de29b diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/executionHistory/executionHistory.bin b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/executionHistory/executionHistory.bin new file mode 100755 index 00000000..72a2a026 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/executionHistory/executionHistory.bin differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/executionHistory/executionHistory.lock b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/executionHistory/executionHistory.lock new file mode 100755 index 00000000..adb5f25b Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/executionHistory/executionHistory.lock differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileChanges/last-build.bin b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileChanges/last-build.bin new file mode 100755 index 00000000..f76dd238 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileChanges/last-build.bin differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileHashes/fileHashes.bin b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileHashes/fileHashes.bin new file mode 100755 index 00000000..0a7febae Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileHashes/fileHashes.bin differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileHashes/fileHashes.lock b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileHashes/fileHashes.lock new file mode 100755 index 00000000..30e13da6 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileHashes/fileHashes.lock differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileHashes/resourceHashesCache.bin b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileHashes/resourceHashesCache.bin new file mode 100755 index 00000000..d7fa4bff Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/fileHashes/resourceHashesCache.bin differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/gc.properties b/2024-07/spring-36-37-spring-cloud/.gradle/8.10.2/gc.properties new file mode 100755 index 00000000..e69de29b diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/2024-07/spring-36-37-spring-cloud/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100755 index 00000000..f1391644 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/buildOutputCleanup/cache.properties b/2024-07/spring-36-37-spring-cloud/.gradle/buildOutputCleanup/cache.properties new file mode 100755 index 00000000..67c729dc --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Sun Oct 06 17:31:48 MSK 2024 +gradle.version=8.10.2 diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/buildOutputCleanup/outputFiles.bin b/2024-07/spring-36-37-spring-cloud/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100755 index 00000000..e4ff9955 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/file-system.probe b/2024-07/spring-36-37-spring-cloud/.gradle/file-system.probe new file mode 100755 index 00000000..0086c3de Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/.gradle/file-system.probe differ diff --git a/2024-07/spring-36-37-spring-cloud/.gradle/vcs-1/gc.properties b/2024-07/spring-36-37-spring-cloud/.gradle/vcs-1/gc.properties new file mode 100755 index 00000000..e69de29b diff --git a/2024-07/spring-36-37-spring-cloud/README.md b/2024-07/spring-36-37-spring-cloud/README.md new file mode 100755 index 00000000..387c879c --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/README.md @@ -0,0 +1 @@ +# Spring Cloud example diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/build.gradle.kts b/2024-07/spring-36-37-spring-cloud/api-gateway/build.gradle.kts new file mode 100755 index 00000000..4030c0d4 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/build.gradle.kts @@ -0,0 +1,14 @@ +dependencies { + implementation(project(":kafka-log-appender")) + implementation("net.logstash.logback:logstash-logback-encoder") + implementation("ch.qos.logback:logback-classic") + + implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("io.micrometer:micrometer-registry-prometheus") + + implementation("org.springframework.cloud:spring-cloud-starter-gateway") + implementation("org.springframework.cloud:spring-cloud-starter-netflix-eureka-client") + + implementation("io.micrometer:micrometer-tracing-bridge-otel") // bridges the Micrometer Observation API to OpenTelemetry. + implementation("io.opentelemetry:opentelemetry-exporter-zipkin") // reports traces to Zipkin. +} diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/ApiGateway.class b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/ApiGateway.class new file mode 100644 index 00000000..e6e850ad Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/ApiGateway.class differ diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/config/ApiConfig.class b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/config/ApiConfig.class new file mode 100644 index 00000000..44e8fb28 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/config/ApiConfig.class differ diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/config/ApiRoute.class b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/config/ApiRoute.class new file mode 100644 index 00000000..f1bc3c14 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/config/ApiRoute.class differ diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/config/ApplConfigProperties.class b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/config/ApplConfigProperties.class new file mode 100644 index 00000000..c33e5626 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/config/ApplConfigProperties.class differ diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/controller/ErrorHandler.class b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/controller/ErrorHandler.class new file mode 100644 index 00000000..b8c838e5 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/controller/ErrorHandler.class differ diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/controller/XrequestFilter.class b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/controller/XrequestFilter.class new file mode 100644 index 00000000..eb154abb Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/api-gateway/build/classes/java/main/ru/demo/controller/XrequestFilter.class differ diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/build/resources/main/application.yml b/2024-07/spring-36-37-spring-cloud/api-gateway/build/resources/main/application.yml new file mode 100755 index 00000000..50e23846 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/build/resources/main/application.yml @@ -0,0 +1,52 @@ +spring: + application: + name: api-gateway + + +server: + port: 7777 + +application: + api-routes: + - id: "service-client" + from: "client" + to: "lb://SERVICE-CLIENT" + - id: "service-order" + from: "order" + to: "lb://SERVICE-ORDER" + +eureka: + client: + registerWithEureka: false + fetchRegistry: true + serviceUrl: + defaultZone: http://localhost:9999/eureka/ + instance: + lease-renewal-interval-in-seconds: 30 + metadataMap: + zone: zone1 + +management: + tracing: + sampling: + probability: 1.0 + endpoint: + prometheus: + enabled: true + metrics: + enabled: true + health: + enabled: true + probes: + enabled: true + refresh: + enabled: true + endpoints: + web: + exposure: + include: + - prometheus + - health + - metrics + - refresh + enabled-by-default: false \ No newline at end of file diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/build/resources/main/logback.xml b/2024-07/spring-36-37-spring-cloud/api-gateway/build/resources/main/logback.xml new file mode 100755 index 00000000..c20eb884 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/build/resources/main/logback.xml @@ -0,0 +1,25 @@ + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + localhost:9092 + applLogs + + + [ignore] + + {"appname":"api-gateway"} + + + + + + + + diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/build/tmp/compileJava/previous-compilation-data.bin b/2024-07/spring-36-37-spring-cloud/api-gateway/build/tmp/compileJava/previous-compilation-data.bin new file mode 100644 index 00000000..ad3ae123 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/api-gateway/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/hey b/2024-07/spring-36-37-spring-cloud/api-gateway/hey new file mode 100755 index 00000000..27aec446 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/api-gateway/hey differ diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/runLoad.sh b/2024-07/spring-36-37-spring-cloud/api-gateway/runLoad.sh new file mode 100755 index 00000000..7a0a9b20 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/runLoad.sh @@ -0,0 +1,3 @@ +#!/bin/bash +./hey -n=1000000 -c=1 -m GET http://localhost:7777/client/info?name=testClientName + diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/ApiGateway.java b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/ApiGateway.java new file mode 100755 index 00000000..6c3bc85a --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/ApiGateway.java @@ -0,0 +1,22 @@ +package ru.demo; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ApiGateway { + private static final Logger log = LoggerFactory.getLogger(ApiGateway.class); + + /* + curl -v http://localhost:7777/client/info?name=testClientName + curl -v http://localhost:7777/order/info?id=testOrderId + + */ + + public static void main(String[] args) { + SpringApplication.run(ApiGateway.class, args); + log.info("SrvApiGateway started"); + } +} diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/config/ApiConfig.java b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/config/ApiConfig.java new file mode 100755 index 00000000..c9526422 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/config/ApiConfig.java @@ -0,0 +1,34 @@ +package ru.demo.config; + +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.gateway.route.RouteLocator; +import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import ru.demo.controller.XrequestFilter; + +@Configuration +@EnableConfigurationProperties(ApplConfigProperties.class) +@EnableDiscoveryClient +public class ApiConfig { + + @Bean + public XrequestFilter xrequestFilter() { + return new XrequestFilter(); + } + + @Bean + RouteLocator gateway( + RouteLocatorBuilder rlb, ApplConfigProperties applConfigProperties, XrequestFilter xrequestFilter) { + var routesBuilder = rlb.routes(); + for (var route : applConfigProperties.getApiRoutes()) { + routesBuilder.route(route.id(), routeSpec -> routeSpec + .path(String.format("/%s/**", route.from())) + .filters(fs -> fs.filters(xrequestFilter) + .rewritePath(String.format("/%s/(?.*)", route.from()), "/${segment}")) + .uri(String.format("%s/@", route.to()))); + } + return routesBuilder.build(); + } +} diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/config/ApiRoute.java b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/config/ApiRoute.java new file mode 100755 index 00000000..85e84ccf --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/config/ApiRoute.java @@ -0,0 +1,3 @@ +package ru.demo.config; + +public record ApiRoute(String id, String from, String to) {} diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/config/ApplConfigProperties.java b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/config/ApplConfigProperties.java new file mode 100755 index 00000000..47cc8501 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/config/ApplConfigProperties.java @@ -0,0 +1,30 @@ +package ru.demo.config; + +import java.util.List; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.bind.ConstructorBinding; + +@ConfigurationProperties(prefix = "application") +public class ApplConfigProperties { + private final String authHost; + private final List apiRoutes; + + @ConstructorBinding + public ApplConfigProperties(String authHost, List apiRoutes) { + this.authHost = authHost; + this.apiRoutes = apiRoutes; + } + + public String getAuthHost() { + return authHost; + } + + public List getApiRoutes() { + return apiRoutes; + } + + @Override + public String toString() { + return "ApplConfigProperties{" + "authHost='" + authHost + '\'' + ", apiRoutes=" + apiRoutes + '}'; + } +} diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/controller/ErrorHandler.java b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/controller/ErrorHandler.java new file mode 100755 index 00000000..34fb8f5f --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/controller/ErrorHandler.java @@ -0,0 +1,38 @@ +package ru.demo.controller; + +import java.net.ConnectException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; +import reactor.util.annotation.NonNull; + +@Order(-2) +@Component +public class ErrorHandler implements ErrorWebExceptionHandler { + private static final Logger log = LoggerFactory.getLogger(ErrorHandler.class); + + @Override + public Mono handle(@NonNull ServerWebExchange serverWebExchange, @NonNull Throwable thr) { + var bufferFactory = serverWebExchange.getResponse().bufferFactory(); + var response = serverWebExchange.getResponse(); + response.getHeaders().setContentType(MediaType.APPLICATION_JSON); + + if (thr instanceof ConnectException) { + log.error("Target host connection error", thr); + response.setStatusCode(HttpStatus.SERVICE_UNAVAILABLE); + var dataBuffer = bufferFactory.wrap("Target host connection error".getBytes()); + return response.writeWith(Mono.just(dataBuffer)); + } else { + log.error("Unhandled exception", thr); + response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); + var dataBuffer = bufferFactory.wrap("Unhandled error".getBytes()); + return response.writeWith(Mono.just(dataBuffer)); + } + } +} diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/controller/XrequestFilter.java b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/controller/XrequestFilter.java new file mode 100755 index 00000000..0b8a5176 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/java/ru/demo/controller/XrequestFilter.java @@ -0,0 +1,24 @@ +package ru.demo.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.gateway.filter.GatewayFilter; +import org.springframework.cloud.gateway.filter.GatewayFilterChain; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +public class XrequestFilter implements GatewayFilter { + private static final String HEADER_X_REQUEST_ID = "X-Request-Id"; + private static final Logger log = LoggerFactory.getLogger(XrequestFilter.class); + + @Override + public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) { + var guid = java.util.UUID.randomUUID().toString(); + log.info("requestId:{}", guid); + + var request = + exchange.getRequest().mutate().header(HEADER_X_REQUEST_ID, guid).build(); + + return chain.filter(exchange.mutate().request(request).build()); + } +} diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/resources/application.yml b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/resources/application.yml new file mode 100755 index 00000000..50e23846 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/resources/application.yml @@ -0,0 +1,52 @@ +spring: + application: + name: api-gateway + + +server: + port: 7777 + +application: + api-routes: + - id: "service-client" + from: "client" + to: "lb://SERVICE-CLIENT" + - id: "service-order" + from: "order" + to: "lb://SERVICE-ORDER" + +eureka: + client: + registerWithEureka: false + fetchRegistry: true + serviceUrl: + defaultZone: http://localhost:9999/eureka/ + instance: + lease-renewal-interval-in-seconds: 30 + metadataMap: + zone: zone1 + +management: + tracing: + sampling: + probability: 1.0 + endpoint: + prometheus: + enabled: true + metrics: + enabled: true + health: + enabled: true + probes: + enabled: true + refresh: + enabled: true + endpoints: + web: + exposure: + include: + - prometheus + - health + - metrics + - refresh + enabled-by-default: false \ No newline at end of file diff --git a/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/resources/logback.xml b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/resources/logback.xml new file mode 100755 index 00000000..c20eb884 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/api-gateway/src/main/resources/logback.xml @@ -0,0 +1,25 @@ + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + localhost:9092 + applLogs + + + [ignore] + + {"appname":"api-gateway"} + + + + + + + + diff --git a/2024-07/spring-36-37-spring-cloud/build/tmp/spotless-register-dependencies b/2024-07/spring-36-37-spring-cloud/build/tmp/spotless-register-dependencies new file mode 100755 index 00000000..56a6051c --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/build/tmp/spotless-register-dependencies @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/2024-07/spring-36-37-spring-cloud/config-server/build.gradle.kts b/2024-07/spring-36-37-spring-cloud/config-server/build.gradle.kts new file mode 100755 index 00000000..3e355df7 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/config-server/build.gradle.kts @@ -0,0 +1,12 @@ +dependencies { + implementation(project(":kafka-log-appender")) + implementation("net.logstash.logback:logstash-logback-encoder") + + implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("io.micrometer:micrometer-registry-prometheus") + + implementation ("org.springframework.cloud:spring-cloud-config-server") + + implementation("io.micrometer:micrometer-tracing-bridge-otel") // bridges the Micrometer Observation API to OpenTelemetry. + implementation("io.opentelemetry:opentelemetry-exporter-zipkin") // reports traces to Zipkin. +} diff --git a/2024-07/spring-36-37-spring-cloud/config-server/build/classes/java/main/ru/demo/ConfigServer.class b/2024-07/spring-36-37-spring-cloud/config-server/build/classes/java/main/ru/demo/ConfigServer.class new file mode 100644 index 00000000..51b3b742 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/config-server/build/classes/java/main/ru/demo/ConfigServer.class differ diff --git a/2024-07/spring-36-37-spring-cloud/config-server/build/resources/main/application.yml b/2024-07/spring-36-37-spring-cloud/config-server/build/resources/main/application.yml new file mode 100755 index 00000000..cf8fe84c --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/config-server/build/resources/main/application.yml @@ -0,0 +1,38 @@ +server: + port: 8888 + +spring: + application: + name: config-server + cloud: + config: + server: + git: + uri: "git@github.com:petrelevich/jvm-digging.git" + search-paths: "spring-cloud/git-config" + ignoreLocalSshSettings: false + strictHostKeyChecking: false +management: + tracing: + sampling: + probability: 1.0 + endpoint: + prometheus: + enabled: true + metrics: + enabled: true + health: + enabled: true + probes: + enabled: true + refresh: + enabled: true + endpoints: + web: + exposure: + include: + - prometheus + - health + - metrics + - refresh + enabled-by-default: false diff --git a/2024-07/spring-36-37-spring-cloud/config-server/build/resources/main/logback.xml b/2024-07/spring-36-37-spring-cloud/config-server/build/resources/main/logback.xml new file mode 100755 index 00000000..85e2f041 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/config-server/build/resources/main/logback.xml @@ -0,0 +1,25 @@ + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + localhost:9092 + applLogs + + + [ignore] + + {"appname":"config-server"} + + + + + + + + diff --git a/2024-07/spring-36-37-spring-cloud/config-server/build/tmp/compileJava/previous-compilation-data.bin b/2024-07/spring-36-37-spring-cloud/config-server/build/tmp/compileJava/previous-compilation-data.bin new file mode 100644 index 00000000..602365ed Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/config-server/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/2024-07/spring-36-37-spring-cloud/config-server/src/main/java/ru/demo/ConfigServer.java b/2024-07/spring-36-37-spring-cloud/config-server/src/main/java/ru/demo/ConfigServer.java new file mode 100755 index 00000000..bbbb0a42 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/config-server/src/main/java/ru/demo/ConfigServer.java @@ -0,0 +1,19 @@ +package ru.demo; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.config.server.EnableConfigServer; + +@SpringBootApplication +@EnableConfigServer +public class ConfigServer { + private static final Logger log = LoggerFactory.getLogger(ConfigServer.class); + + public static void main(String[] args) { + + SpringApplication.run(ConfigServer.class, args); + log.info("ConfigServer started"); + } +} diff --git a/2024-07/spring-36-37-spring-cloud/config-server/src/main/resources/application.yml b/2024-07/spring-36-37-spring-cloud/config-server/src/main/resources/application.yml new file mode 100755 index 00000000..cf8fe84c --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/config-server/src/main/resources/application.yml @@ -0,0 +1,38 @@ +server: + port: 8888 + +spring: + application: + name: config-server + cloud: + config: + server: + git: + uri: "git@github.com:petrelevich/jvm-digging.git" + search-paths: "spring-cloud/git-config" + ignoreLocalSshSettings: false + strictHostKeyChecking: false +management: + tracing: + sampling: + probability: 1.0 + endpoint: + prometheus: + enabled: true + metrics: + enabled: true + health: + enabled: true + probes: + enabled: true + refresh: + enabled: true + endpoints: + web: + exposure: + include: + - prometheus + - health + - metrics + - refresh + enabled-by-default: false diff --git a/2024-07/spring-36-37-spring-cloud/config-server/src/main/resources/logback.xml b/2024-07/spring-36-37-spring-cloud/config-server/src/main/resources/logback.xml new file mode 100755 index 00000000..85e2f041 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/config-server/src/main/resources/logback.xml @@ -0,0 +1,25 @@ + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + localhost:9092 + applLogs + + + [ignore] + + {"appname":"config-server"} + + + + + + + + diff --git a/2024-07/spring-36-37-spring-cloud/elk/JVM (Micrometer)-1733760120676.json b/2024-07/spring-36-37-spring-cloud/elk/JVM (Micrometer)-1733760120676.json new file mode 100644 index 00000000..b0f42ea7 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/elk/JVM (Micrometer)-1733760120676.json @@ -0,0 +1,3880 @@ +{ + "__inputs": [ + { + "name": "DS_PROMETHEUS", + "label": "prometheus", + "description": "", + "type": "datasource", + "pluginId": "prometheus", + "pluginName": "Prometheus" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "11.4.0" + }, + { + "type": "datasource", + "id": "prometheus", + "name": "Prometheus", + "version": "1.0.0" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + }, + { + "type": "panel", + "id": "timeseries", + "name": "Time series", + "version": "" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "limit": 100, + "name": "Annotations & Alerts", + "showIn": 0, + "type": "dashboard" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "enable": true, + "expr": "resets(process_uptime_seconds{application=\"$application\", instance=\"$instance\"}[1m]) > 0", + "hide": false, + "iconColor": "rgba(255, 96, 96, 1)", + "name": "Restart Detection", + "showIn": 0, + "step": "1m", + "tagKeys": "restart-tag", + "textFormat": "uptime reset", + "titleFormat": "Restart" + } + ] + }, + "description": "Dashboard for Micrometer instrumented applications (Java, Spring Boot, Micronaut)", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 1, + "id": null, + "links": [], + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "reqps" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 148, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "min", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(request_counter_total{application=\"service-client\"}[1m])", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "{{application}}", + "range": true, + "refId": "A", + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } + } + ], + "title": "Счетчик запросов", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 149, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "min", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "request_duration{application=\"service-client\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "legendFormat": "{{application}}", + "range": true, + "refId": "A", + "useBackend": false, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + } + } + ], + "title": "Время выполнения запроса", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 8 + }, + "id": 139, + "panels": [], + "title": "Quick Facts", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "decimals": 1, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 0, + "y": 9 + }, + "id": 63, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "process_uptime_seconds{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "metric": "", + "refId": "A", + "step": 14400 + } + ], + "title": "Uptime", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "dateTimeAsIso" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 6, + "y": 9 + }, + "id": 92, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "process_start_time_seconds{application=\"$application\", instance=\"$instance\"}*1000", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "metric": "", + "refId": "A", + "step": 14400 + } + ], + "title": "Start time", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0.97)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 70 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 90 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 12, + "y": 9 + }, + "id": 65, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"heap\"})*100/sum(jvm_memory_max_bytes{application=\"$application\",instance=\"$instance\", area=\"heap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "refId": "A", + "step": 14400 + } + ], + "title": "Heap used", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "decimals": 2, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + }, + { + "options": { + "from": -1e+32, + "result": { + "text": "N/A" + }, + "to": 0 + }, + "type": "range" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(50, 172, 45, 0.97)", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 70 + }, + { + "color": "rgba(245, 54, 54, 0.9)", + "value": 90 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 18, + "y": 9 + }, + "id": 75, + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"nonheap\"})*100/sum(jvm_memory_max_bytes{application=\"$application\",instance=\"$instance\", area=\"nonheap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "refId": "A", + "step": 14400 + } + ], + "title": "Non-Heap used", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 12 + }, + "id": 140, + "panels": [], + "title": "I/O Overview", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 0, + "y": 13 + }, + "id": 111, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(rate(http_server_requests_seconds_count{application=\"$application\", instance=\"$instance\"}[1m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "HTTP", + "refId": "A" + } + ], + "title": "Rate", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "HTTP" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#890f02", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "HTTP - 5xx" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#bf1b00", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "HTTP" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#890f02", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "HTTP - 5xx" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#bf1b00", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 6, + "y": 13 + }, + "id": 112, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(rate(http_server_requests_seconds_count{application=\"$application\", instance=\"$instance\", status=~\"5..\"}[1m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "HTTP - 5xx", + "refId": "A" + } + ], + "title": "Errors", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 12, + "y": 13 + }, + "id": 113, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(rate(http_server_requests_seconds_sum{application=\"$application\", instance=\"$instance\", status!~\"5..\"}[1m]))/sum(rate(http_server_requests_seconds_count{application=\"$application\", instance=\"$instance\", status!~\"5..\"}[1m]))", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "HTTP - AVG", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "max(http_server_requests_seconds_max{application=\"$application\", instance=\"$instance\", status!~\"5..\"})", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "HTTP - MAX", + "refId": "B" + } + ], + "title": "Duration", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 18, + "y": 13 + }, + "id": 119, + "options": { + "legend": { + "calcs": [ + "lastNotNull" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "tomcat_threads_busy_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "TOMCAT - BSY", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "tomcat_threads_current_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "TOMCAT - CUR", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "tomcat_threads_config_max_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "TOMCAT - MAX", + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jetty_threads_busy{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "JETTY - BSY", + "refId": "D" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jetty_threads_current{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "JETTY - CUR", + "refId": "E" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jetty_threads_config_max{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "JETTY - MAX", + "refId": "F" + } + ], + "title": "Utilisation", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 20 + }, + "id": 141, + "panels": [], + "title": "JVM Memory", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 0, + "y": 21 + }, + "id": 24, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"heap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", area=\"heap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "committed", + "refId": "B", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", area=\"heap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "max", + "refId": "C", + "step": 2400 + } + ], + "title": "JVM Heap", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 6, + "y": 21 + }, + "id": 25, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"nonheap\"})", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", area=\"nonheap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "committed", + "refId": "B", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", area=\"nonheap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "max", + "refId": "C", + "step": 2400 + } + ], + "title": "JVM Non-Heap", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 12, + "y": 21 + }, + "id": 26, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "committed", + "refId": "B", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "max", + "refId": "C", + "step": 2400 + } + ], + "title": "JVM Total", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "bytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 18, + "y": 21 + }, + "id": 86, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "process_memory_vss_bytes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": true, + "intervalFactor": 2, + "legendFormat": "vss", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "process_memory_rss_bytes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "rss", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "process_memory_swap_bytes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "swap", + "refId": "C" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "process_memory_rss_bytes{application=\"$application\", instance=\"$instance\"} + process_memory_swap_bytes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "total", + "refId": "D" + } + ], + "title": "JVM Process Memory", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 28 + }, + "id": 142, + "panels": [], + "title": "JVM Misc", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 1, + "mappings": [], + "max": 1, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 0, + "y": 29 + }, + "id": 106, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "system_cpu_usage{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "system", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "process_cpu_usage{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "process", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "avg_over_time(process_cpu_usage{application=\"$application\", instance=\"$instance\"}[15m])", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "process-15m", + "refId": "C" + } + ], + "title": "CPU Usage", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 1, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 6, + "y": 29 + }, + "id": 93, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "system_load_average_1m{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "system-1m", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "system_cpu_count{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "cpus", + "refId": "B" + } + ], + "title": "Load", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 0, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 12, + "y": 29 + }, + "id": 32, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_threads_live_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "live", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_threads_daemon_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "daemon", + "metric": "", + "refId": "B", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_threads_peak_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "peak", + "refId": "C", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "process_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "process", + "refId": "D", + "step": 2400 + } + ], + "title": "Threads", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "blocked" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#bf1b00", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "new" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#fce2de", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "runnable" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#7eb26d", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "terminated" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#511749", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "timed-waiting" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c15c17", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "waiting" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#eab839", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "blocked" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#bf1b00", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "new" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#fce2de", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "runnable" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#7eb26d", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "terminated" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#511749", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "timed-waiting" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#c15c17", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "waiting" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#eab839", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 18, + "y": 29 + }, + "id": 124, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_threads_states_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{state}}", + "refId": "A" + } + ], + "title": "Thread States", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "description": "The percent of time spent on Garbage Collection over all CPUs assigned to the JVM process.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 1, + "mappings": [], + "max": 1, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 0, + "y": 36 + }, + "id": 138, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "sum(rate(jvm_gc_pause_seconds_sum{application=\"$application\", instance=\"$instance\"}[1m])) by (application, instance) / on(application, instance) system_cpu_count", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "CPU time spent on GC", + "refId": "A" + } + ], + "title": "GC Pressure", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 0, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "opm" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "debug" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#1F78C1", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "error" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#BF1B00", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "info" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#508642", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "trace" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#6ED0E0", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "warn" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "#EAB839", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 6, + "y": 36 + }, + "id": 91, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "increase(logback_events_total{application=\"$application\", instance=\"$instance\"}[1m])", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{level}}", + "metric": "", + "refId": "A", + "step": 1200 + } + ], + "title": "Log Events", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "log": 10, + "type": "log" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "decimals": 0, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 18, + "y": 36 + }, + "id": 61, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "process_files_open_files{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "open", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "process_files_max_files{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "max", + "metric": "", + "refId": "B", + "step": 2400 + } + ], + "title": "File Descriptors", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 43 + }, + "id": 143, + "panels": [], + "repeat": "persistence_counts", + "title": "JVM Memory Pools (Heap)", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 44 + }, + "id": 3, + "maxPerRow": 3, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "repeat": "jvm_memory_pool_heap", + "repeatDirection": "h", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", id=~\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 1800 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", id=~\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "commited", + "metric": "", + "refId": "B", + "step": 1800 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", id=~\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "max", + "metric": "", + "refId": "C", + "step": 1800 + } + ], + "title": "$jvm_memory_pool_heap", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 51 + }, + "id": 144, + "panels": [], + "title": "JVM Memory Pools (Non-Heap)", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 52 + }, + "id": 78, + "maxPerRow": 3, + "options": { + "legend": { + "calcs": [ + "lastNotNull", + "max" + ], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "repeat": "jvm_memory_pool_nonheap", + "repeatDirection": "h", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", id=~\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 1800 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", id=~\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "commited", + "metric": "", + "refId": "B", + "step": 1800 + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", id=~\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "max", + "metric": "", + "refId": "C", + "step": 1800 + } + ], + "title": "$jvm_memory_pool_nonheap", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 66 + }, + "id": 145, + "panels": [], + "title": "Garbage Collection", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ops" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 67 + }, + "id": 98, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "rate(jvm_gc_pause_seconds_count{application=\"$application\", instance=\"$instance\"}[1m])", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "{{action}} ({{cause}})", + "refId": "A" + } + ], + "title": "Collections", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 67 + }, + "id": 101, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "rate(jvm_gc_pause_seconds_sum{application=\"$application\", instance=\"$instance\"}[1m])/rate(jvm_gc_pause_seconds_count{application=\"$application\", instance=\"$instance\"}[1m])", + "format": "time_series", + "hide": false, + "instant": false, + "intervalFactor": 1, + "legendFormat": "avg {{action}} ({{cause}})", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_gc_pause_seconds_max{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "instant": false, + "intervalFactor": 1, + "legendFormat": "max {{action}} ({{cause}})", + "refId": "B" + } + ], + "title": "Pause Durations", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "Bps" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 67 + }, + "id": 99, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "rate(jvm_gc_memory_allocated_bytes_total{application=\"$application\", instance=\"$instance\"}[1m])", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "allocated", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "rate(jvm_gc_memory_promoted_bytes_total{application=\"$application\", instance=\"$instance\"}[1m])", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "promoted", + "refId": "B" + } + ], + "title": "Allocated/Promoted", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 74 + }, + "id": 146, + "panels": [], + "title": "Classloading", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 75 + }, + "id": 37, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_classes_loaded_classes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "loaded", + "metric": "", + "refId": "A", + "step": 1200 + } + ], + "title": "Classes loaded", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 75 + }, + "id": 38, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "pluginVersion": "11.4.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "delta(jvm_classes_loaded_classes{application=\"$application\",instance=\"$instance\"}[1m])", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 1, + "legendFormat": "delta-1m", + "metric": "", + "refId": "A", + "step": 1200 + } + ], + "title": "Class delta", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 82 + }, + "id": 147, + "panels": [], + "title": "Buffer Pools", + "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "fieldConfig": { + "defaults": {}, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "count" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 0 + }, + { + "id": "custom.axisPlacement", + "value": "right" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "buffers" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 0 + }, + { + "id": "custom.axisPlacement", + "value": "right" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "count" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 0 + }, + { + "id": "custom.axisPlacement", + "value": "right" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "buffers" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 0 + }, + { + "id": "custom.axisPlacement", + "value": "right" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "count" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 0 + }, + { + "id": "custom.axisPlacement", + "value": "right" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "buffers" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 0 + }, + { + "id": "custom.axisPlacement", + "value": "right" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "count" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 0 + }, + { + "id": "custom.axisPlacement", + "value": "right" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "buffers" + }, + "properties": [ + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 0 + }, + { + "id": "custom.axisPlacement", + "value": "right" + } + ] + } + ] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 83 + }, + "id": 131, + "maxPerRow": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "none" + } + }, + "repeat": "jvm_buffer_pool", + "repeatDirection": "h", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_buffer_memory_used_bytes{application=\"$application\", instance=\"$instance\", id=~\"$jvm_buffer_pool\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "used", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_buffer_total_capacity_bytes{application=\"$application\", instance=\"$instance\", id=~\"$jvm_buffer_pool\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "capacity", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "expr": "jvm_buffer_count_buffers{application=\"$application\", instance=\"$instance\", id=~\"$jvm_buffer_pool\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "buffers", + "refId": "C" + } + ], + "title": "$jvm_buffer_pool", + "type": "timeseries" + } + ], + "refresh": "5s", + "schemaVersion": 40, + "tags": [], + "templating": { + "list": [ + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "includeAll": false, + "label": "Application", + "name": "application", + "options": [], + "query": "label_values(application)", + "refresh": 2, + "regex": "", + "type": "query" + }, + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "includeAll": false, + "label": "Instance", + "name": "instance", + "options": [], + "query": "label_values(jvm_memory_used_bytes{application=\"$application\"}, instance)", + "refresh": 2, + "regex": "", + "type": "query" + }, + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "hide": 2, + "includeAll": true, + "label": "JVM Memory Pools Heap", + "name": "jvm_memory_pool_heap", + "options": [], + "query": "label_values(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"heap\"},id)", + "refresh": 1, + "regex": "", + "sort": 1, + "type": "query" + }, + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "hide": 2, + "includeAll": true, + "label": "JVM Memory Pools Non-Heap", + "name": "jvm_memory_pool_nonheap", + "options": [], + "query": "label_values(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"nonheap\"},id)", + "refresh": 1, + "regex": "", + "sort": 2, + "type": "query" + }, + { + "current": {}, + "datasource": { + "type": "prometheus", + "uid": "${DS_PROMETHEUS}" + }, + "hide": 2, + "includeAll": true, + "label": "JVM Buffer Pools", + "name": "jvm_buffer_pool", + "options": [], + "query": "label_values(jvm_buffer_memory_used_bytes{application=\"$application\", instance=\"$instance\"},id)", + "refresh": 1, + "regex": "", + "sort": 1, + "type": "query" + } + ] + }, + "time": { + "from": "now-15m", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "JVM (Micrometer)", + "uid": "fe6atqkegecqoe", + "version": 4, + "weekStart": "" +} \ No newline at end of file diff --git a/2024-07/spring-36-37-spring-cloud/elk/docker-compose.yml b/2024-07/spring-36-37-spring-cloud/elk/docker-compose.yml new file mode 100755 index 00000000..34b58852 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/elk/docker-compose.yml @@ -0,0 +1,143 @@ + +services: + opensearch-node1: + image: opensearchproject/opensearch:2.18.0 + container_name: opensearch-node1 + environment: + - cluster.name=opensearch-cluster # Name the cluster + - node.name=opensearch-node1 # Name the node that will run in this container + - discovery.seed_hosts=opensearch-node1,opensearch-node2 # Nodes to look for when discovering the cluster + - cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2 # Nodes eligibile to serve as cluster manager + - bootstrap.memory_lock=true # Disable JVM heap memory swapping + - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # Set min and max JVM heap sizes to at least 50% of system RAM + - "DISABLE_INSTALL_DEMO_CONFIG=true" # Prevents execution of bundled demo script which installs demo certificates and security configurations to OpenSearch + - "DISABLE_SECURITY_PLUGIN=true" # Disables Security plugin + ulimits: + memlock: + soft: -1 # Set memlock to unlimited (no soft or hard limit) + hard: -1 + nofile: + soft: 65536 # Maximum number of open files for the opensearch user - set to at least 65536 + hard: 65536 + volumes: + - opensearch-data1:/usr/share/opensearch/data # Creates volume called opensearch-data1 and mounts it to the container + ports: + - 9200:9200 # REST API + - 9600:9600 # Performance Analyzer + networks: + - opensearch-net # All of the containers will join the same Docker bridge network + opensearch-node2: + image: opensearchproject/opensearch:2.18.0 + container_name: opensearch-node2 + environment: + - cluster.name=opensearch-cluster # Name the cluster + - node.name=opensearch-node2 # Name the node that will run in this container + - discovery.seed_hosts=opensearch-node1,opensearch-node2 # Nodes to look for when discovering the cluster + - cluster.initial_cluster_manager_nodes=opensearch-node1,opensearch-node2 # Nodes eligibile to serve as cluster manager + - bootstrap.memory_lock=true # Disable JVM heap memory swapping + - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m" # Set min and max JVM heap sizes to at least 50% of system RAM + - "DISABLE_INSTALL_DEMO_CONFIG=true" # Prevents execution of bundled demo script which installs demo certificates and security configurations to OpenSearch + - "DISABLE_SECURITY_PLUGIN=true" # Disables Security plugin + ulimits: + memlock: + soft: -1 # Set memlock to unlimited (no soft or hard limit) + hard: -1 + nofile: + soft: 65536 # Maximum number of open files for the opensearch user - set to at least 65536 + hard: 65536 + volumes: + - opensearch-data2:/usr/share/opensearch/data # Creates volume called opensearch-data2 and mounts it to the container + networks: + - opensearch-net # All of the containers will join the same Docker bridge network + opensearch-dashboards: + image: opensearchproject/opensearch-dashboards:2.18.0 + container_name: opensearch-dashboards + ports: + - 5601:5601 # Map host port 5601 to container port 5601 + expose: + - "5601" # Expose port 5601 for web access to OpenSearch Dashboards + environment: + - 'OPENSEARCH_HOSTS=["http://opensearch-node1:9200","http://opensearch-node2:9200"]' + - "DISABLE_SECURITY_DASHBOARDS_PLUGIN=true" # disables security dashboards plugin in OpenSearch Dashboards + networks: + - opensearch-net + +#logstash + + logstash: + image: opensearchproject/logstash-oss-with-opensearch-output-plugin:7.16.2 + container_name: logstash + volumes: + - ./logstash.conf:/usr/share/logstash/pipeline/logstash.conf + networks: + - opensearch-net + + zookeeper: + image: confluentinc/cp-zookeeper:6.2.0 + container_name: zookeeper + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + ZOOKEEPER_TICK_TIME: 2000 + networks: + - opensearch-net + + broker: + image: confluentinc/cp-kafka:7.0.0 + container_name: broker + ports: + - "9092:9092" + depends_on: + - zookeeper + environment: + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181' + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_INTERNAL:PLAINTEXT + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092,PLAINTEXT_INTERNAL://broker:29092 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 + KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 + networks: + - opensearch-net + + kafka-ui: + container_name: kafka-ui + image: provectuslabs/kafka-ui:latest + network_mode: "host" + environment: + DYNAMIC_CONFIG_ENABLED: 'true' + + zipkin: + container_name: zipkin + image: openzipkin/zipkin:3 + network_mode: "host" + expose: + - "9411" + + prometheus: + image: bitnami/prometheus:3.0.1 + container_name: prometheus + network_mode: "host" + expose: + - "9090" + volumes: + - type: bind + source: ./prometheus.yml + target: /etc/prometheus/prometheus.yml + + grafana: + image: grafana/grafana-enterprise:11.4.0 + container_name: grafana + network_mode: "host" + expose: + - "3000" + environment: + GF_SECURITY_ADMIN_USER: "grafana" + GF_SECURITY_ADMIN_PASSWORD: "grafana" + + +volumes: + opensearch-data1: + opensearch-data2: + +networks: + opensearch-net: \ No newline at end of file diff --git a/2024-07/spring-36-37-spring-cloud/elk/logstash.conf b/2024-07/spring-36-37-spring-cloud/elk/logstash.conf new file mode 100644 index 00000000..35bb470e --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/elk/logstash.conf @@ -0,0 +1,24 @@ +input { + http { + id => "test_http_plugin_id" + host => "127.0.0.1" + port => 8080 + } + + kafka { + bootstrap_servers => "broker:29092" + topics => "applLogs" + codec => "json" + } +} + +output { + opensearch { + hosts => "http://opensearch-node1:9200" + user => "admin" + password => "admin" + index => "logstash-logs-%{+YYYY.MM.dd}" + ssl_certificate_verification => false + ssl => false + } +} \ No newline at end of file diff --git a/2024-07/spring-36-37-spring-cloud/elk/prometheus.yml b/2024-07/spring-36-37-spring-cloud/elk/prometheus.yml new file mode 100755 index 00000000..efdaf62d --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/elk/prometheus.yml @@ -0,0 +1,11 @@ +# JVM (Micrometer) Grafana dashboard: 4701 +global: + scrape_interval: 10s + evaluation_interval: 15s + +scrape_configs: + - job_name: service-client + metrics_path: '/actuator/prometheus' + scrape_interval: 5s + static_configs: + - targets: ['localhost:8081'] diff --git a/2024-07/spring-36-37-spring-cloud/eureka-server/build.gradle.kts b/2024-07/spring-36-37-spring-cloud/eureka-server/build.gradle.kts new file mode 100755 index 00000000..86f0e5c4 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/eureka-server/build.gradle.kts @@ -0,0 +1,13 @@ +dependencies { + implementation(project(":kafka-log-appender")) + implementation("net.logstash.logback:logstash-logback-encoder") + + implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("io.micrometer:micrometer-registry-prometheus") + + implementation ("org.springframework.cloud:spring-cloud-config-server") + implementation ("org.springframework.cloud:spring-cloud-starter-netflix-eureka-server") + + implementation("io.micrometer:micrometer-tracing-bridge-otel") // bridges the Micrometer Observation API to OpenTelemetry. + implementation("io.opentelemetry:opentelemetry-exporter-zipkin") // reports traces to Zipkin. +} diff --git a/2024-07/spring-36-37-spring-cloud/eureka-server/build/classes/java/main/ru/demo/EurekaServer.class b/2024-07/spring-36-37-spring-cloud/eureka-server/build/classes/java/main/ru/demo/EurekaServer.class new file mode 100644 index 00000000..d3835de7 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/eureka-server/build/classes/java/main/ru/demo/EurekaServer.class differ diff --git a/2024-07/spring-36-37-spring-cloud/eureka-server/build/resources/main/application.yml b/2024-07/spring-36-37-spring-cloud/eureka-server/build/resources/main/application.yml new file mode 100755 index 00000000..3857bd82 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/eureka-server/build/resources/main/application.yml @@ -0,0 +1,42 @@ +spring: + application: + name: eureka-server +server: + port: 9999 + +eureka: + server: + renewal-percent-threshold: 0.5 + instance: + hostname: localhost + lease-expiration-duration-in-seconds: 90 + client: + registerWithEureka: false + fetchRegistry: false + serviceUrl: + defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ + +management: + tracing: + sampling: + probability: 1.0 + endpoint: + prometheus: + enabled: true + metrics: + enabled: true + health: + enabled: true + probes: + enabled: true + refresh: + enabled: true + endpoints: + web: + exposure: + include: + - prometheus + - health + - metrics + - refresh + enabled-by-default: false diff --git a/2024-07/spring-36-37-spring-cloud/eureka-server/build/resources/main/logback.xml b/2024-07/spring-36-37-spring-cloud/eureka-server/build/resources/main/logback.xml new file mode 100755 index 00000000..01075dfc --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/eureka-server/build/resources/main/logback.xml @@ -0,0 +1,25 @@ + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + localhost:9092 + applLogs + + + [ignore] + + {"appname":"eureka-server"} + + + + + + + + diff --git a/2024-07/spring-36-37-spring-cloud/eureka-server/build/tmp/compileJava/previous-compilation-data.bin b/2024-07/spring-36-37-spring-cloud/eureka-server/build/tmp/compileJava/previous-compilation-data.bin new file mode 100644 index 00000000..740ae9dd Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/eureka-server/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/2024-07/spring-36-37-spring-cloud/eureka-server/src/main/java/ru/demo/EurekaServer.java b/2024-07/spring-36-37-spring-cloud/eureka-server/src/main/java/ru/demo/EurekaServer.java new file mode 100755 index 00000000..34063ca5 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/eureka-server/src/main/java/ru/demo/EurekaServer.java @@ -0,0 +1,19 @@ +package ru.demo; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; + +@SpringBootApplication +@EnableEurekaServer +public class EurekaServer { + private static final Logger log = LoggerFactory.getLogger(EurekaServer.class); + + public static void main(String[] args) { + + SpringApplication.run(EurekaServer.class, args); + log.info("EurekaServer started"); + } +} diff --git a/2024-07/spring-36-37-spring-cloud/eureka-server/src/main/resources/application.yml b/2024-07/spring-36-37-spring-cloud/eureka-server/src/main/resources/application.yml new file mode 100755 index 00000000..3857bd82 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/eureka-server/src/main/resources/application.yml @@ -0,0 +1,42 @@ +spring: + application: + name: eureka-server +server: + port: 9999 + +eureka: + server: + renewal-percent-threshold: 0.5 + instance: + hostname: localhost + lease-expiration-duration-in-seconds: 90 + client: + registerWithEureka: false + fetchRegistry: false + serviceUrl: + defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ + +management: + tracing: + sampling: + probability: 1.0 + endpoint: + prometheus: + enabled: true + metrics: + enabled: true + health: + enabled: true + probes: + enabled: true + refresh: + enabled: true + endpoints: + web: + exposure: + include: + - prometheus + - health + - metrics + - refresh + enabled-by-default: false diff --git a/2024-07/spring-36-37-spring-cloud/eureka-server/src/main/resources/logback.xml b/2024-07/spring-36-37-spring-cloud/eureka-server/src/main/resources/logback.xml new file mode 100755 index 00000000..01075dfc --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/eureka-server/src/main/resources/logback.xml @@ -0,0 +1,25 @@ + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + localhost:9092 + applLogs + + + [ignore] + + {"appname":"eureka-server"} + + + + + + + + diff --git a/2024-07/spring-36-37-spring-cloud/git-config/application.yml b/2024-07/spring-36-37-spring-cloud/git-config/application.yml new file mode 100755 index 00000000..a5328e56 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/git-config/application.yml @@ -0,0 +1,28 @@ +management: + tracing: + sampling: + probability: 1.0 + endpoint: + prometheus: + enabled: true + metrics: + enabled: true + health: + enabled: true + probes: + enabled: true + refresh: + enabled: true + endpoints: + web: + exposure: + include: + - prometheus + - health + - metrics + - refresh + enabled-by-default: false + metrics: + tags: + application: ${spring.application.name} + diff --git a/2024-07/spring-36-37-spring-cloud/git-config/service-client-info.yml b/2024-07/spring-36-37-spring-cloud/git-config/service-client-info.yml new file mode 100755 index 00000000..9899989d --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/git-config/service-client-info.yml @@ -0,0 +1,2 @@ +server: + port: 8083 \ No newline at end of file diff --git a/2024-07/spring-36-37-spring-cloud/git-config/service-client.yml b/2024-07/spring-36-37-spring-cloud/git-config/service-client.yml new file mode 100755 index 00000000..54b155ff --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/git-config/service-client.yml @@ -0,0 +1,2 @@ +server: + port: 8081 \ No newline at end of file diff --git a/2024-07/spring-36-37-spring-cloud/git-config/service-order.yml b/2024-07/spring-36-37-spring-cloud/git-config/service-order.yml new file mode 100755 index 00000000..4a2daf55 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/git-config/service-order.yml @@ -0,0 +1,2 @@ +server: + port: 8082 diff --git a/2024-07/spring-36-37-spring-cloud/gradle/wrapper/gradle-wrapper.jar b/2024-07/spring-36-37-spring-cloud/gradle/wrapper/gradle-wrapper.jar new file mode 100755 index 00000000..d64cd491 Binary files /dev/null and b/2024-07/spring-36-37-spring-cloud/gradle/wrapper/gradle-wrapper.jar differ diff --git a/2024-07/spring-36-37-spring-cloud/gradle/wrapper/gradle-wrapper.properties b/2024-07/spring-36-37-spring-cloud/gradle/wrapper/gradle-wrapper.properties new file mode 100755 index 00000000..df97d72b --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/2024-07/spring-36-37-spring-cloud/gradlew b/2024-07/spring-36-37-spring-cloud/gradlew new file mode 100755 index 00000000..1aa94a42 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/2024-07/spring-36-37-spring-cloud/gradlew.bat b/2024-07/spring-36-37-spring-cloud/gradlew.bat new file mode 100755 index 00000000..93e3f59f --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/2024-07/spring-36-37-spring-cloud/service-order/build/tmp/bootJar/MANIFEST.MF b/2024-07/spring-36-37-spring-cloud/service-order/build/tmp/bootJar/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/service-order/build/tmp/bootJar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/2024-07/spring-36-37-spring-cloud/service-order/build/tmp/jar/MANIFEST.MF b/2024-07/spring-36-37-spring-cloud/service-order/build/tmp/jar/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/service-order/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/Config.java b/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/Config.java new file mode 100755 index 00000000..ac7f5a38 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/Config.java @@ -0,0 +1,15 @@ +package ru.demo; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import ru.demo.controller.InstanceId; + +@Configuration +public class Config { + + @Bean + InstanceId instanceId(@Value("${spring.application.instance_id}") String id) { + return new InstanceId(id); + } +} diff --git a/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/ServiceOrder.java b/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/ServiceOrder.java new file mode 100755 index 00000000..106c40b3 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/ServiceOrder.java @@ -0,0 +1,11 @@ +package ru.demo; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; + +@SpringBootApplication +public class ServiceOrder { + public static void main(String[] args) { + new SpringApplicationBuilder().sources(ServiceOrder.class).run(args); + } +} diff --git a/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/controller/InstanceId.java b/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/controller/InstanceId.java new file mode 100755 index 00000000..73d8c740 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/controller/InstanceId.java @@ -0,0 +1,3 @@ +package ru.demo.controller; + +public record InstanceId(String name) {} diff --git a/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/controller/OrderController.java b/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/controller/OrderController.java new file mode 100755 index 00000000..33307da2 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/service-order/src/main/java/ru/demo/controller/OrderController.java @@ -0,0 +1,28 @@ +package ru.demo.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class OrderController { + private static final Logger logger = LoggerFactory.getLogger(OrderController.class); + private final InstanceId instanceId; + + public OrderController(InstanceId instanceId) { + this.instanceId = instanceId; + } + + // curl -v http://localhost:8082/info?id="idClient" + + // curl -v http://localhost:8091/info?id="idClient" + // curl -v http://localhost:8092/info?id="idClient" + + @GetMapping(value = "/info") + public String info(@RequestParam(name = "id") String id) { + logger.info("instanceId:{}, request. id:{}", instanceId.name(), id); + return String.format("%s, Order id:%s", instanceId.name(), id); + } +} diff --git a/2024-07/spring-36-37-spring-cloud/service-order/src/main/resources/application.yml b/2024-07/spring-36-37-spring-cloud/service-order/src/main/resources/application.yml new file mode 100755 index 00000000..f67f599c --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/service-order/src/main/resources/application.yml @@ -0,0 +1,28 @@ +spring: + application: + name: service-order + instance_id: i0 + cloud: + config: + fail-fast: true + retry: + initial-interval: 5000 + max-attempts: 10 + max-interval: 5000 + multiplier: 1.2 + config: + import: optional:configserver:http://localhost:8888 + codec: + max-in-memory-size: 10MB + +eureka: + client: + fetchRegistry: false + serviceUrl: + defaultZone: http://localhost:9999/eureka/ + instance: + instance-id: service-order:${spring.application.instance_id:0} + lease-renewal-interval-in-seconds: 30 + metadataMap: + zone: zone1 + diff --git a/2024-07/spring-36-37-spring-cloud/service-order/src/main/resources/logback.xml b/2024-07/spring-36-37-spring-cloud/service-order/src/main/resources/logback.xml new file mode 100755 index 00000000..c74d4279 --- /dev/null +++ b/2024-07/spring-36-37-spring-cloud/service-order/src/main/resources/logback.xml @@ -0,0 +1,26 @@ + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - [%X{requestId}] %msg%n + + + + + localhost:9092 + applLogs + + + [ignore] + + {"appname":"service-order"} + requestId + + + + + + + +