Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
ad337344
Unverified
Commit
ad337344
authored
Aug 10, 2020
by
Ivana Huckova
Committed by
GitHub
Aug 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prometheus: Correctly format multi values variables in queries (#26896)
parent
0a40862a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
public/app/plugins/datasource/prometheus/datasource.test.ts
+2
-2
public/app/plugins/datasource/prometheus/datasource.ts
+1
-1
No files found.
public/app/plugins/datasource/prometheus/datasource.test.ts
View file @
ad337344
...
...
@@ -500,7 +500,7 @@ describe('PrometheusDatasource', () => {
});
it('
should
return
pipe
separated
values
if
the
value
is
an
array
of
strings
', () => {
expect(ds.interpolateQueryExpr(['
a
|
bc
', '
de
|
f
'], customVariable)).toEqual('
a
\\\\
|
bc
|
de
\\\\
|
f
');
expect(ds.interpolateQueryExpr(['
a
|
bc
', '
de
|
f
'], customVariable)).toEqual('
(
a
\\\\
|
bc
|
de
\\\\
|
f
)
');
});
});
...
...
@@ -514,7 +514,7 @@ describe('PrometheusDatasource', () => {
});
it('
should
return
pipe
separated
values
if
the
value
is
an
array
of
strings
', () => {
expect(ds.interpolateQueryExpr(['
a
|
bc
', '
de
|
f
'], customVariable)).toEqual('
a
\\\\
|
bc
|
de
\\\\
|
f
');
expect(ds.interpolateQueryExpr(['
a
|
bc
', '
de
|
f
'], customVariable)).toEqual('
(
a
\\\\
|
bc
|
de
\\\\
|
f
)
');
});
});
});
...
...
public/app/plugins/datasource/prometheus/datasource.ts
View file @
ad337344
...
...
@@ -159,7 +159,7 @@ export class PrometheusDatasource extends DataSourceApi<PromQuery, PromOptions>
}
const
escapedValues
=
value
.
map
(
val
=>
prometheusSpecialRegexEscape
(
val
));
return
escapedValues
.
join
(
'|'
)
;
return
'('
+
escapedValues
.
join
(
'|'
)
+
')'
;
}
targetContainsTemplate
(
target
:
PromQuery
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment