Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
k8s-ingress
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
uplex-varnish
k8s-ingress
Commits
314c607e
Commit
314c607e
authored
Jan 15, 2019
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the monitor_result counter.
parent
54e82059
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
metrics.go
pkg/varnish/metrics.go
+8
-0
monitor.go
pkg/varnish/monitor.go
+3
-0
No files found.
pkg/varnish/metrics.go
View file @
314c607e
...
...
@@ -76,6 +76,13 @@ var (
Help
:
"Current number of known admin secrets"
,
})
monResultCtr
=
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
namespace
,
Subsystem
:
subsystem
,
Name
:
"monitor_result_total"
,
Help
:
"Total number of monitor results"
,
},
[]
string
{
"service"
,
"status"
,
"result"
})
addr2instMetrics
map
[
string
]
*
instanceMetrics
=
make
(
map
[
string
]
*
instanceMetrics
)
instMetricsMtx
=
&
sync
.
Mutex
{}
...
...
@@ -92,6 +99,7 @@ func initMetrics() {
prometheus
.
Register
(
svcsGauge
)
prometheus
.
Register
(
instsGauge
)
prometheus
.
Register
(
secretsGauge
)
prometheus
.
Register
(
monResultCtr
)
}
func
getInstanceMetrics
(
addr
string
)
*
instanceMetrics
{
...
...
pkg/varnish/monitor.go
View file @
314c607e
...
...
@@ -55,6 +55,7 @@ func (vc *VarnishController) infoEvt(svc, reason, msgFmt string,
vc
.
log
.
Infof
(
msgFmt
,
args
...
)
vc
.
svcEvt
.
SvcInfoEvent
(
svc
,
reason
,
msgFmt
,
args
...
)
monResultCtr
.
WithLabelValues
(
svc
,
"info"
,
reason
)
.
Inc
()
}
func
(
vc
*
VarnishController
)
warnEvt
(
svc
,
reason
,
msgFmt
string
,
...
...
@@ -62,6 +63,7 @@ func (vc *VarnishController) warnEvt(svc, reason, msgFmt string,
vc
.
log
.
Warnf
(
msgFmt
,
args
...
)
vc
.
svcEvt
.
SvcWarnEvent
(
svc
,
reason
,
msgFmt
,
args
...
)
monResultCtr
.
WithLabelValues
(
svc
,
"warning"
,
reason
)
.
Inc
()
}
func
(
vc
*
VarnishController
)
errorEvt
(
svc
,
reason
,
msgFmt
string
,
...
...
@@ -69,6 +71,7 @@ func (vc *VarnishController) errorEvt(svc, reason, msgFmt string,
vc
.
log
.
Errorf
(
msgFmt
,
args
...
)
vc
.
svcEvt
.
SvcWarnEvent
(
svc
,
reason
,
msgFmt
,
args
...
)
monResultCtr
.
WithLabelValues
(
svc
,
"error"
,
reason
)
.
Inc
()
}
func
(
vc
*
VarnishController
)
checkInst
(
svc
string
,
inst
*
varnishInst
)
bool
{
...
...
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