Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metrics on splicing #2756

Merged
merged 2 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ object Monitoring {
val HtlcValueInFlightGlobal = Kamon.gauge("channels.htlc-value-in-flight-global", "Global HTLC value in flight across all channels")
val LocalFeeratePerByte = Kamon.histogram("channels.local-feerate-per-byte")
val RemoteFeeratePerByte = Kamon.histogram("channels.remote-feerate-per-byte")
val Splices = Kamon.histogram("channels.splices", "Splices")
val ProcessMessage = Kamon.timer("channels.messages-processed")

def recordHtlcsInFlight(remoteSpec: CommitmentSpec, previousRemoteSpec: CommitmentSpec): Unit = {
Expand All @@ -56,6 +57,7 @@ object Monitoring {
val Origin = "origin"
val State = "state"
val CommitmentFormat = "commitment-format"
val SpliceType = "splice-type"

object Events {
val Created = "created"
Expand All @@ -72,6 +74,12 @@ object Monitoring {
val Incoming = "incoming"
val Outgoing = "outgoing"
}

object SpliceTypes {
val SpliceIn = "splice-in"
val SpliceOut = "splice-out"
val SpliceCpfp = "splice-cpfp"
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,26 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
val commitments1 = d.commitments.add(signingSession1.commitment)
val d1 = d.copy(commitments = commitments1, spliceStatus = SpliceStatus.NoSplice)
log.info("publishing funding tx for channelId={} fundingTxId={}", d.channelId, signingSession1.fundingTx.sharedTx.txId)
val fundingParams = signingSession1.fundingTx.fundingParams
t-bast marked this conversation as resolved.
Show resolved Hide resolved
val sharedTx = signingSession1.fundingTx.sharedTx.tx
if (fundingParams.localContribution > 0.sat) {
Metrics.Splices.withTag(Tags.Origin, Tags.Origins.Local).withTag(Tags.SpliceType, Tags.SpliceTypes.SpliceIn).record(fundingParams.localContribution.toLong)
}
if (fundingParams.remoteContribution > 0.sat) {
Metrics.Splices.withTag(Tags.Origin, Tags.Origins.Remote).withTag(Tags.SpliceType, Tags.SpliceTypes.SpliceIn).record(fundingParams.remoteContribution.toLong)
}
if (sharedTx.localOutputs.nonEmpty) {
Metrics.Splices.withTag(Tags.Origin, Tags.Origins.Local).withTag(Tags.SpliceType, Tags.SpliceTypes.SpliceOut).record(sharedTx.localOutputs.map(_.amount).sum.toLong)
}
if (sharedTx.remoteOutputs.nonEmpty) {
Metrics.Splices.withTag(Tags.Origin, Tags.Origins.Remote).withTag(Tags.SpliceType, Tags.SpliceTypes.SpliceOut).record(sharedTx.remoteOutputs.map(_.amount).sum.toLong)
}
if (fundingParams.localContribution < 0.sat && sharedTx.localOutputs.isEmpty) {
Metrics.Splices.withTag(Tags.Origin, Tags.Origins.Local).withTag(Tags.SpliceType, Tags.SpliceTypes.SpliceCpfp).record(fundingParams.localContribution.toLong)
t-bast marked this conversation as resolved.
Show resolved Hide resolved
}
if (fundingParams.remoteContribution < 0.sat && sharedTx.remoteOutputs.isEmpty) {
Metrics.Splices.withTag(Tags.Origin, Tags.Origins.Remote).withTag(Tags.SpliceType, Tags.SpliceTypes.SpliceCpfp).record(fundingParams.remoteContribution.toLong)
}
stay() using d1 storing() sending signingSession1.localSigs calling publishFundingTx(signingSession1.fundingTx) calling endQuiescence(d1)
}
case _ =>
Expand Down