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
1a5e7864
Commit
1a5e7864
authored
Sep 12, 2017
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
56c0d91e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
public/app/plugins/datasource/prometheus/completer.ts
+5
-5
public/app/plugins/datasource/prometheus/mode-prometheus.js
+3
-3
No files found.
public/app/plugins/datasource/prometheus/completer.ts
View file @
1a5e7864
...
...
@@ -21,7 +21,7 @@ export class PromCompleter {
var
metricName
;
switch
(
token
.
type
)
{
case
'
keyword
'
:
case
'
entity.name.tag
'
:
metricName
=
this
.
findMetricName
(
session
,
pos
.
row
,
pos
.
column
);
if
(
!
metricName
)
{
callback
(
null
,
this
.
transformToCompletions
([
'__name__'
,
'instance'
,
'job'
],
'label name'
));
...
...
@@ -43,14 +43,14 @@ export class PromCompleter {
callback
(
null
,
labelNames
);
});
return
;
case
'string'
:
case
'string
.quoted
'
:
metricName
=
this
.
findMetricName
(
session
,
pos
.
row
,
pos
.
column
);
if
(
!
metricName
)
{
callback
(
null
,
[]);
return
;
}
var
labelNameToken
=
this
.
findToken
(
session
,
pos
.
row
,
pos
.
column
,
'
keyword
'
,
null
,
'paren.lparen'
);
var
labelNameToken
=
this
.
findToken
(
session
,
pos
.
row
,
pos
.
column
,
'
entity.name.tag
'
,
null
,
'paren.lparen'
);
if
(
!
labelNameToken
)
{
callback
(
null
,
[]);
return
;
...
...
@@ -135,11 +135,11 @@ export class PromCompleter {
var
metricName
=
''
;
var
tokens
;
var
nameLabelNameToken
=
this
.
findToken
(
session
,
row
,
column
,
'
keyword
'
,
'__name__'
,
'paren.lparen'
);
var
nameLabelNameToken
=
this
.
findToken
(
session
,
row
,
column
,
'
entity.name.tag
'
,
'__name__'
,
'paren.lparen'
);
if
(
nameLabelNameToken
)
{
tokens
=
session
.
getTokens
(
nameLabelNameToken
.
row
);
var
nameLabelValueToken
=
tokens
[
nameLabelNameToken
.
index
+
2
];
if
(
nameLabelValueToken
&&
nameLabelValueToken
.
type
===
'string'
)
{
if
(
nameLabelValueToken
&&
nameLabelValueToken
.
type
===
'string
.quoted
'
)
{
metricName
=
nameLabelValueToken
.
value
.
slice
(
1
,
-
1
);
// cut begin/end quotation
}
}
else
{
...
...
public/app/plugins/datasource/prometheus/mode-prometheus.js
View file @
1a5e7864
...
...
@@ -65,13 +65,13 @@ var PrometheusHighlightRules = function() {
regex
:
"
\\
s+"
}
],
"start-label-matcher"
:
[
{
token
:
"
keyword
"
,
token
:
"
entity.name.tag
"
,
regex
:
'[a-zA-Z_][a-zA-Z0-9_]*'
},
{
token
:
"keyword.operator"
,
regex
:
'=~|=|!~|!='
},
{
token
:
"string"
,
token
:
"string
.quoted
"
,
regex
:
'"[^"]*"|
\'
[^
\'
]*
\'
'
},
{
token
:
"punctuation.operator"
,
...
...
@@ -401,7 +401,7 @@ var PrometheusCompletions = function() {};
(
function
()
{
this
.
getCompletions
=
function
(
state
,
session
,
pos
,
prefix
,
callback
)
{
var
token
=
session
.
getTokenAt
(
pos
.
row
,
pos
.
column
);
if
(
token
.
type
===
'
label.name'
||
token
.
type
===
'label.value
'
)
{
if
(
token
.
type
===
'
entity.name.tag'
||
token
.
type
===
'string.quoted
'
)
{
return
callback
(
null
,
[]);
}
...
...
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