Skip to content

Commit

Permalink
Merge branch 'stream'
Browse files Browse the repository at this point in the history
Just to get a couple of improvements and fixes.

Closes oklog#30.
  • Loading branch information
peterbourgon committed Jan 24, 2017
2 parents e1fef80 + 00b9845 commit 1bdfb6f
Show file tree
Hide file tree
Showing 9 changed files with 587 additions and 113 deletions.
4 changes: 3 additions & 1 deletion cmd/oklog/ingeststore.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ func runIngestStore(args []string) error {
Help: "Number of peers in the cluster from this node's perspective.",
}, func() float64 { return float64(peer.ClusterSize()) }))

// Create the HTTP client we'll use to consume segments.
// Create the HTTP client we'll use for various purposes.
// TODO(pb): audit to see if we need purpose-built clients
httpClient := &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
Expand Down Expand Up @@ -422,6 +423,7 @@ func runIngestStore(args []string) error {
mux.Handle("/store/", http.StripPrefix("/store", store.NewAPI(
peer,
storeLog,
httpClient,
replicatedSegments.WithLabelValues("ingress"),
replicatedBytes.WithLabelValues("ingress"),
apiDuration,
Expand Down
9 changes: 5 additions & 4 deletions cmd/oklog/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func runQuery(args []string) error {
if err != nil {
return err
}
verbosePrintf("GET %s\n", req.URL.String())
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
Expand All @@ -112,14 +113,14 @@ func runQuery(args []string) error {
result.DecodeFrom(resp)

qtype := "normal string"
if result.Regex {
if result.Params.Regex {
qtype = "regular expression"
}

verbosePrintf("Response in %s\n", time.Since(begin))
verbosePrintf("Queried from %s\n", result.From)
verbosePrintf("Queried to %s\n", result.To)
verbosePrintf("Queried %s %q\n", qtype, result.Q)
verbosePrintf("Queried from %s\n", result.Params.From)
verbosePrintf("Queried to %s\n", result.Params.To)
verbosePrintf("Queried %s %q\n", qtype, result.Params.Q)
verbosePrintf("%d node(s) queried\n", result.NodesQueried)
verbosePrintf("%d segment(s) queried\n", result.SegmentsQueried)
verbosePrintf("%dB (%dMiB) maximum data set size\n", result.MaxDataSetSize, result.MaxDataSetSize/(1024*1024))
Expand Down
4 changes: 3 additions & 1 deletion cmd/oklog/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ func runStore(args []string) error {
Help: "Number of peers in the cluster from this node's perspective.",
}, func() float64 { return float64(peer.ClusterSize()) }))

// Create the HTTP client we'll use to consume segments.
// Create the HTTP client we'll use for various purposes.
// TODO(pb): audit to see if we need purpose-built clients
httpClient := &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
Expand Down Expand Up @@ -268,6 +269,7 @@ func runStore(args []string) error {
mux.Handle("/store/", http.StripPrefix("/store", store.NewAPI(
peer,
storeLog,
httpClient,
replicatedSegments.WithLabelValues("ingress"),
replicatedBytes.WithLabelValues("ingress"),
apiDuration,
Expand Down
Loading

0 comments on commit 1bdfb6f

Please sign in to comment.