Skip to content

Snowflake receiver: conversion error for 'bytesInserted' trying to convert float64 to int64 #40418

@atoulme

Description

@atoulme

Component(s)

No response

What happened?

In snowflake receiver, for one of the snowflake pipe metric

we have the data type defined as int https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/snowflakereceiver/model.go#L89

but in reality when parsing the SQL query https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/snowflakereceiver/client.go#L24 and scanning the related column value sum(bytes_inserted) the receiver gets float value but expects int and hence the error.

May 19 13:05:16 MEIPLAP01089 otelcol[1304954]: 2025-05-19T13:05:16.188+0200        error        [email protected]/obs_metrics.go:61        Error scraping metrics        {"otelcol.component.id": "snowflake/azure_ci_prod_xs", "otelcol.component.kind": "receiver", "otelcol.signal": "metrics", "error": "sql: Scan error on column index 2, name \"SUM(BYTES_INSERTED)\": converting driver.Value type float64 (\"4.8225792e+08\") to a int64: invalid syntax"}
We might have to make additional checks for any other such metrics where expect int but actually get float.

Another underlying issue:

Just the presence of snowflake receiver will throw this error because it seems the receiver issues query and parses all metrics whether or not that metric is enabled. It is only after the scanning and parsing of the metrics, metric is checked whether it is enabled or not and if not enabled it is not added to the list of datapoints to be sent.

Steps to reproduce:

  1. snowflake receiver

Expected:
No scan error when trying to parse snowflake metrics

Actual:

"error": "sql: Scan error on column index 2, name \"SUM(BYTES_INSERTED)\": converting driver.Value type float64 (\"4.8225792e+08\") to a int64: invalid syntax"

Collector version

0.126.0

Environment information

Environment

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

OpenTelemetry Collector configuration

Log output

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions