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
b9787060
Commit
b9787060
authored
Aug 13, 2018
by
Steven Allen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/ds-bytes'
parents
21f067c8
1de65d35
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
17 deletions
+10
-17
.gx/lastpubver
.gx/lastpubver
+1
-1
measure.go
measure.go
+6
-13
package.json
package.json
+3
-3
No files found.
.gx/lastpubver
View file @
b9787060
1.
3.3
: Qm
PMRquZA1WiRMQ5ZE2V1kHtnPaq2X5Qtz7Wgwwo2tjLyS
1.
4.0
: Qm
Ra2HJZNKkkkbNVPkZu9VCzst4B3JmxoaR97EUFhWcK6m
measure.go
View file @
b9787060
...
...
@@ -124,12 +124,10 @@ func recordLatency(h metrics.Histogram, start time.Time) {
h
.
Observe
(
elapsed
.
Seconds
())
}
func
(
m
*
measure
)
Put
(
key
datastore
.
Key
,
value
interface
{}
)
error
{
func
(
m
*
measure
)
Put
(
key
datastore
.
Key
,
value
[]
byte
)
error
{
defer
recordLatency
(
m
.
putLatency
,
time
.
Now
())
m
.
putNum
.
Inc
()
if
b
,
ok
:=
value
.
([]
byte
);
ok
{
m
.
putSize
.
Observe
(
float64
(
len
(
b
)))
}
m
.
putSize
.
Observe
(
float64
(
len
(
value
)))
err
:=
m
.
backend
.
Put
(
key
,
value
)
if
err
!=
nil
{
m
.
putErr
.
Inc
()
...
...
@@ -137,16 +135,14 @@ func (m *measure) Put(key datastore.Key, value interface{}) error {
return
err
}
func
(
m
*
measure
)
Get
(
key
datastore
.
Key
)
(
value
interface
{}
,
err
error
)
{
func
(
m
*
measure
)
Get
(
key
datastore
.
Key
)
(
value
[]
byte
,
err
error
)
{
defer
recordLatency
(
m
.
getLatency
,
time
.
Now
())
m
.
getNum
.
Inc
()
value
,
err
=
m
.
backend
.
Get
(
key
)
if
err
!=
nil
{
m
.
getErr
.
Inc
()
}
else
{
if
b
,
ok
:=
value
.
([]
byte
);
ok
{
m
.
getSize
.
Observe
(
float64
(
len
(
b
)))
}
m
.
getSize
.
Observe
(
float64
(
len
(
value
)))
}
return
value
,
err
}
...
...
@@ -263,12 +259,9 @@ func (m *measure) Batch() (datastore.Batch, error) {
},
nil
}
func
(
mt
*
measuredBatch
)
Put
(
key
datastore
.
Key
,
val
interface
{}
)
error
{
func
(
mt
*
measuredBatch
)
Put
(
key
datastore
.
Key
,
val
[]
byte
)
error
{
mt
.
puts
++
valb
,
ok
:=
val
.
([]
byte
)
if
ok
{
mt
.
m
.
putSize
.
Observe
(
float64
(
len
(
valb
)))
}
mt
.
m
.
putSize
.
Observe
(
float64
(
len
(
val
)))
return
mt
.
putts
.
Put
(
key
,
val
)
}
...
...
package.json
View file @
b9787060
...
...
@@ -15,9 +15,9 @@
},
{
"author"
:
"jbenet"
,
"hash"
:
"Qm
eiCcJfDW1GJnWUArudsv5rQsihpi4oyddPhdqo3CfX6i
"
,
"hash"
:
"Qm
VG5gxteQNEMhrS8prJSmU2C9rebtFuTd3SYZ5kE3YZ5k
"
,
"name"
:
"go-datastore"
,
"version"
:
"
2.4.1
"
"version"
:
"
3.0.0
"
}
],
"gxVersion"
:
"0.8.0"
,
...
...
@@ -25,6 +25,6 @@
"license"
:
""
,
"name"
:
"go-ds-measure"
,
"releaseCmd"
:
"git commit -a -m
\"
gx publish $VERSION
\"
"
,
"version"
:
"1.
3.3
"
"version"
:
"1.
4.0
"
}
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