1
1
package no.nav.hjelpemidler.metrics
2
2
3
3
import no.nav.hjelpemidler.configuration.Configuration
4
+ import org.influxdb.dto.Point
4
5
import org.slf4j.LoggerFactory
5
6
import java.net.URI
6
7
import java.net.http.HttpClient
@@ -9,7 +10,6 @@ import java.net.http.HttpResponse
9
10
import java.time.Duration
10
11
import java.util.*
11
12
import java.util.concurrent.TimeUnit
12
- import org.influxdb.dto.Point
13
13
14
14
class SensuMetrics {
15
15
private val log = LoggerFactory .getLogger(SensuMetrics ::class .java)
@@ -29,12 +29,19 @@ class SensuMetrics {
29
29
registerPoint(MELDING_TIL_RAPID_FEILET , mapOf (" counter" to 1L ), emptyMap())
30
30
}
31
31
32
+ fun meldingFraOebs () {
33
+ registerPoint(MELDING_FRA_OEBS , mapOf (" counter" to 1L ), emptyMap())
34
+ }
35
+
36
+ fun feilVedMeldingFraOebs () {
37
+ registerPoint(OEBS_MELDING_FEIL , mapOf (" counter" to 1L ), emptyMap())
38
+ }
39
+
32
40
fun test () {
33
41
println (" writing to sensu" )
34
42
registerPoint(" testing" , mapOf (" counter" to 1L ), emptyMap())
35
43
}
36
44
37
-
38
45
private fun registerPoint (measurement : String , fields : Map <String , Any >, tags : Map <String , String >) {
39
46
log.info(" Posting point to Influx: measurment {} fields {} tags {} " , measurement, fields, tags)
40
47
val point = Point .measurement(measurement)
@@ -66,12 +73,12 @@ class SensuMetrics {
66
73
67
74
private class SensuEvent (sensuName : String , output : String ) {
68
75
val json: String = " {" +
69
- " \" name\" :\" " + sensuName + " \" ," +
70
- " \" type\" :\" metric\" ," +
71
- " \" handlers\" :[\" events_nano\" ]," +
72
- " \" output\" :\" " + output.replace(" \\ " , " \\\\ " , true ) + " \" ," +
73
- " \" status\" :0" +
74
- " }"
76
+ " \" name\" :\" " + sensuName + " \" ," +
77
+ " \" type\" :\" metric\" ," +
78
+ " \" handlers\" :[\" events_nano\" ]," +
79
+ " \" output\" :\" " + output.replace(" \\ " , " \\\\ " , true ) + " \" ," +
80
+ " \" status\" :0" +
81
+ " }"
75
82
}
76
83
77
84
companion object {
@@ -82,7 +89,9 @@ class SensuMetrics {
82
89
)
83
90
84
91
private const val SOKNADER = " hm-oebs-listener"
85
- const val MELDING_TIL_RAPID_SUKSESS = " $SOKNADER .soknadmottatt.rapid.suksess"
86
- const val MELDING_TIL_RAPID_FEILET = " $SOKNADER .soknadmottatt.rapid.feilet"
92
+ const val MELDING_TIL_RAPID_SUKSESS = " $SOKNADER .rapid.suksess"
93
+ const val MELDING_TIL_RAPID_FEILET = " $SOKNADER .rapid.feilet"
94
+ const val MELDING_FRA_OEBS = " $SOKNADER .oebs.melding"
95
+ const val OEBS_MELDING_FEIL = " $SOKNADER .oebs.feil"
87
96
}
88
- }
97
+ }
0 commit comments