-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove usage of prometheus client, replace with micrometer
- Loading branch information
1 parent
c1c3c6d
commit 9af4926
Showing
11 changed files
with
84 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
hm-rapids-and-rivers-v2-core/src/main/kotlin/no/nav/helse/rapids_rivers/PingPong.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
hm-rapids-and-rivers-v2-core/src/main/kotlin/no/nav/helse/rapids_rivers/RiverMetrics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package no.nav.helse.rapids_rivers | ||
|
||
import io.micrometer.core.instrument.Counter | ||
import io.micrometer.core.instrument.Gauge | ||
import io.micrometer.core.instrument.MeterRegistry | ||
import io.micrometer.core.instrument.Timer | ||
import io.micrometer.core.instrument.binder.MeterBinder | ||
import org.slf4j.LoggerFactory | ||
|
||
class RiverMetrics: MeterBinder { | ||
|
||
var meterRegistry: MeterRegistry = DefaultMeterRegistry.Default | ||
|
||
companion object { | ||
private val LOG = LoggerFactory.getLogger(RiverMetrics::class.java) | ||
} | ||
override fun bindTo(registry: MeterRegistry) { | ||
LOG.debug("Binding to meter registry {}", registry) | ||
this.meterRegistry = registry | ||
} | ||
|
||
fun messageCounter(rapidName:String, riverName: String, status: String) { | ||
LOG.debug("Incrementing message counter for rapid {} and river {} with status {}", rapidName, riverName, status) | ||
Counter.builder("message_counter").tags("rapid",rapidName, "river", riverName, "status", "severe") | ||
.register(meterRegistry) | ||
.increment() | ||
} | ||
|
||
fun timer(rapidName: String, riverName: String, eventName: String, runnable: Runnable) { | ||
LOG.debug("Recording timer for rapid {} and river {} and event {}", rapidName, riverName, eventName) | ||
Timer.builder("on_packet_seconds") | ||
.tags("rapid", rapidName, "river", riverName, "event_name", eventName) | ||
.register(meterRegistry) | ||
.record(runnable) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
...ds-and-rivers-v2-micronaut/src/main/kotlin/no/nav/hm/rapids_rivers/micronaut/RiverHead.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters