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

Computing document _id on the fly #133

Merged
merged 9 commits into from
May 17, 2024
Merged

Computing document _id on the fly #133

merged 9 commits into from
May 17, 2024

Conversation

mieciu
Copy link
Member

@mieciu mieciu commented May 16, 2024

We're adding additional field to the index configuration (timestampField), which needs to be DateTime/DateTime64 at the ClickHouse end.
It's not required when you don't want to generate document IDs, but in case you do, that's the way to go.

indexes:
  logs:
    timestampField: "reqTimeSec"
    enabled: true
  siem:
    timestampField: "timestamp"
    enabled: true
  kibana_sample_data_ecommerce:
    timestampField: "@timestamp"
    enabled: true

@mieciu mieciu marked this pull request as ready for review May 17, 2024 11:57
@mieciu mieciu requested a review from a team as a code owner May 17, 2024 11:57
@mieciu mieciu requested review from nablaone, jakozaur, pivovarit, trzysiek and pdelewski and removed request for a team May 17, 2024 11:57
@mieciu mieciu changed the title 🚧 Computing _id on the fly 🚧 Computing document _id on the fly May 17, 2024
if v, ok := cw.Table.Cols[timestampColumnName]; !ok {
switch v.Type.String() {
case clickhouse.DateTime64.String():
statement = fmt.Sprintf("toUnixTimestamp64Milli(%s) IN (%s) ", strconv.Quote(timestampColumnName), ids)
Copy link
Contributor

Choose a reason for hiding this comment

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

Needed to double-check and they indeed called the function *Milli and not *Millis.

jakozaur
jakozaur previously approved these changes May 17, 2024
Copy link
Contributor

@jakozaur jakozaur left a comment

Choose a reason for hiding this comment

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

I have two worries:

  1. Dashboard UI might rely on ids being unique for queries.
  2. We might want to have some format that we internally could recognize. E.g. t[timestamp hex without 0x]h(irrelevant counter).

Though fine to merge as is.

Copy link
Contributor

@jakozaur jakozaur left a comment

Choose a reason for hiding this comment

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

We found one regression it introduce while traversing docs, Przemek is working to fix this.

@jakozaur jakozaur dismissed their stale review May 17, 2024 12:40

We found one regression it introduce while traversing docs, Przemek is working to fix this.

@pivovarit
Copy link
Contributor

What's the scenario?

@jakozaur
Copy link
Contributor

jakozaur commented May 17, 2024

What's the scenario?

Open the log view, click on one document and click the next arrow on the document. If ids clash, it does not work. It also highlights all documents instead of the current one.

@mieciu mieciu changed the title 🚧 Computing document _id on the fly Computing document _id on the fly May 17, 2024
@jakozaur jakozaur enabled auto-merge (squash) May 17, 2024 13:14
@jakozaur jakozaur merged commit 6dddb92 into main May 17, 2024
4 checks passed
@jakozaur jakozaur deleted the compute-doc-id-on-the-fly branch May 17, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants