File tree Expand file tree Collapse file tree
src/main/kotlin/ch/derlin/bbdata/actuators Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package ch.derlin.bbdata.actuators
2+
3+ import io.micrometer.core.instrument.MeterRegistry
4+ import org.springframework.stereotype.Component
5+
6+ /* *
7+ * date: 28.09.20
8+ * @author Lucy Linder <lucy.derlin@gmail.com>
9+ */
10+ @Component
11+ class CustomMetrics (private val meterRegistry : MeterRegistry ) {
12+
13+ /* * Count the number of rejected measures in input api*/
14+ fun reject (objectId : Long ) = meterRegistry
15+ .summary(" ch.derlin.input.rejected" ,
16+ " object_id" , objectId.toString()
17+ ).record(1.0 )
18+
19+ /* * Count the number of failed login /login */
20+ fun loginFailed (username : String ) = meterRegistry
21+ .summary(" ch.derlin.login.failed" ,
22+ " username" , username
23+ ).record(1.0 )
24+
25+ /* * Count the number of failed authentication (wrong bbuser+bbtoken, not recording read-only apikeys on write endpoints) */
26+ fun authFailed (userId : Int ) = meterRegistry
27+ .summary(" ch.derlin.auth.failed" ,
28+ " user_id" , userId.toString()
29+ ).record(1.0 )
30+ }
You can’t perform that action at this time.
0 commit comments