Skip to content

Commit 744d93b

Browse files
authored
Upgrade mysqld_exporter to v0.15.0 (#5417)
1 parent 1d11d37 commit 744d93b

File tree

9 files changed

+86
-29
lines changed

9 files changed

+86
-29
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ Main (unreleased)
1414

1515
- Remove `otelcol.exporter.jaeger` component (@hainenber)
1616

17+
- In the mysqld exporter integration, some metrics are removed and others are renamed. (@marctc)
18+
- Removed metrics:
19+
- "mysql_last_scrape_failed" (gauge)
20+
- "mysql_exporter_scrapes_total" (counter)
21+
- "mysql_exporter_scrape_errors_total" (counter)
22+
- Metric names in the `info_schema.processlist` collector have been [changed](https://github.com/prometheus/mysqld_exporter/pull/603).
23+
- Metric names in the `info_schema.replica_host` collector have been [changed](https://github.com/prometheus/mysqld_exporter/pull/496).
24+
- Changes related to `replication_group_member_stats collector`:
25+
- metric "transaction_in_queue" was Counter instead of Gauge
26+
- renamed 3 metrics starting with `mysql_perf_schema_transaction_` to start with `mysql_perf_schema_transactions_` to be consistent with column names.
27+
- exposing only server's own stats by matching `MEMBER_ID` with `@@server_uuid` resulting "member_id" label to be dropped.
28+
29+
### Other changes
30+
31+
- Bump `mysqld_exporter` version to v0.15.0. (@marctc)
32+
1733
### Features
1834

1935
- Added a new `stage.decolorize` stage to `loki.process` component which

component/prometheus/exporter/mysql/mysql.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ var DefaultArguments = Arguments{
4444
Filter: ".*",
4545
RemovePrefix: "/var/lib/mysql",
4646
},
47+
PerfSchemaMemoryEvents: PerfSchemaMemoryEvents{
48+
RemovePrefix: "memory/",
49+
},
4750
Heartbeat: Heartbeat{
4851
Database: "heartbeat",
4952
Table: "heartbeat",
@@ -72,8 +75,10 @@ type Arguments struct {
7275
InfoSchemaTables InfoSchemaTables `river:"info_schema.tables,block,optional"`
7376
PerfSchemaEventsStatements PerfSchemaEventsStatements `river:"perf_schema.eventsstatements,block,optional"`
7477
PerfSchemaFileInstances PerfSchemaFileInstances `river:"perf_schema.file_instances,block,optional"`
75-
Heartbeat Heartbeat `river:"heartbeat,block,optional"`
76-
MySQLUser MySQLUser `river:"mysql.user,block,optional"`
78+
PerfSchemaMemoryEvents PerfSchemaMemoryEvents `river:"perf_schema.memory_events,block,optional"`
79+
80+
Heartbeat Heartbeat `river:"heartbeat,block,optional"`
81+
MySQLUser MySQLUser `river:"mysql.user,block,optional"`
7782
}
7883

7984
// InfoSchemaProcessList configures the info_schema.processlist collector
@@ -101,6 +106,11 @@ type PerfSchemaFileInstances struct {
101106
RemovePrefix string `river:"remove_prefix,attr,optional"`
102107
}
103108

109+
// PerfSchemaMemoryEvents configures the perf_schema.memory_events collector
110+
type PerfSchemaMemoryEvents struct {
111+
RemovePrefix string `river:"remove_prefix,attr,optional"`
112+
}
113+
104114
// Heartbeat controls the heartbeat collector
105115
type Heartbeat struct {
106116
Database string `river:"database,attr,optional"`
@@ -144,6 +154,7 @@ func (a *Arguments) Convert() *mysqld_exporter.Config {
144154
PerfSchemaEventsStatementsTextLimit: a.PerfSchemaEventsStatements.TextLimit,
145155
PerfSchemaFileInstancesFilter: a.PerfSchemaFileInstances.Filter,
146156
PerfSchemaFileInstancesRemovePrefix: a.PerfSchemaFileInstances.RemovePrefix,
157+
PerfSchemaMemoryEventsRemovePrefix: a.PerfSchemaMemoryEvents.RemovePrefix,
147158
HeartbeatDatabase: a.Heartbeat.Database,
148159
HeartbeatTable: a.Heartbeat.Table,
149160
HeartbeatUTC: a.Heartbeat.UTC,

component/prometheus/exporter/mysql/mysql_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ func TestRiverConfigUnmarshal(t *testing.T) {
3939
remove_prefix = "instances_remove"
4040
}
4141
42+
perf_schema.memory_events {
43+
remove_prefix = "innodb/"
44+
}
45+
4246
heartbeat {
4347
database = "heartbeat_database"
4448
table = "heartbeat_table"
@@ -69,6 +73,7 @@ func TestRiverConfigUnmarshal(t *testing.T) {
6973
require.Equal(t, 5, args.PerfSchemaEventsStatements.TextLimit)
7074
require.Equal(t, "instances_filter", args.PerfSchemaFileInstances.Filter)
7175
require.Equal(t, "instances_remove", args.PerfSchemaFileInstances.RemovePrefix)
76+
require.Equal(t, "innodb/", args.PerfSchemaMemoryEvents.RemovePrefix)
7277
require.Equal(t, "heartbeat_database", args.Heartbeat.Database)
7378
require.Equal(t, "heartbeat_table", args.Heartbeat.Table)
7479
require.True(t, args.Heartbeat.UTC)
@@ -105,6 +110,10 @@ func TestRiverConfigConvert(t *testing.T) {
105110
remove_prefix = "instances_remove"
106111
}
107112
113+
perf_schema.memory_events {
114+
remove_prefix = "innodb/"
115+
}
116+
108117
heartbeat {
109118
database = "heartbeat_database"
110119
table = "heartbeat_table"
@@ -136,6 +145,7 @@ func TestRiverConfigConvert(t *testing.T) {
136145
require.Equal(t, 5, c.PerfSchemaEventsStatementsTextLimit)
137146
require.Equal(t, "instances_filter", c.PerfSchemaFileInstancesFilter)
138147
require.Equal(t, "instances_remove", c.PerfSchemaFileInstancesRemovePrefix)
148+
require.Equal(t, "innodb/", c.PerfSchemaMemoryEventsRemovePrefix)
139149
require.Equal(t, "heartbeat_database", c.HeartbeatDatabase)
140150
require.Equal(t, "heartbeat_table", c.HeartbeatTable)
141151
require.True(t, c.HeartbeatUTC)

converter/internal/staticconvert/internal/build/mysqld_exporter.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ func toMysqldExporter(config *mysqld_exporter.Config) *mysql.Arguments {
4848
Filter: config.PerfSchemaFileInstancesFilter,
4949
RemovePrefix: config.PerfSchemaFileInstancesRemovePrefix,
5050
},
51+
PerfSchemaMemoryEvents: mysql.PerfSchemaMemoryEvents{
52+
RemovePrefix: config.PerfSchemaMemoryEventsRemovePrefix,
53+
},
5154
Heartbeat: mysql.Heartbeat{
5255
Database: config.HeartbeatDatabase,
5356
Table: config.HeartbeatTable,

docs/sources/flow/reference/components/prometheus.exporter.mysql.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ The following blocks are supported inside the definition of
5252
| info_schema.tables | [info_schema.tables][] | Configures the `info_schema.tables` collector. | no |
5353
| perf_schema.eventsstatements | [perf_schema.eventsstatements][] | Configures the `perf_schema.eventsstatements` collector. | no |
5454
| perf_schema.file_instances | [perf_schema.file_instances][] | Configures the `perf_schema.file_instances` collector. | no |
55+
| perf_schema.memory_events | [perf_schema.memory_events][] | Configures the `perf_schema.memory_events` collector. | no |
5556
| heartbeat | [heartbeat][] | Configures the `heartbeat` collector. | no |
5657
| mysql.user | [mysql.user][] | Configures the `mysql.user` collector. | no |
5758

5859
[info_schema.processlist]: #info_schemaprocesslist-block
5960
[info_schema.tables]: #info_schematables-block
6061
[perf_schema.eventsstatements]: #perf_schemaeventsstatements-block
6162
[perf_schema.file_instances]: #perf_schemafile_instances-block
63+
[perf_schema.memory_events]: #perf_schemamemory_events-block
6264
[heartbeat]: #heartbeat-block
6365
[mysql.user]: #mysqluser-block
6466

@@ -93,6 +95,12 @@ The following blocks are supported inside the definition of
9395

9496
View more detailed documentation on the tables used in `perf_schema_file_instances_filter` and `perf_schema_file_instances_remove_prefix` [in the MySQL documentation](https://dev.mysql.com/doc/mysql-perfschema-excerpt/8.0/en/performance-schema-file-summary-tables.html).
9597

98+
### perf_schema.memory_events block
99+
100+
| Name | Type | Description | Default | Required |
101+
| --------------- | -------- | ----------------------------------------------------------------------------------- | ------------------ | -------- |
102+
| `remove_prefix` | `string` | Prefix to trim away from `performance_schema.memory_summary_global_by_event_name`. | `"memory/"` | no |
103+
96104
### heartbeat block
97105

98106
| Name | Type | Description | Default | Required |
@@ -138,6 +146,7 @@ The full list of supported collectors is:
138146
| perf_schema.file_events | Collect metrics from `performance_schema.file_summary_by_event_name`. | no |
139147
| perf_schema.file_instances | Collect metrics from `performance_schema.file_summary_by_instance`. | no |
140148
| perf_schema.indexiowaits | Collect metrics from `performance_schema.table_io_waits_summary_by_index_usage`. | no |
149+
| perf_schema.memory_events | Collect metrics from `performance_schema.memory_summary_global_by_event_name`. | no |
141150
| perf_schema.replication_applier_status_by_worker | Collect metrics from `performance_schema.replication_applier_status_by_worker`. | no |
142151
| perf_schema.replication_group_member_stats | Collect metrics from `performance_schema.replication_group_member_stats`. | no |
143152
| perf_schema.replication_group_members | Collect metrics from `performance_schema.replication_group_members`. | no |

docs/sources/static/configuration/integrations/mysqld-exporter-config.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ Full reference of options:
120120
[perf_schema_file_instances_filter: <string> | default = ".*"]
121121
# Remove path prefix in performance_schema.file_summary_by_instance
122122
[perf_schema_file_instances_remove_prefix: <string> | default = "/var/lib/mysql"]
123+
# Remove instrument prefix in performance_schema.memory_summary_global_by_event_name
124+
[perf_schema_memory_events_remove_prefix: <string> | default = "memory/"]
123125
# Database from where to collect heartbeat data.
124126
[heartbeat_database: <string> | default = "heartbeat"]
125127
# Table from where to collect heartbeat data.
@@ -159,6 +161,7 @@ The full list of collectors that are supported for `mysqld_exporter` is:
159161
| perf_schema.file_events | Collect metrics from performance_schema.file_summary_by_event_name | no |
160162
| perf_schema.file_instances | Collect metrics from performance_schema.file_summary_by_instance | no |
161163
| perf_schema.indexiowaits | Collect metrics from performance_schema.table_io_waits_summary_by_index_usage | no |
164+
| perf_schema.memory_events | Collect metrics from performance_schema.memory_summary_global_by_event_name |no |
162165
| perf_schema.replication_applier_status_by_worker | Collect metrics from performance_schema.replication_applier_status_by_worker | no |
163166
| perf_schema.replication_group_member_stats | Collect metrics from performance_schema.replication_group_member_stats | no |
164167
| perf_schema.replication_group_members | Collect metrics from performance_schema.replication_group_members | no |

go.mod

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ require (
4040
github.com/go-logfmt/logfmt v0.6.0
4141
github.com/go-logr/logr v1.2.4
4242
github.com/go-sourcemap/sourcemap v2.1.3+incompatible
43-
github.com/go-sql-driver/mysql v1.7.0
43+
github.com/go-sql-driver/mysql v1.7.1
4444
github.com/gogo/protobuf v1.3.2
4545
github.com/golang/protobuf v1.5.3
4646
github.com/golang/snappy v0.0.4
@@ -144,8 +144,8 @@ require (
144144
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0
145145
github.com/prometheus-operator/prometheus-operator/pkg/client v0.66.0
146146
github.com/prometheus/blackbox_exporter v0.24.1-0.20230623125439-bd22efa1c900
147-
github.com/prometheus/client_golang v1.16.0
148-
github.com/prometheus/client_model v0.4.0
147+
github.com/prometheus/client_golang v1.17.0
148+
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16
149149
github.com/prometheus/common v0.44.0
150150
github.com/prometheus/consul_exporter v0.8.0
151151
github.com/prometheus/memcached_exporter v0.13.0
@@ -395,7 +395,6 @@ require (
395395
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
396396
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
397397
github.com/gophercloud/gophercloud v1.5.0 // indirect
398-
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
399398
github.com/gorilla/websocket v1.5.0 // indirect
400399
github.com/gosnmp/gosnmp v1.36.0 // indirect
401400
github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9 // indirect
@@ -539,7 +538,6 @@ require (
539538
github.com/safchain/ethtool v0.3.0 // indirect
540539
github.com/samber/lo v1.38.1 // indirect
541540
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da // indirect
542-
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
543541
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.20
544542
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
545543
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646 // indirect
@@ -704,14 +702,17 @@ replace (
704702
// TODO(mattdurham): this is so you can debug on windows, when PR is merged into perflib, can you use that
705703
// and eventually remove if windows_exporter shifts to it. https://github.com/leoluk/perflib_exporter/pull/43
706704
github.com/leoluk/perflib_exporter => github.com/grafana/perflib_exporter v0.1.1-0.20230511173423-6166026bd090
707-
github.com/prometheus-community/postgres_exporter => github.com/grafana/postgres_exporter v0.8.1-0.20210722175051-db35d7c2f520
708705

709-
// TODO(mattdurham): this is to allow defaults to propogate properly.
706+
// TODO(mattdurham): this is to allow defaults to propogate properly: https://github.com/prometheus-community/windows_exporter/pull/1227
710707
github.com/prometheus-community/windows_exporter => github.com/grafana/windows_exporter v0.15.1-0.20230612134738-fdb3ba7accd8
711-
github.com/prometheus/mysqld_exporter => github.com/grafana/mysqld_exporter v0.12.2-0.20201015182516-5ac885b2d38a
712708

713-
// Replace node_export with custom fork for multi usage. https://github.com/prometheus/node_exporter/pull/2812
709+
// TODO(marctc): remove once this PR is merged upstream: https://github.com/prometheus/mysqld_exporter/pull/774
710+
github.com/prometheus/mysqld_exporter => github.com/grafana/mysqld_exporter v0.12.2-0.20231005125903-364b9c41e595
711+
712+
// TODO(marctc, mattdurham): Replace node_export with custom fork for multi usage. https://github.com/prometheus/node_exporter/pull/2812
714713
github.com/prometheus/node_exporter => github.com/grafana/node_exporter v0.18.1-grafana-r01.0.20231004161416-702318429731
714+
715+
github.com/prometheus-community/postgres_exporter => github.com/grafana/postgres_exporter v0.8.1-0.20210722175051-db35d7c2f520
715716
)
716717

717718
// Excluding fixes a conflict in test packages and allows "go mod tidy" to run.

0 commit comments

Comments
 (0)