Closed
Description
The Lightweight modules executes the WithHostParser
twice. This is currently creating a bug when using a custom host parser like the DSN parsers that you can use in MySQL.
How to reproduce
- Add a custom host parser to the MySQL module,
query
metricset https://github.com/elastic/beats/blob/master/metricbeat/module/mysql/query/query.go#L39 that uses the HostParser defined here https://github.com/elastic/beats/blob/master/metricbeat/module/mysql/mysql.go#L56 - Activate performance metricset and execute and configure the host, for example with
root:root@tcp(127.0.0.1:3306)/
. - Fails with:
Exiting: 1 error: host parser failed on light metricset factory for 'mysql/performance': error parsing mysql host: default addr for network 'root:/' unknown
What is happening is that it gets the config data from mysql.yml
creates the uri and parses it. Then it mutates incoming config with the output of the parser. Finally, the parser is executed again with the mutated data and it fails.
Failling block is probably this one https://github.com/elastic/beats/blob/master/metricbeat/mb/lightmetricset.go#L86
It seems that the solution would be to avoid the second execution of the host parser.