Closed tkoeppen closed 1 week ago
Pinging code owners:
receiver/mysql: @djaglowski
See Adding Labels via Comments if you do not have permissions to add labels yourself.
an updated query could fix this and convert null to 0 (or handle it afterwords in go)
SELECT TABLE_SCHEMA, TABLE_NAME,
COALESCE(TABLE_ROWS, 0) AS TABLE_ROWS, COALESCE(AVG_ROW_LENGTH, 0) AS AVG_ROW_LENGTH,
COALESCE(DATA_LENGTH, 0) AS DATA_LENGTH, COALESCE(INDEX_LENGTH, 0) AS INDEX_LENGTH
FROM information_schema.TABLES
WHERE TABLE_SCHEMA NOT in ('information_schema', 'sys');
I want to take a look into it, please assign to me.
can we change the client.go like this
option1:
change the SQS query
option 2:
handle it in the code
Thanks for reporting this.
@knarfli, I'll assign it to you. My inclination would be to handle it in the query but I don't feel strongly about it.
Thanks @djaglowski . Yes, I like to handle it in query too. As the client is only for mysql/mariadb, we needn't worry about the DB dependency and reuse of the SQL query. Handling in DB make the code clean and simple.
I have a .104 installation with the same issue and the error for MariaDB instances, since .104 was installed.
Closed by #34411
Component(s)
receiver/mysql
What happened?
Background
With version 0.101.0 a new feature "add table metrics" was introduced (#32680):
https://github.com/open-telemetry/opentelemetry-collector-contrib/commit/7ddb3507bed5af47dcee7393651e4c52694ac467
We were also affected by a reported bug (#33271) and reverted to version 0.100.0. This bug was fixed with version 0.104.0 by removing the order by clause (to fix unknown column TABLE_LENGTH) (#33283)
Error description
We now tried out the new 0.104.0 version and found, that with mariabdb we get the following error:
In mariadb (current release 11.4.2, LTS until 05/2029) it can happen, that TABLES_ROWS column is null instead of 0. We found that mysql.user table in information_schema has "NULL" TABLE_ROWS.
This is causing the "converting NULL to int64 is unsupported" in mysqlreceiver@v0.104.0/scraper.go:421.
Expected Result
Even if this is a bug upstream (to have null TABLE_ROWS instead of 0 in MariaDB information_schema table), the situation may exist with MariaDB, and the mysqlconnector should handle null values to prevent null to int64 conversion in go.
Collector version
v0.104.0
Environment information
docker or k8s
OpenTelemetry Collector configuration
No response