From 503e307c69b76c371927f167c57c8b43302f6bc1 Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Sun, 6 Apr 2025 18:21:51 +0200 Subject: [PATCH] remove influx monitoring --- README.md | 7 ------ build.gradle.kts | 12 --------- .../hlaeja/service/AuthenticationService.kt | 15 ----------- .../hlaeja/service/DeviceRegistryService.kt | 15 ----------- src/main/resources/application.yml | 25 ------------------- 5 files changed, 74 deletions(-) diff --git a/README.md b/README.md index 93f74f0..97f434a 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,6 @@ Classes and endpoints, to shape and to steer, Devices and sensors, their purpose | jwt.public-key | ✓ | JWT public key file | | account-registry.url | ✓ | Account Register URL | | device-registry.url | ✓ | Device Register URL | -| management.influx.metrics.export.api-version | | InfluxDB API version | -| management.influx.metrics.export.enabled | | Enable/Disable exporting metrics to InfluxDB | -| management.influx.metrics.export.bucket | ✓ | InfluxDB bucket name | -| management.influx.metrics.export.org | ✓ | InfluxDB organization | -| management.influx.metrics.export.token | ✗ | InfluxDB token | -| management.influx.metrics.export.uri | ✓ | InfluxDB URL | -| management.metrics.tags.application | ✓ | Application instance tag for metrics | *Required: ✓ can be stored as text, and ✗ need to be stored as secret.* diff --git a/build.gradle.kts b/build.gradle.kts index 81255f1..548981a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,3 @@ -import com.bmuschko.gradle.docker.tasks.container.DockerCreateContainer - plugins { alias(hlaeja.plugins.kotlin.jvm) alias(hlaeja.plugins.kotlin.spring) @@ -17,7 +15,6 @@ dependencies { implementation(hlaeja.kotlinx.coroutines) implementation(hlaeja.library.hlaeja.common.messages) implementation(hlaeja.library.hlaeja.jwt) - implementation(hlaeja.micrometer.registry.influx) implementation(hlaeja.springboot.starter.actuator) implementation(hlaeja.springboot.starter.security) implementation(hlaeja.springboot.starter.webflux) @@ -33,16 +30,7 @@ dependencies { group = "ltd.hlaeja" -fun influxDbToken(): String = config.findOrDefault("influxdb.token", "INFLUXDB_TOKEN", "") - tasks { - named("containerCreate", DockerCreateContainer::class) { - withEnvVar("MANAGEMENT_INFLUX_METRICS_EXPORT_TOKEN", influxDbToken()) - } - withType { - filesMatching("**/application.yml") { filter { it.replace("%INFLUXDB_TOKEN%", influxDbToken()) } } - onlyIf { file("src/main/resources/application.yml").exists() } - } named("processResources") { dependsOn("copyCertificates") } diff --git a/src/main/kotlin/ltd/hlaeja/service/AuthenticationService.kt b/src/main/kotlin/ltd/hlaeja/service/AuthenticationService.kt index b7f73ba..6c5f7f4 100644 --- a/src/main/kotlin/ltd/hlaeja/service/AuthenticationService.kt +++ b/src/main/kotlin/ltd/hlaeja/service/AuthenticationService.kt @@ -1,8 +1,6 @@ package ltd.hlaeja.service import io.github.oshai.kotlinlogging.KotlinLogging -import io.micrometer.core.instrument.Counter -import io.micrometer.core.instrument.MeterRegistry import ltd.hlaeja.library.accountRegistry.Authentication import ltd.hlaeja.property.AccountRegistryProperty import ltd.hlaeja.util.accountRegistryAuthenticate @@ -19,33 +17,20 @@ private val log = KotlinLogging.logger {} @Service class AuthenticationService( - meterRegistry: MeterRegistry, private val webClient: WebClient, private val property: AccountRegistryProperty, ) { - private val accountRegistrySuccess = Counter.builder("account.registry.success") - .description("Number of successful account registry calls") - .register(meterRegistry) - - private val accountRegistryFailure = Counter.builder("account.registry.failure") - .description("Number of failed account registry calls") - .register(meterRegistry) - suspend fun authenticate( request: Authentication.Request, ): Authentication.Response = try { webClient.accountRegistryAuthenticate(request, property) - .also { accountRegistrySuccess.increment() } } catch (e: ErrorResponseException) { - accountRegistryFailure.increment() throw e } catch (e: WebClientRequestException) { - accountRegistryFailure.increment() log.error(e) { "Error device registry" } throw ResponseStatusException(SERVICE_UNAVAILABLE) } catch (e: WebClientResponseException) { - accountRegistryFailure.increment() log.error(e) { "Error device registry" } throw ResponseStatusException(INTERNAL_SERVER_ERROR) } diff --git a/src/main/kotlin/ltd/hlaeja/service/DeviceRegistryService.kt b/src/main/kotlin/ltd/hlaeja/service/DeviceRegistryService.kt index d4ba554..fc05538 100644 --- a/src/main/kotlin/ltd/hlaeja/service/DeviceRegistryService.kt +++ b/src/main/kotlin/ltd/hlaeja/service/DeviceRegistryService.kt @@ -1,8 +1,6 @@ package ltd.hlaeja.service import io.github.oshai.kotlinlogging.KotlinLogging -import io.micrometer.core.instrument.Counter -import io.micrometer.core.instrument.MeterRegistry import ltd.hlaeja.library.deviceRegistry.Device import ltd.hlaeja.property.DeviceRegistryProperty import ltd.hlaeja.util.deviceRegistryCreateDevice @@ -19,33 +17,20 @@ private val log = KotlinLogging.logger {} @Service class DeviceRegistryService( - meterRegistry: MeterRegistry, private val webClient: WebClient, private val deviceRegistryProperty: DeviceRegistryProperty, ) { - private val registerDeviceSuccess = Counter.builder("device.registry.success") - .description("Number of successful device registrations") - .register(meterRegistry) - - private val registerDeviceFailure = Counter.builder("device.registry.failure") - .description("Number of failed device registrations") - .register(meterRegistry) - suspend fun registerDevice( request: Device.Request, ): Device.Response = try { webClient.deviceRegistryCreateDevice(request, deviceRegistryProperty) - .also { registerDeviceSuccess.increment() } } catch (e: ErrorResponseException) { - registerDeviceFailure.increment() throw e } catch (e: WebClientRequestException) { - registerDeviceFailure.increment() log.error(e) { "Error device registry" } throw ResponseStatusException(SERVICE_UNAVAILABLE) } catch (e: WebClientResponseException) { - registerDeviceFailure.increment() log.error(e) { "Error device registry" } throw ResponseStatusException(INTERNAL_SERVER_ERROR) } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 70592ed..eceae19 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -22,12 +22,6 @@ management: show-details: always info: enabled: true - influx: - metrics: - export: - api-version: v2 - bucket: hlaeja - org: hlaeja_ltd jwt: public-key: cert/public_key.pem @@ -55,16 +49,6 @@ account-registry: device-registry: url: http://localhost:9010 -management: - metrics: - tags: - application: register-api - influx: - metrics: - export: - enabled: false - token: %INFLUXDB_TOKEN% - --- ########################## ### Docker environment ### @@ -74,15 +58,6 @@ spring: activate: on-profile: docker -management: - metrics: - tags: - application: register-api - influx: - metrics: - export: - uri: http://InfluxDB:8086 - server: port: 8443 ssl: