remove influx monitoring

This commit is contained in:
2025-04-06 18:21:51 +02:00
parent 7cc40e7fc6
commit 503e307c69
5 changed files with 0 additions and 74 deletions

View File

@@ -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.*

View File

@@ -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<ProcessResources> {
filesMatching("**/application.yml") { filter { it.replace("%INFLUXDB_TOKEN%", influxDbToken()) } }
onlyIf { file("src/main/resources/application.yml").exists() }
}
named("processResources") {
dependsOn("copyCertificates")
}

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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: