Skip to content

Handling non-finite float values #9212

Closed
@urso

Description

@urso

Dealing with floating point values can be somewhat tricky at points. We want to encode events to JSON, plus require values to be indexible in Elasticsearch. This is causing problems when a floating point value is NaN, -Inf, Inf for example. These special values are not included in the JSON standard and also not supported by Elasticsearch.

Normally the JSON encoding will fail and the event is dropped in the output. An error message is logged in this case.

In general modules are discouraged to publish events with NaN or other special values, but sometimes it can't be helped. When normalizing/checking the event we could alternatively remove fields from events or add placeholder values.

Special values are:

  • +Inf
  • -Inf
  • qNaN (quiet Not a Number): normally used for error propagation
  • sNaN (signalling NaN): can be anything... e.g. not available indicator

Fun fact: NaN values can even contain a payload.

Metadata

Metadata

Assignees

No one assigned

    Labels

    StalleddiscussIssue needs further discussion.needs_teamIndicates that the issue/PR needs a Team:* label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions