open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
2.94k stars 2.29k forks source link

GoogleCloudSpannerReceiver: Error scrapping metrics for TABLE_SIZES_STATS_1HOUR "failed to decode column 2, type *int64 cannot be used for decoding FLOAT64" #21499

Closed varunraiko closed 1 year ago

varunraiko commented 1 year ago

Component(s)

receiver/googlecloudspanner

What happened?

Description

For TABLE_SIZES_STATS_1HOUR the bytes used type was added as int instead of FLOAT64. This is leading to the error when we run the googlecloudspannereceiver.

 \"SELECT * FROM SPANNER_SYS.TABLE_SIZES_STATS_1HOUR WHERE INTERVAL_END = @pullTimestamp ORDER BY INTERVAL_END DESC, USED_BYTES DESC LIMIT @topMetricsQueryMaxRows\" failed with error: error occurred during extracting metric values row: spanner: code = \"InvalidArgument\", desc = \"failed to decode column 2, type *int64 cannot be used for decoding FLOAT64

Steps to Reproduce

Run the receiver via the example configuration , that can be found here https://github.com/varunraiko/example-cloudspannerreceiver

Expected Result

Actual Result

Collector version

0.76.3

Environment information

Environment

OS: (e.g., "Ubuntu 20.04") Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

No response

Log output

2023-05-04T22:25:44.884Z    error     scraperhelper/scrapercontroller.go:212   Error scraping metrics  {"kind": "receiver", "name": "googlecloudspanner", "data_type": "metrics", "error": "cannot read data for data points databaseReader \"hourly table size stats prj-np-dap-vtos-0018792-da19::vtos-v1::db1\" because of an error: query \"SELECT * FROM SPANNER_SYS.TABLE_SIZES_STATS_1HOUR WHERE INTERVAL_END = @pullTimestamp ORDER BY INTERVAL_END DESC, USED_BYTES DESC LIMIT @topMetricsQueryMaxRows\" failed with error: error occurred during extracting metric values row: spanner: code = \"InvalidArgument\", desc = \"failed to decode column 2, type *int64 cannot be used for decoding FLOAT64\"", "scraper": "googlecloudspanner"}

Additional context

The type for UsedBytes is FLOAT64 instead of INT, so the configuration of the receiver needs to change to accept the type as FLOAT64. Documentation: https://cloud.google.com/spanner/docs/introspection/table-sizes-statistics

github-actions[bot] commented 1 year ago

Pinging code owners for receiver/googlecloudspanner: @architjugran @varunraiko @kiranmayib. See Adding Labels via Comments if you do not have permissions to add labels yourself.