Skip to content

Commit

Permalink
backupccl: add exportrequest.delay.total metric
Browse files Browse the repository at this point in the history
This commit adds a metric to track how long export requests are blocked
by the concurrency limiter.

Release note (ops change): Introduce a new metric
(exportrequest.delay.total) to track how long ExportRequests (issued by
BACKUP) are delayed by throttling mechansisms.
  • Loading branch information
pbardea committed Jul 8, 2021
1 parent 36ed61e commit 49a76ad
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/kv/kvserver/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,14 @@ var (
Unit: metric.Unit_NANOSECONDS,
}

// Export request counter.
metaExportEvalTotalDelay = metric.Metadata{
Name: "exportrequest.delay.total",
Help: "Amount by which evaluation of Export requests was delayed",
Measurement: "Nanoseconds",
Unit: metric.Unit_NANOSECONDS,
}

// Encryption-at-rest metrics.
// TODO(mberhault): metrics for key age, per-key file/bytes counts.
metaEncryptionAlgorithm = metric.Metadata{
Expand Down Expand Up @@ -1282,6 +1290,9 @@ type StoreMetrics struct {
AddSSTableProposalTotalDelay *metric.Counter
AddSSTableProposalEngineDelay *metric.Counter

// Export request stats.
ExportRequestProposalTotalDelay *metric.Counter

// Encryption-at-rest stats.
// EncryptionAlgorithm is an enum representing the cipher in use, so we use a gauge.
EncryptionAlgorithm *metric.Gauge
Expand Down Expand Up @@ -1672,6 +1683,9 @@ func newStoreMetrics(histogramWindow time.Duration) *StoreMetrics {
AddSSTableProposalTotalDelay: metric.NewCounter(metaAddSSTableEvalTotalDelay),
AddSSTableProposalEngineDelay: metric.NewCounter(metaAddSSTableEvalEngineDelay),

// ExportRequest proposal.
ExportRequestProposalTotalDelay: metric.NewCounter(metaExportEvalTotalDelay),

// Encryption-at-rest.
EncryptionAlgorithm: metric.NewGauge(metaEncryptionAlgorithm),

Expand Down
1 change: 1 addition & 0 deletions pkg/kv/kvserver/store_send.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ func (s *Store) maybeThrottleBatch(
}

waited := timeutil.Since(before)
s.metrics.ExportRequestProposalTotalDelay.Inc(waited.Nanoseconds())
if waited > time.Second {
log.Infof(ctx, "Export request was delayed by %v", waited)
}
Expand Down
11 changes: 11 additions & 0 deletions pkg/ts/catalog/chart_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -2305,6 +2305,17 @@ var charts = []sectionDescription{
},
},
},
{
Organization: [][]string{{DistributionLayer, "Bulk", "Egress"}},
Charts: []chartDescription{
{
Title: "Export Delays",
Metrics: []string{
"exportrequest.delay.total",
},
},
},
},
{
Organization: [][]string{{StorageLayer, "Storage", "KV"}},
Charts: []chartDescription{
Expand Down

0 comments on commit 49a76ad

Please sign in to comment.