remove metrics collection
This commit is contained in:
@@ -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 java.util.UUID
|
||||
import ltd.hlaeja.library.deviceConfiguration.Node
|
||||
import ltd.hlaeja.property.DeviceConfigurationProperty
|
||||
@@ -18,29 +16,17 @@ private val log = KotlinLogging.logger {}
|
||||
|
||||
@Service
|
||||
class DeviceConfigurationService(
|
||||
meterRegistry: MeterRegistry,
|
||||
private val webClient: WebClient,
|
||||
private val deviceConfigurationProperty: DeviceConfigurationProperty,
|
||||
) {
|
||||
|
||||
private val deviceConfigurationSuccess = Counter.builder("device.configuration.success")
|
||||
.description("Number of successful device configuration calls")
|
||||
.register(meterRegistry)
|
||||
|
||||
private val deviceConfigurationFailure = Counter.builder("device.configuration.failure")
|
||||
.description("Number of failed device configuration calls")
|
||||
.register(meterRegistry)
|
||||
|
||||
suspend fun getConfiguration(
|
||||
node: UUID,
|
||||
): Node.Response = try {
|
||||
webClient.deviceConfigurationGetConfiguration(node, deviceConfigurationProperty)
|
||||
.also { deviceConfigurationSuccess.increment() }
|
||||
} catch (e: ErrorResponseException) {
|
||||
deviceConfigurationFailure.increment()
|
||||
throw e
|
||||
} catch (e: WebClientRequestException) {
|
||||
deviceConfigurationFailure.increment()
|
||||
log.error(e) { "Error device registry" }
|
||||
throw ResponseStatusException(SERVICE_UNAVAILABLE)
|
||||
}
|
||||
|
||||
@@ -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 java.util.UUID
|
||||
import ltd.hlaeja.library.deviceData.MeasurementData
|
||||
import ltd.hlaeja.property.DeviceDataProperty
|
||||
@@ -20,30 +18,18 @@ private val log = KotlinLogging.logger {}
|
||||
|
||||
@Service
|
||||
class DeviceDataService(
|
||||
meterRegistry: MeterRegistry,
|
||||
private val webClient: WebClient,
|
||||
private val deviceDataProperty: DeviceDataProperty,
|
||||
) {
|
||||
|
||||
private val deviceDataSuccess = Counter.builder("device.data.success")
|
||||
.description("Number of successful device data calls")
|
||||
.register(meterRegistry)
|
||||
|
||||
private val deviceDataFailure = Counter.builder("device.data.failure")
|
||||
.description("Number of failed device data calls")
|
||||
.register(meterRegistry)
|
||||
|
||||
suspend fun getMeasurement(
|
||||
client: UUID,
|
||||
node: UUID,
|
||||
): MeasurementData.Response = try {
|
||||
webClient.deviceDataGetMeasurement(client, node, deviceDataProperty)
|
||||
.also { deviceDataSuccess.increment() }
|
||||
} catch (e: ErrorResponseException) {
|
||||
deviceDataFailure.increment()
|
||||
throw e
|
||||
} catch (e: WebClientRequestException) {
|
||||
deviceDataFailure.increment()
|
||||
log.error(e) { "Error device registry" }
|
||||
throw ResponseStatusException(SERVICE_UNAVAILABLE)
|
||||
}
|
||||
@@ -53,12 +39,9 @@ class DeviceDataService(
|
||||
request: MeasurementData.Request,
|
||||
): ResponseEntity<Void> = try {
|
||||
webClient.deviceDataAddMeasurement(client, request, deviceDataProperty)
|
||||
.also { deviceDataSuccess.increment() }
|
||||
} catch (e: ErrorResponseException) {
|
||||
deviceDataFailure.increment()
|
||||
throw e
|
||||
} catch (e: WebClientRequestException) {
|
||||
deviceDataFailure.increment()
|
||||
log.error(e) { "Error device registry" }
|
||||
throw ResponseStatusException(SERVICE_UNAVAILABLE)
|
||||
}
|
||||
|
||||
@@ -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 java.util.UUID
|
||||
import ltd.hlaeja.library.deviceRegistry.Identity
|
||||
import ltd.hlaeja.property.DeviceRegistryProperty
|
||||
@@ -19,30 +17,18 @@ private val log = KotlinLogging.logger {}
|
||||
|
||||
@Service
|
||||
class DeviceRegistryService(
|
||||
meterRegistry: MeterRegistry,
|
||||
private val webClient: WebClient,
|
||||
private val deviceRegistryProperty: DeviceRegistryProperty,
|
||||
) {
|
||||
|
||||
private val identityDeviceSuccess = Counter.builder("device.identity.success")
|
||||
.description("Number of successful device identity calls")
|
||||
.register(meterRegistry)
|
||||
|
||||
private val identityDeviceFailure = Counter.builder("device.identity.failure")
|
||||
.description("Number of failed device identity calls")
|
||||
.register(meterRegistry)
|
||||
|
||||
@Cacheable(value = ["identity"], key = "#device")
|
||||
suspend fun getIdentityFromDevice(
|
||||
device: UUID,
|
||||
): Identity.Response = try {
|
||||
webClient.deviceRegistryIdentityDevice(device, deviceRegistryProperty)
|
||||
.also { identityDeviceSuccess.increment() }
|
||||
} catch (e: ErrorResponseException) {
|
||||
identityDeviceFailure.increment()
|
||||
throw e
|
||||
} catch (e: WebClientRequestException) {
|
||||
identityDeviceFailure.increment()
|
||||
log.error(e) { "Error device identity" }
|
||||
throw ResponseStatusException(SERVICE_UNAVAILABLE)
|
||||
}
|
||||
|
||||
@@ -29,12 +29,6 @@ management:
|
||||
access: read_only
|
||||
info:
|
||||
access: read_only
|
||||
influx:
|
||||
metrics:
|
||||
export:
|
||||
api-version: v2
|
||||
bucket: hlaeja
|
||||
org: hlaeja_ltd
|
||||
|
||||
cache:
|
||||
time-to-live: 10
|
||||
@@ -54,16 +48,6 @@ spring:
|
||||
redis:
|
||||
host: localhost
|
||||
|
||||
management:
|
||||
metrics:
|
||||
tags:
|
||||
application: device-api
|
||||
influx:
|
||||
metrics:
|
||||
export:
|
||||
enabled: false
|
||||
token: %INFLUXDB_TOKEN%
|
||||
|
||||
server:
|
||||
port: 8443
|
||||
ssl:
|
||||
@@ -93,15 +77,6 @@ spring:
|
||||
redis:
|
||||
host: Redis
|
||||
|
||||
management:
|
||||
metrics:
|
||||
tags:
|
||||
application: device-api
|
||||
influx:
|
||||
metrics:
|
||||
export:
|
||||
uri: http://InfluxDB:8086
|
||||
|
||||
server:
|
||||
port: 8443
|
||||
ssl:
|
||||
|
||||
Reference in New Issue
Block a user