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
0d880506
Unverified
Commit
0d880506
authored
Mar 15, 2018
by
Steven Allen
Committed by
GitHub
Mar 15, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15 from ipfs/feat/implement-du
implement the PersistentDatastore interface
parents
160b391d
82ff6795
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
17 deletions
+35
-17
.gx/lastpubver
.gx/lastpubver
+1
-1
.travis.yml
.travis.yml
+12
-8
Makefile
Makefile
+0
-5
measure.go
measure.go
+19
-0
package.json
package.json
+3
-3
No files found.
.gx/lastpubver
View file @
0d880506
1.3.
1
: Qm
bJgZGRtkFeSdCxBCPaMKWRDYbqMxHyFfvjQGcWzpqsDe
1.3.
2
: Qm
Xez8SABR95KKKgU9XFtTTQ79QRn2nWS9o5pa1EcHsLs5
.travis.yml
View file @
0d880506
os
:
-
linux
-
osx
-
linux
sudo
:
false
language
:
go
go
:
-
1.
8
-
1.
9.x
install
:
true
install
:
-
make deps
script
:
-
make deps
-
gx-go rewrite
-
go get github.com/mattn/goveralls
-
goveralls -service=travis-ci
-
bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh)
cache
:
directories
:
-
$GOPATH/src/gx
notifications
:
email
:
false
env
:
GOTFLAGS="-race -cpu=5"
Makefile
View file @
0d880506
test
:
deps
go
test
-race
-v
./...
export
IPFS_API
?=
v04x.ipfs.io
gx
:
...
...
@@ -10,5 +7,3 @@ gx:
deps
:
gx
gx
--verbose
install
--global
gx-go rewrite
go get
-t
./...
measure.go
View file @
0d880506
...
...
@@ -68,6 +68,11 @@ func New(prefix string, ds datastore.Datastore) *measure {
gcErr
:
metrics
.
New
(
prefix
+
".gc.errors_total"
,
"Number of errored Datastore.CollectGarbage calls"
)
.
Counter
(),
gcLatency
:
metrics
.
New
(
prefix
+
".gc.latency_seconds"
,
"Latency distribution of Datastore.CollectGarbage calls"
)
.
Histogram
(
datastoreLatencyBuckets
),
duNum
:
metrics
.
New
(
prefix
+
".du_total"
,
"Total number of Datastore.DiskUsage calls"
)
.
Counter
(),
duErr
:
metrics
.
New
(
prefix
+
".du.errors_total"
,
"Number of errored Datastore.DiskUsage calls"
)
.
Counter
(),
duLatency
:
metrics
.
New
(
prefix
+
".du.latency_seconds"
,
"Latency distribution of Datastore.DiskUsage calls"
)
.
Histogram
(
datastoreLatencyBuckets
),
}
return
m
}
...
...
@@ -108,6 +113,10 @@ type measure struct {
gcNum
metrics
.
Counter
gcErr
metrics
.
Counter
gcLatency
metrics
.
Histogram
duNum
metrics
.
Counter
duErr
metrics
.
Counter
duLatency
metrics
.
Histogram
}
func
recordLatency
(
h
metrics
.
Histogram
,
start
time
.
Time
)
{
...
...
@@ -211,6 +220,16 @@ func (m *measure) CollectGarbage() error {
return
nil
}
func
(
m
*
measure
)
DiskUsage
()
(
uint64
,
error
)
{
defer
recordLatency
(
m
.
duLatency
,
time
.
Now
())
m
.
duNum
.
Inc
()
size
,
err
:=
datastore
.
DiskUsage
(
m
.
backend
)
if
err
!=
nil
{
m
.
duErr
.
Inc
()
}
return
size
,
err
}
type
measuredBatch
struct
{
puts
int
deletes
int
...
...
package.json
View file @
0d880506
...
...
@@ -15,9 +15,9 @@
},
{
"author"
:
"jbenet"
,
"hash"
:
"Qm
XRKBQA4wXP7xWbFiZsR1GP4HV6wMDQ1aWFxZZ4uBcPX9
"
,
"hash"
:
"Qm
eiCcJfDW1GJnWUArudsv5rQsihpi4oyddPhdqo3CfX6i
"
,
"name"
:
"go-datastore"
,
"version"
:
"2.4.
0
"
"version"
:
"2.4.
1
"
}
],
"gxVersion"
:
"0.8.0"
,
...
...
@@ -25,6 +25,6 @@
"license"
:
""
,
"name"
:
"go-ds-measure"
,
"releaseCmd"
:
"git commit -a -m
\"
gx publish $VERSION
\"
"
,
"version"
:
"1.3.
1
"
"version"
:
"1.3.
2
"
}
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