Conversation
66fbd43 to
5eed458
Compare
6cbfb5d to
b7ec690
Compare
b7ec690 to
5fa2074
Compare
| resolved_path = resolve_lql_path(normalized_key, flat_map) | ||
| updated_lql = append_filter(lql, resolved_path, value, source, list_includes?) | ||
|
|
||
| is_tailing = if key == "timestamp", do: false, else: is_tailing |
There was a problem hiding this comment.
Hmm I'm of the opinion we should use the same tailing behaviour all the time even if it is a timestamp field, since this implies zooming in on historical data
There was a problem hiding this comment.
we should use the same tailing behaviour all the time even if it is a timestamp field
I've removed the special case so tailing will be preserved from the current liveview state.
Is that how you wanted it to work?
There was a problem hiding this comment.
Yea only want to trigger tailing on first view of the search page, other flows don't really make sense for the associated cost.
| end | ||
| end | ||
|
|
||
| defp append_filter(lql, path, value, source, list_includes?) do |
There was a problem hiding this comment.
We can extract the lql manipulation logic to Lql.Rules,not the first time we're doing such rule manipulation
There was a problem hiding this comment.
I switched this to use Rules.upsert_filter_rule_by_path
logflare/lib/logflare/lql/rules.ex
Line 253 in b764c03
This will append the rule if doesn't exist, or replace if it does, which I think is the correct behaviour. I don't think we'd want the quick filter action to create a search with two rules ( m.qty:12 m.qty:11 for example) since that wouldn't return any results.
| rules ++ [filter_rule] | ||
| end | ||
|
|
||
| defp lql_schema(source) do |
There was a problem hiding this comment.
The parent liveview should have this already
| recursively drops the last path segment until it finds an array type. | ||
| """ | ||
| @spec normalize_array_key(String.t(), [String.t()], map()) :: {String.t(), boolean()} | nil | ||
| def normalize_array_key(key, path, flat_map) do |
There was a problem hiding this comment.
From my recollection, stored source schema flatmaps do not store the array index, could you double check the behaviour?
It would only store the inner types and not an individual key per index.
There was a problem hiding this comment.
That's correct, the array index key was coming from the JSON viewer component. I used the array index as a key when rendering arrays.
I've updated the JSON component so it doesn't pass the array index as a key anymore.
This means a little more duplicate in the JSON component, but less logic in QueryComponents.
There was a problem hiding this comment.
I see. There could be edge case bugs where stringified numbers are used for field keys and the walk up will skip that level, could you check 🙏
Walk up logic is fine to keep though
There was a problem hiding this comment.
There could be edge case bugs where stringified numbers are used for field keys
It's a good point. I thought I'd handled that but it didn't work if the numeric key was in the middle of the field (metadata.0.info).
I'm sticking with passing the full path through from the view component. This should match the field name used in the schema flat map.
There was a problem hiding this comment.
Added test coverage, too.
|
Styling wise:
|
a27bb45 to
0db6b6b
Compare
9e78591 to
219bdc9
Compare
Adds a quick filter button the event viewer.
FilterRuleto the LQL query string of the current search.timestampfield the search will be +/- 1 of the current chart duration (eg. +1 hour and -1 hour).The quick filter button is implemented as slot passed to the JSON view component. We could easily add more actions to the UI (even user configurable ones).
Todo
extract the lql manipulation logic to Lql.RulesDemo
CleanShot.2026-02-04.at.15.32.10.mp4