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
38c1d450
Unverified
Commit
38c1d450
authored
Jan 22, 2021
by
Zoltán Bedi
Committed by
GitHub
Jan 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prometheus: Fix show query instead of Value if no __name__ and metric (#30511)
Fixes #29466
parent
6bdc9fac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletions
+31
-1
public/app/plugins/datasource/prometheus/result_transformer.test.ts
+26
-0
public/app/plugins/datasource/prometheus/result_transformer.ts
+5
-1
No files found.
public/app/plugins/datasource/prometheus/result_transformer.test.ts
View file @
38c1d450
...
...
@@ -353,6 +353,32 @@ describe('Prometheus Result Transformer', () => {
expect
(
result
[
0
].
name
).
toEqual
(
'test{job="testjob"}'
);
});
it
(
'should use query as series name when __name__ is not available and metric is empty'
,
()
=>
{
const
response
=
{
status
:
'success'
,
data
:
{
resultType
:
'matrix'
,
result
:
[
{
metric
:
{},
values
:
[[
0
,
'10'
]],
},
],
},
};
const
expr
=
'histogram_quantile(0.95, sum(rate(tns_request_duration_seconds_bucket[5m])) by (le))'
;
const
result
=
transform
({
data
:
response
}
as
any
,
{
...
options
,
query
:
{
step
:
1
,
start
:
0
,
end
:
2
,
expr
,
},
});
expect
(
result
[
0
].
name
).
toEqual
(
expr
);
});
it
(
'should set frame name to undefined if no __name__ label but there are other labels'
,
()
=>
{
const
response
=
{
status
:
'success'
,
...
...
public/app/plugins/datasource/prometheus/result_transformer.ts
View file @
38c1d450
...
...
@@ -383,7 +383,11 @@ function createLabelInfo(labels: { [key: string]: string }, options: TransformOp
const { __name__, ...labelsWithoutName } = labels;
const labelPart = formatLabels(labelsWithoutName);
const title = `
$
{
__name__
??
''
}
$
{
labelPart
}
`;
let title = `
$
{
__name__
??
''
}
$
{
labelPart
}
`;
if (!title) {
title = options.query;
}
return { name: title, labels: labelsWithoutName };
}
...
...
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