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
8b632ac0
Unverified
Commit
8b632ac0
authored
Feb 06, 2020
by
Huan Wang
Committed by
GitHub
Feb 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prometheus: Do not show rate hint when increase function is applied (#21955)
parent
89d1ab37
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletions
+14
-1
public/app/plugins/datasource/prometheus/query_hints.test.ts
+13
-0
public/app/plugins/datasource/prometheus/query_hints.ts
+1
-1
No files found.
public/app/plugins/datasource/prometheus/query_hints.test.ts
View file @
8b632ac0
...
...
@@ -75,6 +75,19 @@ describe('getQueryHints()', () => {
expect
(
hints
).
toEqual
(
null
);
});
it
(
'returns no rate hint for a counter metric that already has an increase'
,
()
=>
{
const
series
=
[
{
datapoints
:
[
[
23
,
1000
],
[
24
,
1001
],
],
},
];
const
hints
=
getQueryHints
(
'increase(metric_total[1m])'
,
series
);
expect
(
hints
).
toEqual
(
null
);
});
it
(
'returns a rate hint w/o action for a complex counter metric'
,
()
=>
{
const
series
=
[
{
...
...
public/app/plugins/datasource/prometheus/query_hints.ts
View file @
8b632ac0
...
...
@@ -28,7 +28,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: Promet
}
// Check for need of rate()
if
(
query
.
indexOf
(
'rate('
)
===
-
1
)
{
if
(
query
.
indexOf
(
'rate('
)
===
-
1
&&
query
.
indexOf
(
'increase('
)
===
-
1
)
{
// Use metric metadata for exact types
const
nameMatch
=
query
.
match
(
/
\b(\w
+_
(
total|sum|count
))\b
/
);
let
counterNameMetric
=
nameMatch
?
nameMatch
[
1
]
:
''
;
...
...
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