Skip to content

fix[receiver/sqlquery] Null values result in a hard error instead of a warning. #43984

@mrsillydog

Description

@mrsillydog

Component(s)

receiver/sqlquery

What happened?

Description

When utilizing the SQL Query Receiver to collect logs, any null value in a row results in no rows being collected. This is contrary to the documentation here, which seems to indicate that while all rows that contain null values should result in a warning log, one row having a null value should not result in all rows being dropped and an error.

Steps to Reproduce

Use the SQL query receiver to query from a database table with at least one NULL value.

Image

Expected Result

All rows should be collected, any NULL data should be ignored. A warning log should be emitted to indicate missing data to the user.

Actual Result

No logs are returned and an error such as error getting rows: column "TestMe": NULL value is returned.

Collector version

v0.138.0

Environment information

Environment

OS: Microsoft Windows Server 2019
MSSQL Server

OpenTelemetry Collector configuration

Here is the relevant receiver configuration.

    sqlquery/s-01JV3219M36D7NT5THYRSD12EF__logs:
        additional_params: {}
        collection_interval: 10s
        database: AdventureWorks2022
        driver: sqlserver
        host: bp-qa-ub-wintoo
        password: (sensitive)
        port: 1433
        queries:
            - logs:
                - body_column: GroupName
              sql: USE AdventureWorks2022; select * from HumanResources.Department where ModifiedDate > @p1
              tracking_column: ModifiedDate
              tracking_start_value: 2008-04-30 00:00:00:000
        telemetry:
            logs:
                query: true
        username: test

Log output

Additional context

This should be a small fix, the error is handled well in the internal/sqlquery package - it just needs to be similarly handled well in the receiver/sqlqueryreceiver package.

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions