Skip to content

Commit

Permalink
chore: change positioning in struct
Browse files Browse the repository at this point in the history
  • Loading branch information
vgonkivs committed Jan 10, 2024
1 parent 65de27a commit d0f3c1b
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions sync/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,35 @@ import (
var meter = otel.Meter("header/sync")

type metrics struct {
syncReg metric.Registration

totalSynced atomic.Int64
totalSyncedInst metric.Int64ObservableGauge
syncReg metric.Registration
subjectiveHeadInst metric.Int64ObservableGauge
totalSyncedInst metric.Int64ObservableGauge

totalSynced atomic.Int64
syncLoopStarted metric.Int64Counter
trustedPeersOutOfSync metric.Int64Counter
laggingHeadersStart metric.Int64Counter

subjectiveHead atomic.Int64
subjectiveHeadInst metric.Int64ObservableGauge
blockTime metric.Float64Histogram
headerReceived time.Time
prevHeader time.Time
subjectiveHead atomic.Int64
blockTime metric.Float64Histogram
headerReceived time.Time
prevHeader time.Time

headersThreshold time.Duration
}

func newMetrics(headersThreshold time.Duration) (*metrics, error) {
totalSynced, err := meter.Int64ObservableGauge(
"hdr_total_synced_headers",
metric.WithDescription("total synced headers shows how many headers have been synced since runtime"),
metric.WithDescription("total synced headers shows how many headers have been synced"),
)
if err != nil {
return nil, err
}

syncLoopStarted, err := meter.Int64Counter(
"hdr_sync_loop_started",
metric.WithDescription("sync loop started records timestamp of a new sync job"),
metric.WithDescription("sync loop started shows that syncing is in progress"),
)
if err != nil {
return nil, err
Expand Down

0 comments on commit d0f3c1b

Please sign in to comment.