Skip to content

Commit

Permalink
add core_block_time_latency metric
Browse files Browse the repository at this point in the history
  • Loading branch information
gartnera committed Dec 5, 2024
1 parent 962c490 commit fe86b8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions zetaclient/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ var (
Help: "Last core block number",
})

// CoreBlockLatency is a gauge that measures the difference between system time and
// block time from zetacore
CoreBlockLatency = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: ZetaClientNamespace,
Name: "core_block_latency",
Help: "Difference between system time and block time from zetacore",
})

// Info is a gauge that contains information about the zetaclient environment
Info = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: ZetaClientNamespace,
Expand Down
3 changes: 3 additions & 0 deletions zetaclient/orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ func (oc *Orchestrator) runScheduler(ctx context.Context) error {
case newBlock := <-newBlockChan:
bn := newBlock.Block.Height

blockTimeLatency := time.Since(newBlock.Block.Time)
metrics.CoreBlockLatency.Set(blockTimeLatency.Seconds())

balance, err := oc.zetacoreClient.GetZetaHotKeyBalance(ctx)
if err != nil {
oc.logger.Error().Err(err).Msgf("couldn't get operator balance")
Expand Down

0 comments on commit fe86b8a

Please sign in to comment.