Split default client and server views for the HTTP plugin (#601)
diff --git a/plugin/ocgrpc/client_metrics.go b/plugin/ocgrpc/client_metrics.go
index 60edcc0..4f2cd3a 100644
--- a/plugin/ocgrpc/client_metrics.go
+++ b/plugin/ocgrpc/client_metrics.go
@@ -87,17 +87,15 @@
}
)
-// 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
diff --git a/plugin/ocgrpc/server_metrics.go b/plugin/ocgrpc/server_metrics.go
index 3693e40..f93137e 100644
--- a/plugin/ocgrpc/server_metrics.go
+++ b/plugin/ocgrpc/server_metrics.go
@@ -91,16 +91,14 @@
}
)
-// 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.
diff --git a/plugin/ochttp/client_test.go b/plugin/ochttp/client_test.go
index 4ef4737..e0fd870 100644
--- a/plugin/ochttp/client_test.go
+++ b/plugin/ochttp/client_test.go
@@ -36,7 +36,7 @@
}))
defer server.Close()
- for _, v := range ochttp.DefaultViews {
+ for _, v := range ochttp.DefaultClientViews {
v.Subscribe()
}
diff --git a/plugin/ochttp/server_test.go b/plugin/ochttp/server_test.go
index ab362ee..bdfe8b0 100644
--- a/plugin/ochttp/server_test.go
+++ b/plugin/ochttp/server_test.go
@@ -26,7 +26,7 @@
}
func TestHandlerStatsCollection(t *testing.T) {
- for _, v := range DefaultViews {
+ for _, v := range DefaultServerViews {
v.Subscribe()
}
diff --git a/plugin/ochttp/stats.go b/plugin/ochttp/stats.go
index 02e7f68..44d14fa 100644
--- a/plugin/ochttp/stats.go
+++ b/plugin/ochttp/stats.go
@@ -150,19 +150,24 @@
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,
+}