Skip to content

Commit

Permalink
strip from logs-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
v-zhuravlev committed Dec 11, 2024
1 parent d5342a7 commit 2a1ed75
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions logs-lib/logs/variables.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ function(
labels,
)
{
// strip trailing or starting comma if present that are not accepted in LoqQL
// starting comma can be present in case of concatenation of empty filteringSelector with some extra selectors.
local _filteringSelector = std.stripChars(std.stripChars(filterSelector, ' '), ','),
local this = self,
local variablesFromLabels(labels, filterSelector) =
local chainVarProto(chainVar) =
Expand All @@ -34,7 +37,7 @@ function(
;
[
chainVarProto(chainVar)
for chainVar in utils.chainLabels(labels, [filterSelector])
for chainVar in utils.chainLabels(labels, [_filteringSelector])
],

datasource:
Expand All @@ -48,14 +51,14 @@ function(

toArray:
[self.datasource]
+ variablesFromLabels(labels, filterSelector)
+ variablesFromLabels(labels, _filteringSelector)
+ [self.regex_search],

queriesSelector:
std.join(
',',
std.filter(function(x) std.length(x) > 0, [
filterSelector,
_filteringSelector,
utils.labelsToPromQLSelector(labels),
])
),
Expand Down

0 comments on commit 2a1ed75

Please sign in to comment.