Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 2 additions & 3 deletions api/server/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
package server

import (
"errors"
"net/http"
"time"

"github.com/prometheus/client_golang/prometheus"

"github.com/ava-labs/avalanchego/utils"
)

type metrics struct {
Expand Down Expand Up @@ -43,7 +42,7 @@ func newMetrics(registerer prometheus.Registerer) (*metrics, error) {
),
}

err := utils.Err(
err := errors.Join(
registerer.Register(m.numProcessing),
registerer.Register(m.numCalls),
registerer.Register(m.totalDuration),
Expand Down
6 changes: 3 additions & 3 deletions cache/metercacher/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package metercacher

import (
"github.com/prometheus/client_golang/prometheus"
"errors"

"github.com/ava-labs/avalanchego/utils"
"github.com/prometheus/client_golang/prometheus"
)

const (
Expand Down Expand Up @@ -78,7 +78,7 @@ func newMetrics(
Help: "fraction of cache filled",
}),
}
return m, utils.Err(
return m, errors.Join(
reg.Register(m.getCount),
reg.Register(m.getTime),
reg.Register(m.putCount),
Expand Down
5 changes: 2 additions & 3 deletions database/leveldb/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
package leveldb

import (
"errors"
"strconv"

"github.com/prometheus/client_golang/prometheus"
"github.com/syndtr/goleveldb/leveldb"

"github.com/ava-labs/avalanchego/utils"
)

var levelLabels = []string{"level"}
Expand Down Expand Up @@ -161,7 +160,7 @@ func newMetrics(reg prometheus.Registerer) (metrics, error) {
currentStats: &leveldb.DBStats{},
}

err := utils.Err(
err := errors.Join(
reg.Register(m.writesDelayedCount),
reg.Register(m.writesDelayedDuration),
reg.Register(m.writeIsDelayed),
Expand Down
4 changes: 2 additions & 2 deletions database/meterdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ package meterdb

import (
"context"
"errors"
"time"

"github.com/prometheus/client_golang/prometheus"

"github.com/ava-labs/avalanchego/database"
"github.com/ava-labs/avalanchego/utils"
)

const methodLabel = "method"
Expand Down Expand Up @@ -125,7 +125,7 @@ func New(
methodLabels,
),
}
return meterDB, utils.Err(
return meterDB, errors.Join(
reg.Register(meterDB.calls),
reg.Register(meterDB.duration),
reg.Register(meterDB.size),
Expand Down
2 changes: 1 addition & 1 deletion genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func init() {
unparsedFujiConfig := UnparsedConfig{}
unparsedLocalConfig := UnparsedConfig{}

err := utils.Err(
err := errors.Join(
json.Unmarshal(mainnetGenesisConfigJSON, &unparsedMainnetConfig),
json.Unmarshal(fujiGenesisConfigJSON, &unparsedFujiConfig),
json.Unmarshal(localGenesisConfigJSON, &unparsedLocalConfig),
Expand Down
3 changes: 1 addition & 2 deletions indexer/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/ava-labs/avalanchego/database/versiondb"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/timer/mockable"
)
Expand Down Expand Up @@ -99,7 +98,7 @@ func newIndex(

// Close this index
func (i *index) Close() error {
return utils.Err(
return errors.Join(
i.indexToContainer.Close(),
i.containerToIndex.Close(),
i.vDB.Close(),
Expand Down
3 changes: 1 addition & 2 deletions message/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/proto/pb/p2p"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/compression"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/logging"
Expand Down Expand Up @@ -178,7 +177,7 @@ func newMsgBuilder(

maxMessageTimeout: maxMessageTimeout,
}
return mb, utils.Err(
return mb, errors.Join(
metrics.Register(mb.count),
metrics.Register(mb.duration),
)
Expand Down
4 changes: 2 additions & 2 deletions network/ip_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ package network

import (
"crypto/rand"
"errors"
"sync"

"github.com/prometheus/client_golang/prometheus"
"go.uber.org/zap"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow/validators"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/bloom"
"github.com/ava-labs/avalanchego/utils/crypto/bls"
"github.com/ava-labs/avalanchego/utils/ips"
Expand Down Expand Up @@ -63,7 +63,7 @@ func newIPTracker(
connected: make(map[ids.NodeID]*ips.ClaimedIPPort),
gossipableIndices: make(map[ids.NodeID]int),
}
err = utils.Err(
err = errors.Join(
registerer.Register(tracker.numTrackedIPs),
registerer.Register(tracker.numGossipableIPs),
)
Expand Down
4 changes: 2 additions & 2 deletions network/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
package network

import (
"errors"
"sync"
"time"

"github.com/prometheus/client_golang/prometheus"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/network/peer"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/set"
)

Expand Down Expand Up @@ -135,7 +135,7 @@ func newMetrics(
peerConnectedStartTimes: make(map[ids.NodeID]float64),
}

err := utils.Err(
err := errors.Join(
registerer.Register(m.numTracked),
registerer.Register(m.numPeers),
registerer.Register(m.numSubnetPeers),
Expand Down
3 changes: 1 addition & 2 deletions network/p2p/gossip/gossip.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/network/p2p"
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/bloom"
"github.com/ava-labs/avalanchego/utils/buffer"
"github.com/ava-labs/avalanchego/utils/logging"
Expand Down Expand Up @@ -150,7 +149,7 @@ func NewMetrics(
typeLabels,
),
}
err := utils.Err(
err := errors.Join(
metrics.Register(m.count),
metrics.Register(m.bytes),
metrics.Register(m.tracking),
Expand Down
4 changes: 2 additions & 2 deletions network/p2p/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package p2p
import (
"context"
"encoding/binary"
"errors"
"strconv"
"sync"
"time"
Expand All @@ -15,7 +16,6 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/snow/validators"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/avalanchego/version"
Expand Down Expand Up @@ -81,7 +81,7 @@ func NewNetwork(
),
}

err := utils.Err(
err := errors.Join(
registerer.Register(metrics.msgTime),
registerer.Register(metrics.msgCount),
)
Expand Down
4 changes: 2 additions & 2 deletions network/p2p/peer_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package p2p

import (
"errors"
"math"
"math/rand"
"sync"
Expand All @@ -13,7 +14,6 @@ import (
"go.uber.org/zap"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/heap"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/set"
Expand Down Expand Up @@ -113,7 +113,7 @@ func NewPeerTracker(
},
}

err := utils.Err(
err := errors.Join(
registerer.Register(t.metrics.numTrackedPeers),
registerer.Register(t.metrics.numResponsivePeers),
registerer.Register(t.metrics.averageBandwidth),
Expand Down
4 changes: 2 additions & 2 deletions network/peer/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
package peer

import (
"errors"
"strconv"

"github.com/prometheus/client_golang/prometheus"

"github.com/ava-labs/avalanchego/message"
"github.com/ava-labs/avalanchego/utils"
)

const (
Expand Down Expand Up @@ -82,7 +82,7 @@ func NewMetrics(registerer prometheus.Registerer) (*Metrics, error) {
ioOpLabels,
),
}
return m, utils.Err(
return m, errors.Join(
registerer.Register(m.ClockSkewCount),
registerer.Register(m.ClockSkewSum),
registerer.Register(m.NumFailedToParse),
Expand Down
4 changes: 2 additions & 2 deletions network/throttling/inbound_resource_throttler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package throttling

import (
"context"
"errors"
"fmt"
"sync"
"time"
Expand All @@ -13,7 +14,6 @@ import (

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow/networking/tracker"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/timer/mockable"
)

Expand Down Expand Up @@ -80,7 +80,7 @@ func newSystemThrottlerMetrics(namespace string, reg prometheus.Registerer) (*sy
Help: "Number of nodes we're waiting to read a message from because their usage is too high",
}),
}
err := utils.Err(
err := errors.Join(
reg.Register(m.totalWaits),
reg.Register(m.totalNoWaits),
reg.Register(m.awaitingAcquire),
Expand Down
5 changes: 3 additions & 2 deletions network/throttling/outbound_msg_throttler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
package throttling

import (
"errors"

"github.com/prometheus/client_golang/prometheus"
"go.uber.org/zap"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/message"
"github.com/ava-labs/avalanchego/snow/validators"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/logging"
)
Expand Down Expand Up @@ -196,7 +197,7 @@ func (m *outboundMsgThrottlerMetrics) initialize(registerer prometheus.Registere
Name: "throttler_outbound_awaiting_release",
Help: "Number of messages waiting to be sent",
})
return utils.Err(
return errors.Join(
registerer.Register(m.acquireSuccesses),
registerer.Register(m.acquireFailures),
registerer.Register(m.remainingAtLargeBytes),
Expand Down
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ func (n *Node) initVMs() error {

// Register the VMs that Avalanche supports
eUpgradeTime := version.GetEUpgradeTime(n.Config.NetworkID)
err := utils.Err(
err := errors.Join(
n.VMManager.RegisterFactory(context.TODO(), constants.PlatformVMID, &platformvm.Factory{
Config: platformconfig.Config{
Chains: n.chainManager,
Expand Down
6 changes: 3 additions & 3 deletions snow/engine/avalanche/bootstrap/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package bootstrap

import (
"github.com/prometheus/client_golang/prometheus"
"errors"

"github.com/ava-labs/avalanchego/utils"
"github.com/prometheus/client_golang/prometheus"
)

type metrics struct {
Expand All @@ -33,7 +33,7 @@ func (m *metrics) Initialize(registerer prometheus.Registerer) error {
Help: "Number of transactions accepted during bootstrapping",
})

return utils.Err(
return errors.Join(
registerer.Register(m.numFetchedVts),
registerer.Register(m.numAcceptedVts),
registerer.Register(m.numFetchedTxs),
Expand Down
4 changes: 2 additions & 2 deletions snow/engine/avalanche/bootstrap/queue/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package queue

import (
"context"
"errors"
"fmt"
"time"

Expand All @@ -16,7 +17,6 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/avalanchego/utils/timer"
)
Expand Down Expand Up @@ -424,7 +424,7 @@ func (jm *JobsWithMissing) cleanRunnableStack(ctx context.Context) error {
}
}

return utils.Err(
return errors.Join(
runnableJobsIter.Error(),
jm.Commit(),
)
Expand Down
Loading