Skip to content

Commit

Permalink
Merge pull request #1848 from Logflare/fix/metadata-level-chart-case-…
Browse files Browse the repository at this point in the history
…sensitivity

fix: case sensitivity for generated chart queries
  • Loading branch information
Ziinc authored Nov 23, 2023
2 parents 8735306 + 5b6a1ae commit 30b98e8
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions lib/logflare/logs/search/logs_search_queries.ex
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ defmodule Logflare.Logs.SearchQueries do
|> select_merge([..., t], %{
other:
fragment(
"COUNTIF(? NOT IN UNNEST(?) OR ? IS NULL) as other",
"COUNTIF(LOWER(?) NOT IN UNNEST(?) OR ? IS NULL) as other",
t.level,
[
"debug",
Expand All @@ -206,16 +206,22 @@ defmodule Logflare.Logs.SearchQueries do
],
t.level
),
level_notice: fragment("COUNTIF(? = ?) as level_notice", t.level, "notice"),
level_critical: fragment("COUNTIF(? = ?) as level_critical", t.level, "critical"),
level_alert: fragment("COUNTIF(? = ?) as level_alert", t.level, "alert"),
level_emergency: fragment("COUNTIF(? = ?) as level_emergency", t.level, "emergency"),
level_debug: fragment("COUNTIF(? = ?) as level_debug", t.level, "debug"),
level_info: fragment("COUNTIF(? = ?) as level_info", t.level, "info"),
level_notice: fragment("COUNTIF(lower(?) = ?) as level_notice", t.level, "notice"),
level_critical: fragment("COUNTIF(lower(?) = ?) as level_critical", t.level, "critical"),
level_alert: fragment("COUNTIF(lower(?) = ?) as level_alert", t.level, "alert"),
level_emergency: fragment("COUNTIF(lower(?) = ?) as level_emergency", t.level, "emergency"),
level_debug: fragment("COUNTIF(lower(?) = ?) as level_debug", t.level, "debug"),
level_info: fragment("COUNTIF(lower(?) = ?) as level_info", t.level, "info"),
# FIXME
level_warn:
fragment("COUNTIF(? = ? OR ? = ?) as level_warn", t.level, "warn", t.level, "warning"),
level_error: fragment("COUNTIF(? = ?) as level_error", t.level, "error")
fragment(
"COUNTIF(lower(?) = ? OR lower(?) = ?) as level_warn",
t.level,
"warn",
t.level,
"warning"
),
level_error: fragment("COUNTIF(lower(?) = ?) as level_error", t.level, "error")
})
|> select_merge_total()
end
Expand Down

0 comments on commit 30b98e8

Please sign in to comment.