Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
e4c0c78e
Commit
e4c0c78e
authored
Sep 25, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Redis error counters
parent
9e4f081f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
internal/redis/redis.go
internal/redis/redis.go
+14
-1
No files found.
internal/redis/redis.go
View file @
e4c0c78e
...
...
@@ -50,11 +50,20 @@ var (
Help
:
"How many connections gitlab-workhorse has opened in total. Can be used to track Redis connection rate for this process"
,
},
)
errorCounter
=
prometheus
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Name
:
"gitlab_workhorse_redis_errors"
,
Help
:
"Counts different types of Redis errors encountered by workhorse, by type and destination (redis, sentinel)"
,
},
[]
string
{
"type"
,
"dst"
},
)
)
func
init
()
{
prometheus
.
MustRegister
(
totalConnections
,
errorCounter
,
)
}
...
...
@@ -79,6 +88,7 @@ func sentinelConn(master string, urls []config.TomlURL) *sentinel.Sentinel {
timeout
:=
500
*
time
.
Millisecond
c
,
err
:=
redis
.
DialTimeout
(
"tcp"
,
addr
,
timeout
,
timeout
,
timeout
)
if
err
!=
nil
{
errorCounter
.
WithLabelValues
(
"dial"
,
"sentinel"
)
.
Inc
()
return
nil
,
err
}
return
c
,
nil
...
...
@@ -151,6 +161,7 @@ func sentinelDialer(dopts []redis.DialOption, keepAlivePeriod time.Duration) red
return
func
()
(
redis
.
Conn
,
error
)
{
address
,
err
:=
sntnl
.
MasterAddr
()
if
err
!=
nil
{
errorCounter
.
WithLabelValues
(
"master"
,
"sentinel"
)
.
Inc
()
return
nil
,
err
}
dopts
=
append
(
dopts
,
redis
.
DialNetDial
(
keepAliveDialer
(
keepAlivePeriod
)))
...
...
@@ -176,7 +187,9 @@ func redisDial(network, address string, options ...redis.DialOption) (redis.Conn
func
countDialer
(
dialer
redisDialerFunc
)
redisDialerFunc
{
return
func
()
(
redis
.
Conn
,
error
)
{
c
,
err
:=
dialer
()
if
err
==
nil
{
if
err
!=
nil
{
errorCounter
.
WithLabelValues
(
"dial"
,
"redis"
)
.
Inc
()
}
else
{
totalConnections
.
Inc
()
}
return
c
,
err
...
...
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