-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add UNIX domain socket support for multi-target scraping #707
Conversation
eaec7cf
to
5d4f5f6
Compare
Looks like there's a merge conflict. |
5d4f5f6
to
bf70e5b
Compare
bf70e5b
to
6f45888
Compare
@SuperQ Resolved |
According to Go MySQL Driver documentation, UNIX domain socket is the absolute path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@soara Thanks for the suggestion. Despite your suggestion, it seems the UNIX domain socket path is not necessary to be absolute. The driver uses the standard Therefore checking whether the target value contains a slash (or starts with a slash) does not always distinguish the network. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this handle the network with unix://
prefixing.
6f45888
to
c1b23d1
Compare
Signed-off-by: Kohei YOSHIDA <kohei@yosida95.com>
c1b23d1
to
0c4f492
Compare
@SuperQ Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, super easy!
* [CHANGE] Allow `tlsCfg.InsecureSkipVerify` outside of mTLS #631 * [CHANGE] Update to exporter-toolkit v0.8.1 #677 * [CHANGE] Fix shared metrics between requests #722 * [FEATURE] Add support for collecting metrics from `sys.user_summary` #628 * [FEATURE] Support for multi-target mysqld probes #651 * [FEATURE] Add MySQL TLS configurations #718 * [ENHANCEMENT] Add UNIX domain socket support for multi-target scraping #707 * [BUGFIX] Fix `infoSchemaInnodbMetricsEnabledColumnQuery` #687 * [BUGFIX] Allow empty passwords #742 Signed-off-by: SuperQ <superq@gmail.com>
* [CHANGE] Allow `tlsCfg.InsecureSkipVerify` outside of mTLS #631 * [CHANGE] Update to exporter-toolkit v0.8.1 #677 * [CHANGE] Fix shared metrics between requests #722 * [FEATURE] Add support for collecting metrics from `sys.user_summary` #628 * [FEATURE] Support for multi-target mysqld probes #651 * [FEATURE] Add MySQL TLS configurations #718 * [ENHANCEMENT] Add UNIX domain socket support for multi-target scraping #707 * [BUGFIX] Fix `infoSchemaInnodbMetricsEnabledColumnQuery` #687 * [BUGFIX] Allow empty passwords #742 Signed-off-by: SuperQ <superq@gmail.com>
BREAKING CHANGES: The exporter no longer supports the monolithic `DATA_SOURCE_NAME` environment variable. To configure connections to MySQL you can either use a `my.cnf` style config file or command line arguments. For example: export MYSQLD_EXPORTER_PASSWORD=secret mysqld_exporter --mysqld.address=localhost:3306 --mysqld.username=exporter We have also dropped some internal scrape metrics: - `mysql_exporter_scrapes_total` - `mysql_exporter_scrape_errors_total` - `mysql_last_scrape_failed` The default client configuration file is now `.my.cnf` in the process working directory. Use `--config.my-cnf="$HOME/.my.cnf"` to retain the previous default. Changes: * [CHANGE] Allow `tlsCfg.InsecureSkipVerify` outside of mTLS #631 * [CHANGE] Update to exporter-toolkit v0.8.1 #677 * [CHANGE] Fix shared metrics between requests #722 * [CHANGE] Allow empty passwords #742 * [CHANGE] Don't use HOME env in the my-cnf config path. #745 * [FEATURE] Add support for collecting metrics from `sys.user_summary` #628 * [FEATURE] Support for multi-target mysqld probes #651 * [FEATURE] Add MySQL TLS configurations #718 * [FEATURE] Add config reload via /-/reload #734 * [ENHANCEMENT] Add UNIX domain socket support for multi-target scraping #707 * [ENHANCEMENT] Use `STRAIGHT_JOIN` in infoSchemaAutoIncrementQuery #726 * [BUGFIX] Fix `infoSchemaInnodbMetricsEnabledColumnQuery` #687 * [BUGFIX] Allow empty passwords #742 Signed-off-by: SuperQ <superq@gmail.com>
BREAKING CHANGES: The exporter no longer supports the monolithic `DATA_SOURCE_NAME` environment variable. To configure connections to MySQL you can either use a `my.cnf` style config file or command line arguments. For example: export MYSQLD_EXPORTER_PASSWORD=secret mysqld_exporter --mysqld.address=localhost:3306 --mysqld.username=exporter We have also dropped some internal scrape metrics: - `mysql_exporter_scrapes_total` - `mysql_exporter_scrape_errors_total` - `mysql_last_scrape_failed` The default client configuration file is now `.my.cnf` in the process working directory. Use `--config.my-cnf="$HOME/.my.cnf"` to retain the previous default. Changes: * [CHANGE] Allow `tlsCfg.InsecureSkipVerify` outside of mTLS #631 * [CHANGE] Update to exporter-toolkit v0.8.1 #677 * [CHANGE] Fix shared metrics between requests #722 * [CHANGE] Allow empty passwords #742 * [CHANGE] Don't use HOME env in the my-cnf config path. #745 * [FEATURE] Add support for collecting metrics from `sys.user_summary` #628 * [FEATURE] Support for multi-target mysqld probes #651 * [FEATURE] Add MySQL TLS configurations #718 * [FEATURE] Add config reload via /-/reload #734 * [ENHANCEMENT] Add UNIX domain socket support for multi-target scraping #707 * [ENHANCEMENT] Use `STRAIGHT_JOIN` in infoSchemaAutoIncrementQuery #726 * [BUGFIX] Fix `infoSchemaInnodbMetricsEnabledColumnQuery` #687 * [BUGFIX] Allow empty passwords #742 Signed-off-by: SuperQ <superq@gmail.com>
This pull request expands the multi-target scraping ability introduced by #504 and #651 to UNIX domain sockets.
If the
target
query starts withunix://
, connect to the server using UNIX domain socket. Otherwise, use TCP.This PR adds a new query parameternetwork
to specify the network type either "tcp" or "unix". If no value is set, it defaults to "tcp".Support for multiple UNIX domain sockets is useful if, for example, mysqld_exporter runs on Cloud Run configured with multiple Cloud SQL connections. Cloud Run mounts multiple UNIX domain sockets on the
/cloudsql
directory. https://cloud.google.com/sql/docs/mysql/connect-run?hl=en#connect_to(Fixed in #714)
By the way, I found that the/probe
endpoint emits error messages to the client along with metrics in some error conditions. I don't know if Prometheus can handle it correctly, but at least prom2json couldn't handle it.mysqld_exporter/probe.go
Lines 45 to 54 in 593b009
In the same condition, the/metrics
endpoint doesn't emit error messages.mysqld_exporter/mysqld_exporter.go
Lines 140 to 147 in 593b009
Is that OK or should be patched to emit only either error messages or metrics? I'd like to send a PR as needed.