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
2e665fba
Commit
2e665fba
authored
Oct 02, 2018
by
Erik Sundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stackdriver: remove not necessary helper functions
parent
4d8f594d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
19 deletions
+5
-19
pkg/tsdb/stackdriver/stackdriver.go
+5
-19
No files found.
pkg/tsdb/stackdriver/stackdriver.go
View file @
2e665fba
...
...
@@ -169,23 +169,6 @@ func reverse(s string) string {
return
string
(
chars
)
}
func
escapeDoubleBackslash
(
target
string
)
string
{
var
re
=
regexp
.
MustCompile
(
`\\`
)
return
re
.
ReplaceAllString
(
target
,
`\\\\`
)
// return strings.Replace(target, `\`, "", -1)
}
func
escapeIllegalCharacters
(
target
string
)
string
{
var
re
=
regexp
.
MustCompile
(
`[-\/^$+?.()|[\]{}]`
)
return
string
(
re
.
ReplaceAllFunc
([]
byte
(
target
),
func
(
in
[]
byte
)
[]
byte
{
return
[]
byte
(
strings
.
Replace
(
string
(
in
),
string
(
in
),
`\\`
+
string
(
in
),
1
))
}))
}
func
replaceSingleAsterixCharacters
(
target
string
)
string
{
return
strings
.
Replace
(
target
,
"*"
,
".*"
,
-
1
)
}
func
interpolateFilterWildcards
(
value
string
)
string
{
if
strings
.
HasSuffix
(
value
,
"*"
)
&&
strings
.
HasPrefix
(
value
,
"*"
)
{
value
=
strings
.
Replace
(
value
,
"*"
,
""
,
1
)
...
...
@@ -197,8 +180,11 @@ func interpolateFilterWildcards(value string) string {
value
=
reverse
(
strings
.
Replace
(
reverse
(
value
),
"*"
,
""
,
1
))
value
=
fmt
.
Sprintf
(
`starts_with("%s")`
,
value
)
}
else
if
strings
.
Contains
(
value
,
"*"
)
{
value
=
escapeIllegalCharacters
(
value
)
value
=
replaceSingleAsterixCharacters
(
value
)
re
:=
regexp
.
MustCompile
(
`[-\/^$+?.()|[\]{}]`
)
value
=
string
(
re
.
ReplaceAllFunc
([]
byte
(
value
),
func
(
in
[]
byte
)
[]
byte
{
return
[]
byte
(
strings
.
Replace
(
string
(
in
),
string
(
in
),
`\\`
+
string
(
in
),
1
))
}))
value
=
strings
.
Replace
(
value
,
"*"
,
".*"
,
-
1
)
value
=
strings
.
Replace
(
value
,
`"`
,
`\\"`
,
-
1
)
value
=
fmt
.
Sprintf
(
`monitoring.regex.full_match("^%s$")`
,
value
)
}
...
...
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