Skip to content

Improve Logflare.Mapper to support flat structures better#3323

Open
amokan wants to merge 3 commits intomainfrom
adammokan/o11y-1607-use-logeventflattened_body-attribute-to-simplify-ch-simple
Open

Improve Logflare.Mapper to support flat structures better#3323
amokan wants to merge 3 commits intomainfrom
adammokan/o11y-1607-use-logeventflattened_body-attribute-to-simplify-ch-simple

Conversation

@amokan
Copy link
Copy Markdown
Contributor

@amokan amokan commented Mar 31, 2026

This PR adds a new option to Logflare.Mapper.map/3 to provide a keyword of flat_keys: true as a last argument that avoids extra work in the Rust layer now that we have the LogEvent.flattened_body available.

This also changes the actual ClickHouse pipeline to leverage the new feature.

Benchmarking shows a small increase in IPS and a drop in reductions with these changes.


This change is based on #3322 and will be rebased after that is merged

@amokan amokan force-pushed the adammokan/o11y-1607-use-logeventflattened_body-attribute-to-simplify-ch-simple branch from 503da75 to 95dda7e Compare March 31, 2026 00:32
@amokan amokan requested review from Ziinc and chasers March 31, 2026 00:33
Copy link
Copy Markdown
Contributor

@Ziinc Ziinc left a comment

Choose a reason for hiding this comment

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

lacking test coverage for new logic, adding some property tests on the elixir side would be good.

///
/// Returns the mapped Elixir map directly (no ok/error tuple).
///
/// When `flat_keys` is `true`, dotted JSONPaths like `$.resource.service.name`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LogEvent.flattened_body stores JSONPaths as keys? or is the initial prefix ignored? should decide which to support, would get configusing down the road, especially if we also consider schema flat_map .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LogEvent.flatten_body doesn't store it as JSONPaths so this might be wrong...

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.

2 participants