Skip to content

Commit

Permalink
Merge branch 'master' into fix/stopping-workers
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 authored Nov 27, 2023
2 parents 14a80d5 + e9e3736 commit daaff18
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Added metric `client_updates_skipped` to track the number of client
update messages skipped due to the conscensus state existing already.
([\#3707](https://github.com/informalsystems/hermes/issues/3707))
7 changes: 7 additions & 0 deletions crates/relayer/src/foreign_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,13 @@ impl<DstChain: ChainHandle, SrcChain: ChainHandle> ForeignClient<DstChain, SrcCh

// If the client already stores a consensus state for the target height,
// there is no need to update the client
telemetry!(
client_updates_skipped,
&self.src_chain.id(),
&self.dst_chain.id(),
&self.id,
1,
);
return Ok(vec![]);
}

Expand Down
29 changes: 29 additions & 0 deletions crates/telemetry/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ pub struct TelemetryState {
/// Number of client update messages submitted per client
client_updates_submitted: Counter<u64>,

/// Number of client update skipped due to consensus state already
/// existing
client_updates_skipped: Counter<u64>,

/// Number of misbehaviours detected and submitted per client
client_misbehaviours_submitted: Counter<u64>,

Expand Down Expand Up @@ -233,6 +237,11 @@ impl TelemetryState {
.with_description("Number of client update messages submitted")
.init(),

client_updates_skipped: meter
.u64_counter("client_updates_skipped")
.with_description("Number of client update messages skipped")
.init(),

client_misbehaviours_submitted: meter
.u64_counter("client_misbehaviours_submitted")
.with_description("Number of misbehaviours detected and submitted")
Expand Down Expand Up @@ -458,6 +467,7 @@ impl TelemetryState {
];

self.client_updates_submitted.add(&cx, 0, labels);
self.client_updates_skipped.add(&cx, 0, labels);

if misbehaviour {
self.client_misbehaviours_submitted.add(&cx, 0, labels);
Expand Down Expand Up @@ -512,6 +522,25 @@ impl TelemetryState {
self.client_updates_submitted.add(&cx, count, labels);
}

/// Update the number of client updates skipped per client
pub fn client_updates_skipped(
&self,
src_chain: &ChainId,
dst_chain: &ChainId,
client: &ClientId,
count: u64,
) {
let cx = Context::current();

let labels = &[
KeyValue::new("src_chain", src_chain.to_string()),
KeyValue::new("dst_chain", dst_chain.to_string()),
KeyValue::new("client", client.to_string()),
];

self.client_updates_skipped.add(&cx, count, labels);
}

/// Number of client misbehaviours per client
pub fn client_misbehaviours_submitted(
&self,
Expand Down
4 changes: 4 additions & 0 deletions guide/src/documentation/telemetry/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ backlog_size{chain="ibc-1",channel="channel-0",counterparty="ibc-0",port="transf
# TYPE client_updates_submitted_total counter
client_updates_submitted_total{client="07-tendermint-0",dst_chain="ibc-0",service_name="unknown_service",src_chain="ibc-1",otel_scope_name="hermes",otel_scope_version=""} 2
client_updates_submitted_total{client="07-tendermint-0",dst_chain="ibc-1",service_name="unknown_service",src_chain="ibc-0",otel_scope_name="hermes",otel_scope_version=""} 2
# HELP client_updates_skipped_total Number of client update messages skipped
# TYPE client_updates_skipped_total counter
client_updates_skipped_total{client="07-tendermint-0",dst_chain="ibc-0",service_name="unknown_service",src_chain="ibc-1",otel_scope_name="hermes",otel_scope_version=""} 0
client_updates_skipped_total{client="07-tendermint-0",dst_chain="ibc-1",service_name="unknown_service",src_chain="ibc-0",otel_scope_name="hermes",otel_scope_version=""} 0
# HELP ics29_period_fees Amount of ICS29 fees rewarded over the past 7 days
# TYPE ics29_period_fees gauge
ics29_period_fees{chain="ibc-0",denom="stake",receiver="cosmos1j6z6q9d2gf2suav88z8g3zf726vz9ehg4hkr8x",service_name="unknown_service",otel_scope_name="hermes",otel_scope_version=""} 0
Expand Down
1 change: 1 addition & 0 deletions guide/src/documentation/telemetry/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The metrics in the table below are design to answer this question on multiple di
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | -------------------------- |
| `workers` | Number of workers per type | `i64` UpDownCounter | Corresponding workers enabled |
| `client_updates_submitted_total` | Number of client update messages submitted, per sending chain, receiving chain and client | `u64` Counter | Client, Connection, Channel or Packet workers enabled |
| `client_updates_skipped_total` | Number of client update messages skipped because the consensus state already exists, per sending chain, receiving chain and client | `u64` Counter | Client, Connection, Channel or Packet workers enabled |
| `wallet_balance` | The balance of each wallet Hermes uses per chain | `f64` ValueRecorder | None |
| `tx_latency_submitted` | Latency for all transactions submitted to a chain | `u64` ValueRecorder | None |
| `messages_submitted_total` | Number of messages submitted to a specific chain | `u64` Counter | None |
Expand Down

0 comments on commit daaff18

Please sign in to comment.