Skip to content

Commit 5c5b9f9

Browse files
authored
Add type to local/remote error metrics (#3249)
We were only splitting by origin (local/remote). This compensates for #3236.
1 parent aff16b2 commit 5c5b9f9

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

eclair-core/src/main/scala/fr/acinq/eclair/channel/Monitoring.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ object Monitoring {
8686
val Direction = "direction"
8787
val Event = "event"
8888
val Fatal = "fatal"
89+
val ErrorType = "error-type"
8990
val Origin = "origin"
9091
val State = "state"
9192
val CommitmentFormat = "commitment-format"

eclair-core/src/main/scala/fr/acinq/eclair/db/DbEventHandler.scala

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import fr.acinq.eclair.db.DbEventHandler.ChannelEvent
3030
import fr.acinq.eclair.payment.Monitoring.{Metrics => PaymentMetrics, Tags => PaymentTags}
3131
import fr.acinq.eclair.payment._
3232
import fr.acinq.eclair.{Logs, NodeParams, TimestampMilli}
33+
import kamon.tag.TagSet
3334

3435
/**
3536
* This actor sits at the interface between our event stream and the database.
@@ -112,10 +113,17 @@ class DbEventHandler(nodeParams: NodeParams) extends Actor with DiagnosticActorL
112113
// The first pattern matching level is to ignore some errors, the second level is to separate between different kind of errors.
113114
e.error match {
114115
case LocalError(_: CannotAffordFees) => () // will be thrown at each new block if our balance is too low to update the commitment fee
115-
case _ => e.error match {
116-
case LocalError(_) => ChannelMetrics.ChannelErrors.withTag(ChannelTags.Origin, ChannelTags.Origins.Local).withTag(ChannelTags.Fatal, value = e.isFatal).increment()
117-
case RemoteError(_) => ChannelMetrics.ChannelErrors.withTag(ChannelTags.Origin, ChannelTags.Origins.Remote).increment()
118-
}
116+
case _ =>
117+
val tags = e.error match {
118+
case LocalError(t) => TagSet.Empty
119+
.withTag(ChannelTags.Origin, ChannelTags.Origins.Local)
120+
.withTag(ChannelTags.Fatal, value = e.isFatal)
121+
.withTag(ChannelTags.ErrorType, t.getClass.getSimpleName)
122+
case RemoteError(_) => TagSet.Empty
123+
.withTag(ChannelTags.Origin, ChannelTags.Origins.Remote)
124+
.withTag(ChannelTags.Fatal, value = true) // remote errors are always fatal
125+
}
126+
ChannelMetrics.ChannelErrors.withTags(tags).increment()
119127
}
120128

121129
case e: ChannelStateChanged =>

0 commit comments

Comments
 (0)