Skip to content

Commit cd63ca0

Browse files
Merge branch 'prometheus:main' into refactor_collector
2 parents 47b8ea9 + 2ef168b commit cd63ca0

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

.github/workflows/golangci-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
3737
with:
3838
args: --verbose
39-
version: v1.61.0
39+
version: v1.62.0

.yamllint

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
extends: default
33
ignore: |
4-
ui/react-app/node_modules
4+
**/node_modules
55

66
rules:
77
braces:

Makefile.common

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
6161
SKIP_GOLANGCI_LINT :=
6262
GOLANGCI_LINT :=
6363
GOLANGCI_LINT_OPTS ?=
64-
GOLANGCI_LINT_VERSION ?= v1.60.2
64+
GOLANGCI_LINT_VERSION ?= v1.62.0
6565
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
6666
# windows isn't included here because of the path separator being different.
6767
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))

collector/perf_schema_events_statements.go

+20-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ const perfEventsStatementsQuery = `
4242
SUM_CREATED_TMP_TABLES,
4343
SUM_SORT_MERGE_PASSES,
4444
SUM_SORT_ROWS,
45-
SUM_NO_INDEX_USED
45+
SUM_NO_INDEX_USED,
46+
QUANTILE_95,
47+
QUANTILE_99,
48+
QUANTILE_999
4649
FROM (
4750
SELECT *
4851
FROM performance_schema.events_statements_summary_by_digest
@@ -67,7 +70,10 @@ const perfEventsStatementsQuery = `
6770
Q.SUM_CREATED_TMP_TABLES,
6871
Q.SUM_SORT_MERGE_PASSES,
6972
Q.SUM_SORT_ROWS,
70-
Q.SUM_NO_INDEX_USED
73+
Q.SUM_NO_INDEX_USED,
74+
Q.QUANTILE_95,
75+
Q.QUANTILE_99,
76+
Q.QUANTILE_999
7177
ORDER BY SUM_TIMER_WAIT DESC
7278
LIMIT %d
7379
`
@@ -144,6 +150,11 @@ var (
144150
"The total number of statements that used full table scans by digest.",
145151
[]string{"schema", "digest", "digest_text"}, nil,
146152
)
153+
performanceSchemaEventsStatementsLatency = prometheus.NewDesc(
154+
prometheus.BuildFQName(namespace, performanceSchema, "events_statements_latency"),
155+
"A summary of statement latency by digest",
156+
[]string{"schema", "digest", "digest_text"}, nil,
157+
)
147158
)
148159

149160
// ScrapePerfEventsStatements collects from `performance_schema.events_statements_summary_by_digest`.
@@ -208,10 +219,11 @@ func (c ScrapePerfEventsStatements) Scrape(ctx context.Context, instance *instan
208219
tmpTables, tmpDiskTables uint64
209220
sortMergePasses, sortRows uint64
210221
noIndexUsed uint64
222+
quantile95, quantile99, quantile999 uint64
211223
)
212224
for perfSchemaEventsStatementsRows.Next() {
213225
if err := perfSchemaEventsStatementsRows.Scan(
214-
&schemaName, &digest, &digestText, &count, &queryTime, &lockTime, &cpuTime, &errors, &warnings, &rowsAffected, &rowsSent, &rowsExamined, &tmpDiskTables, &tmpTables, &sortMergePasses, &sortRows, &noIndexUsed,
226+
&schemaName, &digest, &digestText, &count, &queryTime, &lockTime, &cpuTime, &errors, &warnings, &rowsAffected, &rowsSent, &rowsExamined, &tmpDiskTables, &tmpTables, &sortMergePasses, &sortRows, &noIndexUsed, &quantile95, &quantile99, &quantile999,
215227
); err != nil {
216228
return err
217229
}
@@ -271,6 +283,11 @@ func (c ScrapePerfEventsStatements) Scrape(ctx context.Context, instance *instan
271283
performanceSchemaEventsStatementsNoIndexUsedDesc, prometheus.CounterValue, float64(noIndexUsed),
272284
schemaName, digest, digestText,
273285
)
286+
ch <- prometheus.MustNewConstSummary(performanceSchemaEventsStatementsLatency, count, float64(queryTime)/picoSeconds, map[float64]float64{
287+
95: float64(quantile95) / picoSeconds,
288+
99: float64(quantile99) / picoSeconds,
289+
999: float64(quantile999) / picoSeconds,
290+
}, schemaName, digest, digestText)
274291
}
275292
return nil
276293
}

0 commit comments

Comments
 (0)