Skip to content

Commit

Permalink
vendor: update pd-client
Browse files Browse the repository at this point in the history
  • Loading branch information
huachaohuang committed Oct 23, 2016
1 parent 9f615fc commit bbd2aa5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
14 changes: 14 additions & 0 deletions _vendor/src/github.com/pingcap/pd/pd-client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
package pd

import (
"time"

"github.com/juju/errors"
"github.com/ngaut/log"
"github.com/pingcap/kvproto/pkg/metapb"
Expand Down Expand Up @@ -60,8 +62,12 @@ func (c *client) GetTS() (int64, int64, error) {
req := &tsoRequest{
done: make(chan error, 1),
}

start := time.Now()
c.worker.requests <- req
err := <-req.done
requestDuration.WithLabelValues("tso").Observe(time.Since(start).Seconds())

return req.physical, req.logical, err
}

Expand All @@ -72,8 +78,12 @@ func (c *client) GetRegion(key []byte) (*metapb.Region, *metapb.Peer, error) {
},
done: make(chan error, 1),
}

start := time.Now()
c.worker.requests <- req
err := <-req.done
requestDuration.WithLabelValues("get_region").Observe(time.Since(start).Seconds())

if err != nil {
return nil, nil, errors.Trace(err)
}
Expand All @@ -87,8 +97,12 @@ func (c *client) GetStore(storeID uint64) (*metapb.Store, error) {
},
done: make(chan error, 1),
}

start := time.Now()
c.worker.requests <- req
err := <-req.done
requestDuration.WithLabelValues("get_store").Observe(time.Since(start).Seconds())

if err != nil {
return nil, errors.Trace(err)
}
Expand Down
10 changes: 10 additions & 0 deletions _vendor/src/github.com/pingcap/pd/pd-client/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,21 @@ var (
Help: "Bucketed histogram of processing time (s) of failed handled cmds.",
Buckets: prometheus.ExponentialBuckets(0.0005, 2, 13),
}, []string{"type"})

requestDuration = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Namespace: "pd_client",
Subsystem: "request",
Name: "handle_requests_duration_seconds",
Help: "Bucketed histogram of processing time (s) of handled requests.",
Buckets: prometheus.ExponentialBuckets(0.0005, 2, 13),
}, []string{"type"})
)

func init() {
prometheus.MustRegister(cmdCounter)
prometheus.MustRegister(cmdFailedCounter)
prometheus.MustRegister(cmdDuration)
prometheus.MustRegister(cmdFailedDuration)
prometheus.MustRegister(requestDuration)
}
6 changes: 3 additions & 3 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ import:
subpackages:
- lex
- package: github.com/pingcap/pd
version: 5606df6dcc8bf695a808939169734d675b4786ee
version: c0af22f4f5c96ec7bd6d7c284529fa674a06cada
- package: github.com/pingcap/tipb
version: 38084aeaf922fb5d41284865d64b2113f3ae5f1c
subpackages:
Expand Down

0 comments on commit bbd2aa5

Please sign in to comment.