Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-ds-measure
Commits
4bdddbfb
Commit
4bdddbfb
authored
Nov 19, 2019
by
Adin Schmahmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add datastore sync measurements
parent
142e5cb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
measure.go
measure.go
+16
-1
No files found.
measure.go
View file @
4bdddbfb
...
...
@@ -32,6 +32,11 @@ func New(prefix string, ds datastore.Datastore) *measure {
putSize
:
metrics
.
New
(
prefix
+
".put.size_bytes"
,
"Size distribution of stored byte slices"
)
.
Histogram
(
datastoreSizeBuckets
),
syncNum
:
metrics
.
New
(
prefix
+
".sync_total"
,
"Total number of Datastore.Sync calls"
)
.
Counter
(),
syncErr
:
metrics
.
New
(
prefix
+
".sync.errors_total"
,
"Number of errored Datastore.Sync calls"
)
.
Counter
(),
syncLatency
:
metrics
.
New
(
prefix
+
".sync.latency_seconds"
,
"Latency distribution of Datastore.Sync calls"
)
.
Histogram
(
datastoreLatencyBuckets
),
getNum
:
metrics
.
New
(
prefix
+
".get_total"
,
"Total number of Datastore.Get calls"
)
.
Counter
(),
getErr
:
metrics
.
New
(
prefix
+
".get.errors_total"
,
"Number of errored Datastore.Get calls"
)
.
Counter
(),
getLatency
:
metrics
.
New
(
prefix
+
".get.latency_seconds"
,
...
...
@@ -106,6 +111,10 @@ type measure struct {
putLatency
metrics
.
Histogram
putSize
metrics
.
Histogram
syncNum
metrics
.
Counter
syncErr
metrics
.
Counter
syncLatency
metrics
.
Histogram
getNum
metrics
.
Counter
getErr
metrics
.
Counter
getLatency
metrics
.
Histogram
...
...
@@ -174,7 +183,13 @@ func (m *measure) Put(key datastore.Key, value []byte) error {
}
func
(
m
*
measure
)
Sync
(
prefix
datastore
.
Key
)
error
{
return
nil
defer
recordLatency
(
m
.
syncLatency
,
time
.
Now
())
m
.
syncNum
.
Inc
()
err
:=
m
.
backend
.
Sync
(
prefix
)
if
err
!=
nil
{
m
.
syncErr
.
Inc
()
}
return
err
}
func
(
m
*
measure
)
Get
(
key
datastore
.
Key
)
(
value
[]
byte
,
err
error
)
{
...
...
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