Skip to content

Commit

Permalink
Endrer teller til å sjekke payloadens størrelse
Browse files Browse the repository at this point in the history
legger også til at den faktisk sjekker størrelsen ved opprettelse
  • Loading branch information
Andreas Bergh committed Jan 3, 2020
1 parent 08818e8 commit 8ccf606
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/no/nav/dagpenger/events/Metrics.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package no.nav.dagpenger.events

import io.prometheus.client.Summary

val packetByteSize = Summary.build()
.name("packet_size_bytes")
.help("Packet size in bytes.").register()
val packetPayloadByteSize = Summary.build()
.name("payload_size_bytes")
.help("Packet payload size in bytes.").register()
5 changes: 4 additions & 1 deletion src/main/kotlin/no/nav/dagpenger/events/Packet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ class Packet constructor(jsonString: String = "{}") {
System.getenv("NAIS_APP_NAME")?.let {
val breadcrumb = Breadcrumb(
it,
LocalDateTime.now())
LocalDateTime.now()
)
breadcrumbs.add(breadcrumb)
}

packetPayloadByteSize.observe(jsonString.toByteArray().size.toDouble())
}

private fun getValue(key: String): Any? = json[key]
Expand Down

0 comments on commit 8ccf606

Please sign in to comment.