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

Commit 92b618f

Browse files
authored
Split default client and server views for the HTTP plugin (#601)
1 parent b4cbeef commit 92b618f

File tree

5 files changed

+40
-39
lines changed

5 files changed

+40
-39
lines changed

plugin/ocgrpc/client_metrics.go

+9-11
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,15 @@ var (
8787
}
8888
)
8989

90-
// All the default client views provided by this package:
91-
var (
92-
DefaultClientViews = []*view.View{
93-
ClientErrorCountView,
94-
ClientRoundTripLatencyView,
95-
ClientRequestBytesView,
96-
ClientResponseBytesView,
97-
ClientRequestCountView,
98-
ClientResponseCountView,
99-
}
100-
)
90+
// DefaultClientViews are the default client views provided by this package.
91+
var DefaultClientViews = []*view.View{
92+
ClientErrorCountView,
93+
ClientRoundTripLatencyView,
94+
ClientRequestBytesView,
95+
ClientResponseBytesView,
96+
ClientRequestCountView,
97+
ClientResponseCountView,
98+
}
10199

102100
// TODO(jbd): Add roundtrip_latency, uncompressed_request_bytes, uncompressed_response_bytes, request_count, response_count.
103101
// TODO(acetechnologist): This is temporary and will need to be replaced by a

plugin/ocgrpc/server_metrics.go

+9-11
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,14 @@ var (
9191
}
9292
)
9393

94-
// All default server views provided by this package:
95-
var (
96-
DefaultServerViews = []*view.View{
97-
ServerErrorCountView,
98-
ServerServerElapsedTimeView,
99-
ServerRequestBytesView,
100-
ServerResponseBytesView,
101-
ServerRequestCountView,
102-
ServerResponseCountView,
103-
}
104-
)
94+
// DefaultServerViews are the default server views provided by this package.
95+
var DefaultServerViews = []*view.View{
96+
ServerErrorCountView,
97+
ServerServerElapsedTimeView,
98+
ServerRequestBytesView,
99+
ServerResponseBytesView,
100+
ServerRequestCountView,
101+
ServerResponseCountView,
102+
}
105103

106104
// TODO(jbd): Add roundtrip_latency, uncompressed_request_bytes, uncompressed_response_bytes, request_count, response_count.

plugin/ochttp/client_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestClient(t *testing.T) {
3636
}))
3737
defer server.Close()
3838

39-
for _, v := range ochttp.DefaultViews {
39+
for _, v := range ochttp.DefaultClientViews {
4040
v.Subscribe()
4141
}
4242

plugin/ochttp/server_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func updateMean(mean float64, sample, count int) float64 {
2626
}
2727

2828
func TestHandlerStatsCollection(t *testing.T) {
29-
for _, v := range DefaultViews {
29+
for _, v := range DefaultServerViews {
3030
v.Subscribe()
3131
}
3232

plugin/ochttp/stats.go

+20-15
Original file line numberDiff line numberDiff line change
@@ -150,19 +150,24 @@ var (
150150
Measure: ServerLatency,
151151
Aggregation: view.CountAggregation{},
152152
}
153-
154-
DefaultViews = []*view.View{
155-
ClientRequestCountView,
156-
ClientRequestBytesView,
157-
ClientResponseBytesView,
158-
ClientLatencyView,
159-
ClientRequestCountByMethod,
160-
ClientResponseCountByStatusCode,
161-
ServerRequestCountView,
162-
ServerRequestBytesView,
163-
ServerResponseBytesView,
164-
ServerLatencyView,
165-
ServerRequestCountByMethod,
166-
ServerResponseCountByStatusCode,
167-
}
168153
)
154+
155+
// DefaultClientViews are the default client views provided by this package.
156+
var DefaultClientViews = []*view.View{
157+
ClientRequestCountView,
158+
ClientRequestBytesView,
159+
ClientResponseBytesView,
160+
ClientLatencyView,
161+
ClientRequestCountByMethod,
162+
ClientResponseCountByStatusCode,
163+
}
164+
165+
// DefaultServerViews are the default server views provided by this package.
166+
var DefaultServerViews = []*view.View{
167+
ServerRequestCountView,
168+
ServerRequestBytesView,
169+
ServerResponseBytesView,
170+
ServerLatencyView,
171+
ServerRequestCountByMethod,
172+
ServerResponseCountByStatusCode,
173+
}

0 commit comments

Comments
 (0)