diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 30514699..e645ba30 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -36,4 +36,4 @@ jobs: uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 with: args: --verbose - version: v1.61.0 + version: v1.62.0 diff --git a/.yamllint b/.yamllint index 1859cb62..8d09c375 100644 --- a/.yamllint +++ b/.yamllint @@ -1,7 +1,7 @@ --- extends: default ignore: | - ui/react-app/node_modules + **/node_modules rules: braces: diff --git a/Makefile.common b/Makefile.common index cbb5d863..fc47bdbb 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v1.60.2 +GOLANGCI_LINT_VERSION ?= v1.62.0 # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) diff --git a/collector/perf_schema_events_statements.go b/collector/perf_schema_events_statements.go index 5563a94c..b7cb7db2 100644 --- a/collector/perf_schema_events_statements.go +++ b/collector/perf_schema_events_statements.go @@ -42,7 +42,10 @@ const perfEventsStatementsQuery = ` SUM_CREATED_TMP_TABLES, SUM_SORT_MERGE_PASSES, SUM_SORT_ROWS, - SUM_NO_INDEX_USED + SUM_NO_INDEX_USED, + QUANTILE_95, + QUANTILE_99, + QUANTILE_999 FROM ( SELECT * FROM performance_schema.events_statements_summary_by_digest @@ -67,7 +70,10 @@ const perfEventsStatementsQuery = ` Q.SUM_CREATED_TMP_TABLES, Q.SUM_SORT_MERGE_PASSES, Q.SUM_SORT_ROWS, - Q.SUM_NO_INDEX_USED + Q.SUM_NO_INDEX_USED, + Q.QUANTILE_95, + Q.QUANTILE_99, + Q.QUANTILE_999 ORDER BY SUM_TIMER_WAIT DESC LIMIT %d ` @@ -144,6 +150,11 @@ var ( "The total number of statements that used full table scans by digest.", []string{"schema", "digest", "digest_text"}, nil, ) + performanceSchemaEventsStatementsLatency = prometheus.NewDesc( + prometheus.BuildFQName(namespace, performanceSchema, "events_statements_latency"), + "A summary of statement latency by digest", + []string{"schema", "digest", "digest_text"}, nil, + ) ) // ScrapePerfEventsStatements collects from `performance_schema.events_statements_summary_by_digest`. @@ -208,10 +219,11 @@ func (c ScrapePerfEventsStatements) Scrape(ctx context.Context, instance *instan tmpTables, tmpDiskTables uint64 sortMergePasses, sortRows uint64 noIndexUsed uint64 + quantile95, quantile99, quantile999 uint64 ) for perfSchemaEventsStatementsRows.Next() { if err := perfSchemaEventsStatementsRows.Scan( - &schemaName, &digest, &digestText, &count, &queryTime, &lockTime, &cpuTime, &errors, &warnings, &rowsAffected, &rowsSent, &rowsExamined, &tmpDiskTables, &tmpTables, &sortMergePasses, &sortRows, &noIndexUsed, + &schemaName, &digest, &digestText, &count, &queryTime, &lockTime, &cpuTime, &errors, &warnings, &rowsAffected, &rowsSent, &rowsExamined, &tmpDiskTables, &tmpTables, &sortMergePasses, &sortRows, &noIndexUsed, &quantile95, &quantile99, &quantile999, ); err != nil { return err } @@ -271,6 +283,11 @@ func (c ScrapePerfEventsStatements) Scrape(ctx context.Context, instance *instan performanceSchemaEventsStatementsNoIndexUsedDesc, prometheus.CounterValue, float64(noIndexUsed), 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 }