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
b9346d07
Commit
b9346d07
authored
Jul 16, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
betterify the everything
parent
6b0bf4f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
measure.go
measure.go
+6
-7
No files found.
measure.go
View file @
b9346d07
...
...
@@ -3,6 +3,7 @@
package
measure
import
(
"io"
"time"
"github.com/jbenet/go-datastore"
...
...
@@ -18,11 +19,6 @@ const (
maxSize
=
int64
(
1
<<
32
)
)
type
DatastoreCloser
interface
{
datastore
.
Datastore
Close
()
error
}
// New wraps the datastore, providing metrics on the operations. The
// metrics are registered with names starting with prefix and a dot.
//
...
...
@@ -84,7 +80,6 @@ type measure struct {
}
var
_
datastore
.
Datastore
=
(
*
measure
)(
nil
)
var
_
DatastoreCloser
=
(
*
measure
)(
nil
)
func
recordLatency
(
h
*
metrics
.
Histogram
,
start
time
.
Time
)
{
elapsed
:=
time
.
Now
()
.
Sub
(
start
)
/
time
.
Microsecond
...
...
@@ -159,7 +154,7 @@ type measuredBatch struct {
}
func
(
m
*
measure
)
Batch
()
(
datastore
.
Batch
,
error
)
{
bds
,
ok
:=
m
.
backend
.
(
datastore
.
Batching
Datastore
)
bds
,
ok
:=
m
.
backend
.
(
datastore
.
Batching
)
if
!
ok
{
return
nil
,
datastore
.
ErrBatchUnsupported
}
...
...
@@ -245,5 +240,9 @@ func (m *measure) Close() error {
m
.
queryNum
.
Remove
()
m
.
queryErr
.
Remove
()
m
.
queryLatency
.
Remove
()
if
c
,
ok
:=
m
.
backend
.
(
io
.
Closer
);
ok
{
return
c
.
Close
()
}
return
nil
}
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