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
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.
Related issues
#16205
The Lightweight modules executes the
WithHostParsertwice. 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
querymetricset 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#L56root:root@tcp(127.0.0.1:3306)/.What is happening is that it gets the config data from
mysql.ymlcreates 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.
Related issues
#16205