Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch: Fix processing of raw_data with not-recognized time format #78262

Merged
merged 3 commits into from
Nov 20, 2023

Conversation

ivanahuckova
Copy link
Member

@ivanahuckova ivanahuckova commented Nov 16, 2023

This is pretty much the same as #67767 where we fixed processing of logs queries with not-recognized time format. At that time, I did not realized that this is going to be an issue for raw_data queries as well. Therefore in this PR, we are fixing processing of unrecognized time formats for raw_data queries. For raw_document queries this is not needed as we are not parsing time field.

More detailed information:
This is a bug fix for processing time field in ES on backend, when time field uses format that golang does not recognize (e.g. MM/DD/YYY, unix timestamp with nanoseconds decimal point, ...). To fix this for raw_data queries, we are using fields to get time field in strict_date_optional_time_nanos format that is recognizable by golang and also supports nanosecond precision.

To test this:

  1. Run make devenv sources=elastic
  2. Make sure that enableElasticsearchBackendQuerying is set to true
  3. Create a new elastic data source pointing to https://localhost:9200 and for time field add @timestamp_custom.
  4. Run raw_data query - you should not see null values in time column
  5. You can also switch to @timestamp, @timestamp_unix, @timestamp_nanos to ensure all formats work as expected.

Fixed:

image

Current main (broken):

image

Fixes: #77114

Copy link
Contributor

@matyax matyax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivanahuckova ivanahuckova merged commit 28f4c3e into main Nov 20, 2023
14 checks passed
@ivanahuckova ivanahuckova deleted the ivana/elastic-fix-raw-data-timestamp branch November 20, 2023 11:01
grafana-delivery-bot bot pushed a commit that referenced this pull request Nov 20, 2023
…rmat (#78262)

* Elasticsearch: Fix non-standard time field in raw data queries

* Update snapshot tests

* Refactor

(cherry picked from commit 28f4c3e)
ivanahuckova added a commit that referenced this pull request Nov 20, 2023
…ed time format (#78380)

Elasticsearch: Fix processing of raw_data with not-recognized time format (#78262)

* Elasticsearch: Fix non-standard time field in raw data queries

* Update snapshot tests

* Refactor

(cherry picked from commit 28f4c3e)

Co-authored-by: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com>
@aangelisc aangelisc modified the milestones: 10.3.x, 10.2.3 Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10.2.0 - No Elasticsearch Logs / Empty @timestamp
3 participants