Skip to content

Commit

Permalink
Use summary to represent query latency quantiles.
Browse files Browse the repository at this point in the history
This change replaces the individual quantile (95,99,999) metrics
with a summary that captures those respective quantiles. Enables
a more prometheus native representation of the data.

Signed-off-by: Matt Nolf <[email protected]>
  • Loading branch information
matthewnolf committed Nov 28, 2024
1 parent 85082aa commit 3e15ba9
Showing 1 changed file with 8 additions and 25 deletions.
33 changes: 8 additions & 25 deletions collector/perf_schema_events_statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,9 @@ var (
"The total number of statements that used full table scans by digest.",
[]string{"schema", "digest", "digest_text"}, nil,
)
performanceSchemaEventsStatementsQuantile95 = prometheus.NewDesc(
prometheus.BuildFQName(namespace, performanceSchema, "events_statements_quantile_95"),
"The 95th percentile of the statement latency, in picoseconds.",
[]string{"schema", "digest", "digest_text"}, nil,
)
performanceSchemaEventsStatementsQuantile99 = prometheus.NewDesc(
prometheus.BuildFQName(namespace, performanceSchema, "events_statements_quantile_99"),
"The 99th percentile of the statement latency, in picoseconds.",
[]string{"schema", "digest", "digest_text"}, nil,
)
performanceSchemaEventsStatementsQuantile999 = prometheus.NewDesc(
prometheus.BuildFQName(namespace, performanceSchema, "events_statements_quantile_999"),
"The 99.9th percentile of the statement latency, in picoseconds.",
performanceSchemaEventsStatementsLatency = prometheus.NewDesc(
prometheus.BuildFQName(namespace, performanceSchema, "events_statements_latency"),
"A summary of statement latency by digest",
[]string{"schema", "digest", "digest_text"}, nil,
)
)
Expand Down Expand Up @@ -289,18 +279,11 @@ func (ScrapePerfEventsStatements) Scrape(ctx context.Context, instance *instance
performanceSchemaEventsStatementsNoIndexUsedDesc, prometheus.CounterValue, float64(noIndexUsed),
schemaName, digest, digestText,
)
ch <- prometheus.MustNewConstMetric(
performanceSchemaEventsStatementsQuantile95, prometheus.CounterValue, float64(quantile95),
schemaName, digest, digestText,
)
ch <- prometheus.MustNewConstMetric(
performanceSchemaEventsStatementsQuantile99, prometheus.CounterValue, float64(quantile99),
schemaName, digest, digestText,
)
ch <- prometheus.MustNewConstMetric(
performanceSchemaEventsStatementsQuantile999, prometheus.CounterValue, float64(quantile999),
schemaName, digest, digestText,
)
ch <- prometheus.MustNewConstSummary(performanceSchemaEventsStatementsLatency, count, float64(queryTime)/picoSeconds, map[float64]float64{
95: float64(quantile95) / picoSeconds,
99: float64(quantile99) / picoSeconds,
999: float64(quantile999) / picoSeconds,
}, schemaName, digest, digestText)
}
return nil
}
Expand Down

0 comments on commit 3e15ba9

Please sign in to comment.