Skip to content

Commit

Permalink
add tracker2 WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dB2510 committed Jan 16, 2023
1 parent ae17768 commit a6bdde6
Show file tree
Hide file tree
Showing 4 changed files with 752 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,24 @@ type Broadcaster interface {
Broadcast(context.Context, Duty, PubKey, SignedData) error
}

// Tracker sends core component events for further analysis and instrumentation.
type Tracker interface {
// FetcherFetched sends Fetcher component's events to tracker.
FetcherFetched(context.Context, Duty, DutyDefinitionSet, error)

// DutyDBStored sends DutyDB component's store events to tracker.
DutyDBStored(context.Context, Duty, UnsignedDataSet, error)

// ParSigDBStoredInternal sends ParSigDB component's store internal events to tracker.
ParSigDBStoredInternal(context.Context, Duty, ParSignedDataSet, error)

// ParSigDBStoredExternal sends ParSigDB component's store external events to tracker.
ParSigDBStoredExternal(context.Context, Duty, ParSignedDataSet, error)

// BroadcasterBroadcast sends Broadcaster component's broadcast events to tracker.
BroadcasterBroadcast(context.Context, Duty, PubKey, SignedData, error)
}

// wireFuncs defines the core workflow components as a list of input and output functions
// instead as interfaces, since functions are easier to wrap than interfaces.
type wireFuncs struct {
Expand Down
66 changes: 66 additions & 0 deletions core/tracker/tracker2/metrics.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright © 2022 Obol Labs Inc.
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// this program. If not, see <http://www.gnu.org/licenses/>.

package tracker2

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

"github.com/obolnetwork/charon/app/promauto"
)

var (
participationGauge = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: "core",
Subsystem: "tracker",
Name: "participation",
Help: "Set to 1 if peer participated successfully for the given duty or else 0",
}, []string{"duty", "peer"})

participationCounter = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "core",
Subsystem: "tracker",
Name: "participation_total",
Help: "Total number of successful participations by peer and duty type",
}, []string{"duty", "peer"})

failedCounter = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "core",
Subsystem: "tracker",
Name: "failed_duties_total",
Help: "Total number of failed duties by type",
}, []string{"duty"})

unexpectedEventsCounter = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "core",
Subsystem: "tracker",
Name: "unexpected_events_total",
Help: "Total number of unexpected events by peer",
}, []string{"peer"})

inconsistentCounter = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: "core",
Subsystem: "tracker",
Name: "inconsistent_parsigs_total",
Help: "Total number of duties that contained inconsistent partial signed data by duty type",
}, []string{"duty"})

inclusionDelay = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: "core",
Subsystem: "tracker",
Name: "inclusion_delay",
Help: "Cluster's average attestation inclusion delay in slots",
})
)
Loading

0 comments on commit a6bdde6

Please sign in to comment.