Skip to content

[Metricbeat] SQL module converts NULL cells to strings #18898

@sayden

Description

@sayden

How to reproduce: Using the following query, it generates a VARCHAR | NULL result

- module: sql
  metricsets:
    - query
  period: 10s
#  hosts: ["dbname=ps user=root pass=root host=172.18.0.2"]
  hosts: ["root:root@tcp(172.18.0.2:3306)/ps"]

  driver: "mysql"
  sql_query: "SELECT 'key', NULL"
  sql_response_format: variables

- module: sql
  metricsets:
    - query
  period: 10s
  #  hosts: ["dbname=ps user=root pass=root host=172.18.0.2"]
  hosts: ["root:root@tcp(172.18.0.2:3306)/ps"]

  driver: "mysql"
  sql_query: "SELECT 'key', NULL"
  sql_response_format: table

Expected output:

{
  "sql": {
    "query": "SELECT 'key', NULL",
    "metrics": {
      "numeric": {},
      "string": {
        "key": "NULL"
      }
    },
    "driver": "mysql"
  }
}
{
  "sql": {
    "query": "SELECT 'null', NULL",
    "metrics": {
      "numeric": {},
      "string": {
        "key": "NULL"
      }
    },
    "driver": "mysql"
  }
}

Expected output:

{
  "sql": {
    "query": "SELECT 'key', NULL",
    "metrics": {
      "numeric": {},
      "string": {
        "key": null
      }
    },
    "driver": "mysql"
  },
  "event": {
    "dataset": "sql.query",
    "module": "sql",
    "duration": 603087
  }
}
{
  "sql": {
    "query": "SELECT 'key', NULL",
    "metrics": {
      "numeric": {},
      "string": {
        "key": null
      }
    },
    "driver": "mysql"
  },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    MetricbeatMetricbeatTeam:Services(Deprecated) Label for the former Integrations-Services teambug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions