Skip to content

Commit

Permalink
Upgrade mysqld_exporter to v0.15.0 (#5417)
Browse files Browse the repository at this point in the history
  • Loading branch information
marctc authored Oct 17, 2023
1 parent 1d11d37 commit 744d93b
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 29 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ Main (unreleased)

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

- In the mysqld exporter integration, some metrics are removed and others are renamed. (@marctc)
- Removed metrics:
- "mysql_last_scrape_failed" (gauge)
- "mysql_exporter_scrapes_total" (counter)
- "mysql_exporter_scrape_errors_total" (counter)
- Metric names in the `info_schema.processlist` collector have been [changed](https://github.com/prometheus/mysqld_exporter/pull/603).
- Metric names in the `info_schema.replica_host` collector have been [changed](https://github.com/prometheus/mysqld_exporter/pull/496).
- Changes related to `replication_group_member_stats collector`:
- metric "transaction_in_queue" was Counter instead of Gauge
- renamed 3 metrics starting with `mysql_perf_schema_transaction_` to start with `mysql_perf_schema_transactions_` to be consistent with column names.
- exposing only server's own stats by matching `MEMBER_ID` with `@@server_uuid` resulting "member_id" label to be dropped.

### Other changes

- Bump `mysqld_exporter` version to v0.15.0. (@marctc)

### Features

- Added a new `stage.decolorize` stage to `loki.process` component which
Expand Down
15 changes: 13 additions & 2 deletions component/prometheus/exporter/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ var DefaultArguments = Arguments{
Filter: ".*",
RemovePrefix: "/var/lib/mysql",
},
PerfSchemaMemoryEvents: PerfSchemaMemoryEvents{
RemovePrefix: "memory/",
},
Heartbeat: Heartbeat{
Database: "heartbeat",
Table: "heartbeat",
Expand Down Expand Up @@ -72,8 +75,10 @@ type Arguments struct {
InfoSchemaTables InfoSchemaTables `river:"info_schema.tables,block,optional"`
PerfSchemaEventsStatements PerfSchemaEventsStatements `river:"perf_schema.eventsstatements,block,optional"`
PerfSchemaFileInstances PerfSchemaFileInstances `river:"perf_schema.file_instances,block,optional"`
Heartbeat Heartbeat `river:"heartbeat,block,optional"`
MySQLUser MySQLUser `river:"mysql.user,block,optional"`
PerfSchemaMemoryEvents PerfSchemaMemoryEvents `river:"perf_schema.memory_events,block,optional"`

Heartbeat Heartbeat `river:"heartbeat,block,optional"`
MySQLUser MySQLUser `river:"mysql.user,block,optional"`
}

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

// PerfSchemaMemoryEvents configures the perf_schema.memory_events collector
type PerfSchemaMemoryEvents struct {
RemovePrefix string `river:"remove_prefix,attr,optional"`
}

// Heartbeat controls the heartbeat collector
type Heartbeat struct {
Database string `river:"database,attr,optional"`
Expand Down Expand Up @@ -144,6 +154,7 @@ func (a *Arguments) Convert() *mysqld_exporter.Config {
PerfSchemaEventsStatementsTextLimit: a.PerfSchemaEventsStatements.TextLimit,
PerfSchemaFileInstancesFilter: a.PerfSchemaFileInstances.Filter,
PerfSchemaFileInstancesRemovePrefix: a.PerfSchemaFileInstances.RemovePrefix,
PerfSchemaMemoryEventsRemovePrefix: a.PerfSchemaMemoryEvents.RemovePrefix,
HeartbeatDatabase: a.Heartbeat.Database,
HeartbeatTable: a.Heartbeat.Table,
HeartbeatUTC: a.Heartbeat.UTC,
Expand Down
10 changes: 10 additions & 0 deletions component/prometheus/exporter/mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func TestRiverConfigUnmarshal(t *testing.T) {
remove_prefix = "instances_remove"
}
perf_schema.memory_events {
remove_prefix = "innodb/"
}
heartbeat {
database = "heartbeat_database"
table = "heartbeat_table"
Expand Down Expand Up @@ -69,6 +73,7 @@ func TestRiverConfigUnmarshal(t *testing.T) {
require.Equal(t, 5, args.PerfSchemaEventsStatements.TextLimit)
require.Equal(t, "instances_filter", args.PerfSchemaFileInstances.Filter)
require.Equal(t, "instances_remove", args.PerfSchemaFileInstances.RemovePrefix)
require.Equal(t, "innodb/", args.PerfSchemaMemoryEvents.RemovePrefix)
require.Equal(t, "heartbeat_database", args.Heartbeat.Database)
require.Equal(t, "heartbeat_table", args.Heartbeat.Table)
require.True(t, args.Heartbeat.UTC)
Expand Down Expand Up @@ -105,6 +110,10 @@ func TestRiverConfigConvert(t *testing.T) {
remove_prefix = "instances_remove"
}
perf_schema.memory_events {
remove_prefix = "innodb/"
}
heartbeat {
database = "heartbeat_database"
table = "heartbeat_table"
Expand Down Expand Up @@ -136,6 +145,7 @@ func TestRiverConfigConvert(t *testing.T) {
require.Equal(t, 5, c.PerfSchemaEventsStatementsTextLimit)
require.Equal(t, "instances_filter", c.PerfSchemaFileInstancesFilter)
require.Equal(t, "instances_remove", c.PerfSchemaFileInstancesRemovePrefix)
require.Equal(t, "innodb/", c.PerfSchemaMemoryEventsRemovePrefix)
require.Equal(t, "heartbeat_database", c.HeartbeatDatabase)
require.Equal(t, "heartbeat_table", c.HeartbeatTable)
require.True(t, c.HeartbeatUTC)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ func toMysqldExporter(config *mysqld_exporter.Config) *mysql.Arguments {
Filter: config.PerfSchemaFileInstancesFilter,
RemovePrefix: config.PerfSchemaFileInstancesRemovePrefix,
},
PerfSchemaMemoryEvents: mysql.PerfSchemaMemoryEvents{
RemovePrefix: config.PerfSchemaMemoryEventsRemovePrefix,
},
Heartbeat: mysql.Heartbeat{
Database: config.HeartbeatDatabase,
Table: config.HeartbeatTable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ The following blocks are supported inside the definition of
| info_schema.tables | [info_schema.tables][] | Configures the `info_schema.tables` collector. | no |
| perf_schema.eventsstatements | [perf_schema.eventsstatements][] | Configures the `perf_schema.eventsstatements` collector. | no |
| perf_schema.file_instances | [perf_schema.file_instances][] | Configures the `perf_schema.file_instances` collector. | no |
| perf_schema.memory_events | [perf_schema.memory_events][] | Configures the `perf_schema.memory_events` collector. | no |
| heartbeat | [heartbeat][] | Configures the `heartbeat` collector. | no |
| mysql.user | [mysql.user][] | Configures the `mysql.user` collector. | no |

[info_schema.processlist]: #info_schemaprocesslist-block
[info_schema.tables]: #info_schematables-block
[perf_schema.eventsstatements]: #perf_schemaeventsstatements-block
[perf_schema.file_instances]: #perf_schemafile_instances-block
[perf_schema.memory_events]: #perf_schemamemory_events-block
[heartbeat]: #heartbeat-block
[mysql.user]: #mysqluser-block

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

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).

### perf_schema.memory_events block

| Name | Type | Description | Default | Required |
| --------------- | -------- | ----------------------------------------------------------------------------------- | ------------------ | -------- |
| `remove_prefix` | `string` | Prefix to trim away from `performance_schema.memory_summary_global_by_event_name`. | `"memory/"` | no |

### heartbeat block

| Name | Type | Description | Default | Required |
Expand Down Expand Up @@ -138,6 +146,7 @@ The full list of supported collectors is:
| perf_schema.file_events | Collect metrics from `performance_schema.file_summary_by_event_name`. | no |
| perf_schema.file_instances | Collect metrics from `performance_schema.file_summary_by_instance`. | no |
| perf_schema.indexiowaits | Collect metrics from `performance_schema.table_io_waits_summary_by_index_usage`. | no |
| perf_schema.memory_events | Collect metrics from `performance_schema.memory_summary_global_by_event_name`. | no |
| perf_schema.replication_applier_status_by_worker | Collect metrics from `performance_schema.replication_applier_status_by_worker`. | no |
| perf_schema.replication_group_member_stats | Collect metrics from `performance_schema.replication_group_member_stats`. | no |
| perf_schema.replication_group_members | Collect metrics from `performance_schema.replication_group_members`. | no |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ Full reference of options:
[perf_schema_file_instances_filter: <string> | default = ".*"]
# Remove path prefix in performance_schema.file_summary_by_instance
[perf_schema_file_instances_remove_prefix: <string> | default = "/var/lib/mysql"]
# Remove instrument prefix in performance_schema.memory_summary_global_by_event_name
[perf_schema_memory_events_remove_prefix: <string> | default = "memory/"]
# Database from where to collect heartbeat data.
[heartbeat_database: <string> | default = "heartbeat"]
# Table from where to collect heartbeat data.
Expand Down Expand Up @@ -159,6 +161,7 @@ The full list of collectors that are supported for `mysqld_exporter` is:
| perf_schema.file_events | Collect metrics from performance_schema.file_summary_by_event_name | no |
| perf_schema.file_instances | Collect metrics from performance_schema.file_summary_by_instance | no |
| perf_schema.indexiowaits | Collect metrics from performance_schema.table_io_waits_summary_by_index_usage | no |
| perf_schema.memory_events | Collect metrics from performance_schema.memory_summary_global_by_event_name |no |
| perf_schema.replication_applier_status_by_worker | Collect metrics from performance_schema.replication_applier_status_by_worker | no |
| perf_schema.replication_group_member_stats | Collect metrics from performance_schema.replication_group_member_stats | no |
| perf_schema.replication_group_members | Collect metrics from performance_schema.replication_group_members | no |
Expand Down
19 changes: 10 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require (
github.com/go-logfmt/logfmt v0.6.0
github.com/go-logr/logr v1.2.4
github.com/go-sourcemap/sourcemap v2.1.3+incompatible
github.com/go-sql-driver/mysql v1.7.0
github.com/go-sql-driver/mysql v1.7.1
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.3
github.com/golang/snappy v0.0.4
Expand Down Expand Up @@ -144,8 +144,8 @@ require (
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0
github.com/prometheus-operator/prometheus-operator/pkg/client v0.66.0
github.com/prometheus/blackbox_exporter v0.24.1-0.20230623125439-bd22efa1c900
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/client_model v0.4.0
github.com/prometheus/client_golang v1.17.0
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16
github.com/prometheus/common v0.44.0
github.com/prometheus/consul_exporter v0.8.0
github.com/prometheus/memcached_exporter v0.13.0
Expand Down Expand Up @@ -395,7 +395,6 @@ require (
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/gophercloud/gophercloud v1.5.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gosnmp/gosnmp v1.36.0 // indirect
github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9 // indirect
Expand Down Expand Up @@ -539,7 +538,6 @@ require (
github.com/safchain/ethtool v0.3.0 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da // indirect
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.20
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646 // indirect
Expand Down Expand Up @@ -704,14 +702,17 @@ replace (
// TODO(mattdurham): this is so you can debug on windows, when PR is merged into perflib, can you use that
// and eventually remove if windows_exporter shifts to it. https://github.com/leoluk/perflib_exporter/pull/43
github.com/leoluk/perflib_exporter => github.com/grafana/perflib_exporter v0.1.1-0.20230511173423-6166026bd090
github.com/prometheus-community/postgres_exporter => github.com/grafana/postgres_exporter v0.8.1-0.20210722175051-db35d7c2f520

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

// Replace node_export with custom fork for multi usage. https://github.com/prometheus/node_exporter/pull/2812
// TODO(marctc): remove once this PR is merged upstream: https://github.com/prometheus/mysqld_exporter/pull/774
github.com/prometheus/mysqld_exporter => github.com/grafana/mysqld_exporter v0.12.2-0.20231005125903-364b9c41e595

// TODO(marctc, mattdurham): Replace node_export with custom fork for multi usage. https://github.com/prometheus/node_exporter/pull/2812
github.com/prometheus/node_exporter => github.com/grafana/node_exporter v0.18.1-grafana-r01.0.20231004161416-702318429731

github.com/prometheus-community/postgres_exporter => github.com/grafana/postgres_exporter v0.8.1-0.20210722175051-db35d7c2f520
)

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

0 comments on commit 744d93b

Please sign in to comment.