mysqld_exporter icon indicating copy to clipboard operation
mysqld_exporter copied to clipboard

skip SPACE_TYPE column for MariaDB >=10.5

Open businessbean opened this issue 2 years ago • 6 comments
trafficstars

Hi @SuperQ,

this PR skips the SPACE_TYPE column for MariaDB server instances with version 10.5 or newer.

  • to be able to scrape the information_schema.innodb_sys_tablespaces tables
  • MariaDB has cleaned up the INFORMATION_SCHEMA.INNODB_ tables from version 10.5 on
  • unit tests added
  • fixes
    • https://github.com/prometheus/mysqld_exporter/issues/528
    • https://github.com/prometheus/mysqld_exporter/issues/662

build environment

  • macOS 13.3.1 Intel
  • golang 1.20.2
  • make build

unit test results

go test -timeout 30s -run ^TestScrapeInfoSchemaInnodbTablespaces$ github.com/prometheus/mysqld_exporter/collector
ok  	github.com/prometheus/mysqld_exporter/collector	0.391s

go test -timeout 30s -run ^TestScrapeInfoSchemaInnodbTablespacesWithoutSpaceType$ github.com/prometheus/mysqld_exporter/collector
ok  	github.com/prometheus/mysqld_exporter/collector	0.202s

go test -timeout 30s -run ^TestSemanticVersionCheck$ github.com/prometheus/mysqld_exporter/collector
ok  	github.com/prometheus/mysqld_exporter/collector	0.174s

go test -timeout 30s github.com/prometheus/mysqld_exporter/collector -short
ok  	github.com/prometheus/mysqld_exporter/collector	0.468s

MariaDB test results

10.4.28

# TYPE mysql_info_schema_innodb_tablespace_allocated_size_bytes gauge
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="innodb_temporary"} 1.2582912e+07
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/gtid_slave_pos"} 65536
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/innodb_index_stats"} 65536
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/innodb_table_stats"} 65536
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/transaction_registry"} 114688
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/wsrep_cluster"} 65536
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/wsrep_cluster_members"} 65536
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/wsrep_streaming_log"} 65536
# HELP mysql_info_schema_innodb_tablespace_file_size_bytes The apparent size of the file, which represents the maximum size of the file, uncompressed.
# TYPE mysql_info_schema_innodb_tablespace_file_size_bytes gauge
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="innodb_temporary"} 1.2582912e+07
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/gtid_slave_pos"} 65536
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/innodb_index_stats"} 65536
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/innodb_table_stats"} 65536
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/transaction_registry"} 114688
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/wsrep_cluster"} 65536
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/wsrep_cluster_members"} 65536
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/wsrep_streaming_log"} 65536
# HELP mysql_info_schema_innodb_tablespace_space_info The Tablespace information and Space ID.
# TYPE mysql_info_schema_innodb_tablespace_space_info gauge
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="Dynamic",space_type="Single",tablespace_name="mysql/gtid_slave_pos"} 4
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="Dynamic",space_type="Single",tablespace_name="mysql/innodb_index_stats"} 2
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="Dynamic",space_type="Single",tablespace_name="mysql/innodb_table_stats"} 1
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="Dynamic",space_type="Single",tablespace_name="mysql/transaction_registry"} 3
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="Dynamic",space_type="Single",tablespace_name="mysql/wsrep_cluster"} 5
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="Dynamic",space_type="Single",tablespace_name="mysql/wsrep_cluster_members"} 6
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="Dynamic",space_type="Single",tablespace_name="mysql/wsrep_streaming_log"} 7
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="NONE",space_type="System",tablespace_name="innodb_temporary"} 4.294967294e+09

10.5.18

# TYPE mysql_info_schema_innodb_tablespace_allocated_size_bytes gauge
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="innodb_temporary"} 1.2582912e+07
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/gtid_slave_pos"} 65536
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/innodb_index_stats"} 65536
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/innodb_table_stats"} 65536
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/transaction_registry"} 114688
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/wsrep_cluster"} 65536
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/wsrep_cluster_members"} 65536
mysql_info_schema_innodb_tablespace_allocated_size_bytes{tablespace_name="mysql/wsrep_streaming_log"} 65536
# HELP mysql_info_schema_innodb_tablespace_file_size_bytes The apparent size of the file, which represents the maximum size of the file, uncompressed.
# TYPE mysql_info_schema_innodb_tablespace_file_size_bytes gauge
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="innodb_temporary"} 1.2582912e+07
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/gtid_slave_pos"} 65536
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/innodb_index_stats"} 65536
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/innodb_table_stats"} 65536
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/transaction_registry"} 114688
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/wsrep_cluster"} 65536
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/wsrep_cluster_members"} 65536
mysql_info_schema_innodb_tablespace_file_size_bytes{tablespace_name="mysql/wsrep_streaming_log"} 65536
# HELP mysql_info_schema_innodb_tablespace_space_info The Tablespace information and Space ID.
# TYPE mysql_info_schema_innodb_tablespace_space_info gauge
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="NONE",space_type="",tablespace_name="innodb_temporary"} 4.294967294e+09
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="NONE",space_type="",tablespace_name="mysql/gtid_slave_pos"} 4
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="NONE",space_type="",tablespace_name="mysql/innodb_index_stats"} 2
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="NONE",space_type="",tablespace_name="mysql/innodb_table_stats"} 1
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="NONE",space_type="",tablespace_name="mysql/transaction_registry"} 3
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="NONE",space_type="",tablespace_name="mysql/wsrep_cluster"} 5
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="NONE",space_type="",tablespace_name="mysql/wsrep_cluster_members"} 6
mysql_info_schema_innodb_tablespace_space_info{file_format="NONE",row_format="NONE",space_type="",tablespace_name="mysql/wsrep_streaming_log"} 7

businessbean avatar Apr 15 '23 18:04 businessbean

@businessbean Can I do anything to help get this into main? I'm getting annoyed filtering these logs in our Kibana :smile:

firecow avatar Jul 15 '23 18:07 firecow

@businessbean Can I do anything to help get this into main? I'm getting annoyed filtering these logs in our Kibana 😄

Hi @firecow , you should filter these logs already on Logstash level 😄 I will update the PR today...

businessbean avatar Jul 17 '23 08:07 businessbean

@businessbean Nice, thanks man..

firecow avatar Jul 17 '23 08:07 firecow

is there any chance to merge it? :slightly_smiling_face: or is it waiting for the refactor? can I help with some testing, rebasing or coding? It's not exactly clear to me what blocked the merge :slightly_smiling_face:

Pebin avatar Mar 13 '24 09:03 Pebin

hello @SuperQ are you still working on this repo? It would be useful for us to merge it. I can do some changes if needed. We are currently making custom build for this library because of this

Pebin avatar Jun 06 '24 09:06 Pebin

@SuperQ Yeah, we are running a custom build as well. Is there anything we can do to get this into main somehow?

firecow avatar Jul 02 '24 11:07 firecow

Thanks to @s10 for doing the refactoring!

Sorry for the lack of activity here, I don't have a ton of time to maintain MySQL stuff since I haven't really worked on MySQL databases since 2017.

It would be great if we could get more community involvement here.

SuperQ avatar Aug 12 '24 13:08 SuperQ

Fixed in #860

SuperQ avatar Aug 29 '24 06:08 SuperQ