Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the operator latency metric cardinality #768

Merged
merged 2 commits into from
Sep 20, 2024
Merged
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
20 changes: 18 additions & 2 deletions disperser/batcher/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ type FinalizerMetrics struct {
}

type DispatcherMetrics struct {
Latency *prometheus.SummaryVec
Latency *prometheus.SummaryVec
OperatorLatency *prometheus.GaugeVec
}

type Metrics struct {
Expand Down Expand Up @@ -178,6 +179,14 @@ func NewMetrics(httpPort string, logger logging.Logger) *Metrics {
},
[]string{"operator_id", "status"},
),
OperatorLatency: promauto.With(reg).NewGaugeVec(
prometheus.GaugeOpts{
Namespace: namespace,
Name: "operator_attestation_latency_ms",
Help: "attestation latency in ms observed for operators",
},
[]string{"operator_id"},
),
}

metrics := &Metrics{
Expand Down Expand Up @@ -288,7 +297,14 @@ func (t *DispatcherMetrics) ObserveLatency(operatorId string, success bool, late
if !success {
label = "failure"
}
t.Latency.WithLabelValues(operatorId, label).Observe(latencyMS)
// The Latency metric has "operator_id" but we null it out because it's separately
// tracked in OperatorLatency.
t.Latency.WithLabelValues("", label).Observe(latencyMS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need the label if we are just going to null it out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't evaluated it much, is it safe to delete the label for this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything obvious that would go wrong. Maybe test in preprod?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be better to keep it for a while, we may want to look back the operator latency in past month for example, if this label is gone, we cannot do that.

// Only tracks successful requests, so there is one stream per operator.
// This is sufficient to provide insights of operators' performance.
if success {
t.OperatorLatency.WithLabelValues(operatorId).Set(latencyMS)
}
}

// UpdateCompletedBlob increments the number and updates size of processed blobs.
Expand Down
Loading