Skip to content

Commit

Permalink
Add agent metrics.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Luis Lucas authored and iknite committed Feb 19, 2019
1 parent 4d48028 commit 4a56ab0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
5 changes: 5 additions & 0 deletions gossip/auditor/auditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ func (t MembershipTask) sendAlert(msg string) {
}

func (a Auditor) Process(b protocol.BatchSnapshots) {
// Metrics
metrics.Qed_auditor_batches_received_total.Inc()
timer := prometheus.NewTimer(metrics.Qed_auditor_batches_process_seconds)
defer timer.ObserveDuration()

task := &MembershipTask{
qed: a.qed,
pubUrl: a.conf.PubUrls[0],
Expand Down
12 changes: 6 additions & 6 deletions gossip/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,22 @@ var (
},
)

Qed_auditor_batches_process_seconds = prometheus.NewGauge(
prometheus.GaugeOpts{
Qed_auditor_batches_process_seconds = prometheus.NewSummary(
prometheus.SummaryOpts{
Name: "qed_auditor_batches_process_seconds",
Help: "Duration of Auditor batch processing",
},
)

Qed_monitor_batches_process_seconds = prometheus.NewGauge(
prometheus.GaugeOpts{
Qed_monitor_batches_process_seconds = prometheus.NewSummary(
prometheus.SummaryOpts{
Name: "qed_monitor_batches_process_seconds",
Help: "Duration of Monitor batch processing",
},
)

Qed_publisher_batches_process_seconds = prometheus.NewGauge(
prometheus.GaugeOpts{
Qed_publisher_batches_process_seconds = prometheus.NewSummary(
prometheus.SummaryOpts{
Name: "qed_publisher_batches_process_seconds",
Help: "Duration of Publisher batch processing",
},
Expand Down
5 changes: 5 additions & 0 deletions gossip/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ type QueryTask struct {
}

func (m Monitor) Process(b protocol.BatchSnapshots) {
// Metrics
metrics.Qed_monitor_batches_received_total.Inc()
timer := prometheus.NewTimer(metrics.Qed_monitor_batches_process_seconds)
defer timer.ObserveDuration()

first := b.Snapshots[0].Snapshot
last := b.Snapshots[len(b.Snapshots)-1].Snapshot

Expand Down
5 changes: 5 additions & 0 deletions gossip/publisher/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ type PublishTask struct {
}

func (p *Publisher) Process(b protocol.BatchSnapshots) {
// Metrics
metrics.Qed_publisher_batches_received_total.Inc()
timer := prometheus.NewTimer(metrics.Qed_publisher_batches_process_seconds)
defer timer.ObserveDuration()

task := &PublishTask{
Batch: b,
}
Expand Down

0 comments on commit 4a56ab0

Please sign in to comment.