Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Split default client and server views for the HTTP plugin (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyll committed Mar 18, 2018
1 parent b4cbeef commit 92b618f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 39 deletions.
20 changes: 9 additions & 11 deletions plugin/ocgrpc/client_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,15 @@ var (
}
)

// All the default client views provided by this package:
var (
DefaultClientViews = []*view.View{
ClientErrorCountView,
ClientRoundTripLatencyView,
ClientRequestBytesView,
ClientResponseBytesView,
ClientRequestCountView,
ClientResponseCountView,
}
)
// DefaultClientViews are the default client views provided by this package.
var DefaultClientViews = []*view.View{
ClientErrorCountView,
ClientRoundTripLatencyView,
ClientRequestBytesView,
ClientResponseBytesView,
ClientRequestCountView,
ClientResponseCountView,
}

// TODO(jbd): Add roundtrip_latency, uncompressed_request_bytes, uncompressed_response_bytes, request_count, response_count.
// TODO(acetechnologist): This is temporary and will need to be replaced by a
Expand Down
20 changes: 9 additions & 11 deletions plugin/ocgrpc/server_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,14 @@ var (
}
)

// All default server views provided by this package:
var (
DefaultServerViews = []*view.View{
ServerErrorCountView,
ServerServerElapsedTimeView,
ServerRequestBytesView,
ServerResponseBytesView,
ServerRequestCountView,
ServerResponseCountView,
}
)
// DefaultServerViews are the default server views provided by this package.
var DefaultServerViews = []*view.View{
ServerErrorCountView,
ServerServerElapsedTimeView,
ServerRequestBytesView,
ServerResponseBytesView,
ServerRequestCountView,
ServerResponseCountView,
}

// TODO(jbd): Add roundtrip_latency, uncompressed_request_bytes, uncompressed_response_bytes, request_count, response_count.
2 changes: 1 addition & 1 deletion plugin/ochttp/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestClient(t *testing.T) {
}))
defer server.Close()

for _, v := range ochttp.DefaultViews {
for _, v := range ochttp.DefaultClientViews {
v.Subscribe()
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/ochttp/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func updateMean(mean float64, sample, count int) float64 {
}

func TestHandlerStatsCollection(t *testing.T) {
for _, v := range DefaultViews {
for _, v := range DefaultServerViews {
v.Subscribe()
}

Expand Down
35 changes: 20 additions & 15 deletions plugin/ochttp/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,24 @@ var (
Measure: ServerLatency,
Aggregation: view.CountAggregation{},
}

DefaultViews = []*view.View{
ClientRequestCountView,
ClientRequestBytesView,
ClientResponseBytesView,
ClientLatencyView,
ClientRequestCountByMethod,
ClientResponseCountByStatusCode,
ServerRequestCountView,
ServerRequestBytesView,
ServerResponseBytesView,
ServerLatencyView,
ServerRequestCountByMethod,
ServerResponseCountByStatusCode,
}
)

// DefaultClientViews are the default client views provided by this package.
var DefaultClientViews = []*view.View{
ClientRequestCountView,
ClientRequestBytesView,
ClientResponseBytesView,
ClientLatencyView,
ClientRequestCountByMethod,
ClientResponseCountByStatusCode,
}

// DefaultServerViews are the default server views provided by this package.
var DefaultServerViews = []*view.View{
ServerRequestCountView,
ServerRequestBytesView,
ServerResponseBytesView,
ServerLatencyView,
ServerRequestCountByMethod,
ServerResponseCountByStatusCode,
}

0 comments on commit 92b618f

Please sign in to comment.