How to disable binlog related metrics

Hi team, we are using pmm-2.x for our online mysql database. We found that pmm was keeping on calling “SHOW BINARY LOGS” in our database. Since the binlog files are really huge and this SQL may affect the whole database’s performance, we now want to disable all the statistics related to binlog. We have tried to use --disable-collectors=‘binlog_size’ label mentioned in the doc, but it seems the “SHOW BINARY LOGS” is still being called after using the label. We are wondering if there is anyway we could block “SHOW BINARY LOGS” from being called entirely? Really appreciate your help!!!

Hey Kecheng,

To disable binlog files metrics you need to use:
–disable-collectors=“binlog_size”

It should not really affect performance, you can check actual collection time with
mysql_exporter_collector_duration_seconds{collector=“collect.binlog_size”}

I checked implementation, it first checks if this feature is enabled by execution “SELECT @@log_bin”.
If it is enabled it query file sizes with “SHOW BINARY LOGS”.

There will be one record per file, so file size must not affect collection time nor negatively DB performance.

Please let me know if that helps.

Regards,
Alexey

1 Like

so it’s double quotes vs single quotes (since that’s the only difference I can see between what @kechang put vs your findings)?

1 Like

It should work the same with single, double and no quotes (because we have not spaces).
e.g. --disable-collectors=‘binlog_size’ is the same as --disable-collectors=“binlog_size” and --disable-collectors=binlog_size

It will only fail with backticks:

./pmm-admin add mysql --username=root --password=root --port=3308 --disable-collectors=binlog_size myrocks3
zsh: command not found: binlog_size
MySQL Service added.
Service ID : /service_id/d4046ffd-ed7c-4c12-bb2f-cbaddbc2c3ff
Service name: myrocks3

in this case (with backticks) binlog_size will be enabled

1 Like