Skip to content

Commit

Permalink
stats/opencensus: Add message prefix to metrics names (#6126)
Browse files Browse the repository at this point in the history
  • Loading branch information
zasweq authored Mar 17, 2023
1 parent c84a500 commit b638faf
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
16 changes: 8 additions & 8 deletions gcp/observability/observability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,17 +436,17 @@ func (s) TestOpenCensusIntegration(t *testing.T) {
if value := fe.SeenViews["grpc.io/server/server_latency"]; value != TypeOpenCensusViewDistribution {
errs = append(errs, fmt.Errorf("grpc.io/server/server_latency: %s != %s", value, TypeOpenCensusViewDistribution))
}
if value := fe.SeenViews["grpc.io/client/sent_compressed_bytes_per_rpc"]; value != TypeOpenCensusViewDistribution {
errs = append(errs, fmt.Errorf("unexpected type for grpc.io/client/sent_compressed_bytes_per_rpc: %s != %s", value, TypeOpenCensusViewDistribution))
if value := fe.SeenViews["grpc.io/client/sent_compressed_message_bytes_per_rpc"]; value != TypeOpenCensusViewDistribution {
errs = append(errs, fmt.Errorf("unexpected type for grpc.io/client/sent_compressed_message_bytes_per_rpc: %s != %s", value, TypeOpenCensusViewDistribution))
}
if value := fe.SeenViews["grpc.io/client/received_compressed_bytes_per_rpc"]; value != TypeOpenCensusViewDistribution {
errs = append(errs, fmt.Errorf("unexpected type for grpc.io/client/received_compressed_bytes_per_rpc: %s != %s", value, TypeOpenCensusViewDistribution))
if value := fe.SeenViews["grpc.io/client/received_compressed_message_bytes_per_rpc"]; value != TypeOpenCensusViewDistribution {
errs = append(errs, fmt.Errorf("unexpected type for grpc.io/client/received_compressed_message_bytes_per_rpc: %s != %s", value, TypeOpenCensusViewDistribution))
}
if value := fe.SeenViews["grpc.io/server/sent_compressed_bytes_per_rpc"]; value != TypeOpenCensusViewDistribution {
errs = append(errs, fmt.Errorf("unexpected type for grpc.io/server/sent_compressed_bytes_per_rpc: %s != %s", value, TypeOpenCensusViewDistribution))
if value := fe.SeenViews["grpc.io/server/sent_compressed_message_bytes_per_rpc"]; value != TypeOpenCensusViewDistribution {
errs = append(errs, fmt.Errorf("unexpected type for grpc.io/server/sent_compressed_message_bytes_per_rpc: %s != %s", value, TypeOpenCensusViewDistribution))
}
if value := fe.SeenViews["grpc.io/server/received_compressed_bytes_per_rpc"]; value != TypeOpenCensusViewDistribution {
errs = append(errs, fmt.Errorf("unexpected type for grpc.io/server/received_compressed_bytes_per_rpc: %s != %s", value, TypeOpenCensusViewDistribution))
if value := fe.SeenViews["grpc.io/server/received_compressed_message_bytes_per_rpc"]; value != TypeOpenCensusViewDistribution {
errs = append(errs, fmt.Errorf("unexpected type for grpc.io/server/received_compressed_message_bytes_per_rpc: %s != %s", value, TypeOpenCensusViewDistribution))
}
if fe.SeenSpans <= 0 {
errs = append(errs, fmt.Errorf("unexpected number of seen spans: %v <= 0", fe.SeenSpans))
Expand Down
8 changes: 4 additions & 4 deletions gcp/observability/opencensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ var (
opencensus.ClientStartedRPCsView,
opencensus.ClientCompletedRPCsView,
opencensus.ClientRoundtripLatencyView,
opencensus.ClientSentCompressedBytesPerRPCView,
opencensus.ClientReceivedCompressedBytesPerRPCView,
opencensus.ClientSentCompressedMessageBytesPerRPCView,
opencensus.ClientReceivedCompressedMessageBytesPerRPCView,
opencensus.ClientAPILatencyView,
opencensus.ServerStartedRPCsView,
opencensus.ServerCompletedRPCsView,
opencensus.ServerSentCompressedBytesPerRPCView,
opencensus.ServerReceivedCompressedBytesPerRPCView,
opencensus.ServerSentCompressedMessageBytesPerRPCView,
opencensus.ServerReceivedCompressedMessageBytesPerRPCView,
opencensus.ServerLatencyView,
}
)
Expand Down
20 changes: 10 additions & 10 deletions stats/opencensus/client_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ var (
TagKeys: []tag.Key{keyClientMethod},
Aggregation: bytesDistribution,
}
// ClientSentCompressedBytesPerRPCView is the distribution of compressed
// sent bytes per RPC, keyed on method.
ClientSentCompressedBytesPerRPCView = &view.View{
// ClientSentCompressedMessageBytesPerRPCView is the distribution of
// compressed sent message bytes per RPC, keyed on method.
ClientSentCompressedMessageBytesPerRPCView = &view.View{
Measure: clientSentCompressedBytesPerRPC,
Name: "grpc.io/client/sent_compressed_bytes_per_rpc",
Description: "Distribution of sent compressed bytes per RPC, by method.",
Name: "grpc.io/client/sent_compressed_message_bytes_per_rpc",
Description: "Distribution of sent compressed message bytes per RPC, by method.",
TagKeys: []tag.Key{keyClientMethod},
Aggregation: bytesDistribution,
}
Expand All @@ -90,12 +90,12 @@ var (
TagKeys: []tag.Key{keyClientMethod},
Aggregation: bytesDistribution,
}
// ClientReceivedCompressedBytesPerRPCView is the distribution of compressed
// received bytes per RPC, keyed on method.
ClientReceivedCompressedBytesPerRPCView = &view.View{
// ClientReceivedCompressedMessageBytesPerRPCView is the distribution of
// compressed received message bytes per RPC, keyed on method.
ClientReceivedCompressedMessageBytesPerRPCView = &view.View{
Measure: clientReceivedCompressedBytesPerRPC,
Name: "grpc.io/client/received_compressed_bytes_per_rpc",
Description: "Distribution of received compressed bytes per RPC, by method.",
Name: "grpc.io/client/received_compressed_message_bytes_per_rpc",
Description: "Distribution of received compressed message bytes per RPC, by method.",
TagKeys: []tag.Key{keyClientMethod},
Aggregation: bytesDistribution,
}
Expand Down
24 changes: 12 additions & 12 deletions stats/opencensus/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@ func (s) TestAllMetricsOneFunction(t *testing.T) {
ClientCompletedRPCsView,
ServerCompletedRPCsView,
ClientSentBytesPerRPCView,
ClientSentCompressedBytesPerRPCView,
ClientSentCompressedMessageBytesPerRPCView,
ServerSentBytesPerRPCView,
ServerSentCompressedBytesPerRPCView,
ServerSentCompressedMessageBytesPerRPCView,
ClientReceivedBytesPerRPCView,
ClientReceivedCompressedBytesPerRPCView,
ClientReceivedCompressedMessageBytesPerRPCView,
ServerReceivedBytesPerRPCView,
ServerReceivedCompressedBytesPerRPCView,
ServerReceivedCompressedMessageBytesPerRPCView,
ClientSentMessagesPerRPCView,
ServerSentMessagesPerRPCView,
ClientReceivedMessagesPerRPCView,
Expand Down Expand Up @@ -505,11 +505,11 @@ func (s) TestAllMetricsOneFunction(t *testing.T) {
},
},
{
metric: ClientSentCompressedBytesPerRPCView,
metric: ClientSentCompressedMessageBytesPerRPCView,
wantVI: &viewInformation{
aggType: view.AggTypeDistribution,
aggBuckets: bytesDistributionBounds,
desc: "Distribution of sent compressed bytes per RPC, by method.",
desc: "Distribution of sent compressed message bytes per RPC, by method.",
tagKeys: []tag.Key{
cmtk,
},
Expand Down Expand Up @@ -579,11 +579,11 @@ func (s) TestAllMetricsOneFunction(t *testing.T) {
},
},
{
metric: ServerSentCompressedBytesPerRPCView,
metric: ServerSentCompressedMessageBytesPerRPCView,
wantVI: &viewInformation{
aggType: view.AggTypeDistribution,
aggBuckets: bytesDistributionBounds,
desc: "Distribution of sent compressed bytes per RPC, by method.",
desc: "Distribution of sent compressed message bytes per RPC, by method.",
tagKeys: []tag.Key{
smtk,
},
Expand Down Expand Up @@ -653,11 +653,11 @@ func (s) TestAllMetricsOneFunction(t *testing.T) {
},
},
{
metric: ClientReceivedCompressedBytesPerRPCView,
metric: ClientReceivedCompressedMessageBytesPerRPCView,
wantVI: &viewInformation{
aggType: view.AggTypeDistribution,
aggBuckets: bytesDistributionBounds,
desc: "Distribution of received compressed bytes per RPC, by method.",
desc: "Distribution of received compressed message bytes per RPC, by method.",
tagKeys: []tag.Key{
cmtk,
},
Expand Down Expand Up @@ -727,11 +727,11 @@ func (s) TestAllMetricsOneFunction(t *testing.T) {
},
},
{
metric: ServerReceivedCompressedBytesPerRPCView,
metric: ServerReceivedCompressedMessageBytesPerRPCView,
wantVI: &viewInformation{
aggType: view.AggTypeDistribution,
aggBuckets: bytesDistributionBounds,
desc: "Distribution of received compressed bytes per RPC, by method.",
desc: "Distribution of received compressed message bytes per RPC, by method.",
tagKeys: []tag.Key{
smtk,
},
Expand Down
20 changes: 10 additions & 10 deletions stats/opencensus/server_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ var (
TagKeys: []tag.Key{keyServerMethod},
Aggregation: bytesDistribution,
}
// ServerSentCompressedBytesPerRPCView is the distribution of received
// compressed bytes per RPC, keyed on method.
ServerSentCompressedBytesPerRPCView = &view.View{
Name: "grpc.io/server/sent_compressed_bytes_per_rpc",
Description: "Distribution of sent compressed bytes per RPC, by method.",
// ServerSentCompressedMessageBytesPerRPCView is the distribution of
// received compressed message bytes per RPC, keyed on method.
ServerSentCompressedMessageBytesPerRPCView = &view.View{
Name: "grpc.io/server/sent_compressed_message_bytes_per_rpc",
Description: "Distribution of sent compressed message bytes per RPC, by method.",
Measure: serverSentCompressedBytesPerRPC,
TagKeys: []tag.Key{keyServerMethod},
Aggregation: bytesDistribution,
Expand All @@ -87,11 +87,11 @@ var (
TagKeys: []tag.Key{keyServerMethod},
Aggregation: bytesDistribution,
}
// ServerReceivedCompressedBytesPerRPCView is the distribution of sent bytes
// per RPC, keyed on method.
ServerReceivedCompressedBytesPerRPCView = &view.View{
Name: "grpc.io/server/received_compressed_bytes_per_rpc",
Description: "Distribution of received compressed bytes per RPC, by method.",
// ServerReceivedCompressedMessageBytesPerRPCView is the distribution of
// sent compressed message bytes per RPC, keyed on method.
ServerReceivedCompressedMessageBytesPerRPCView = &view.View{
Name: "grpc.io/server/received_compressed_message_bytes_per_rpc",
Description: "Distribution of received compressed message bytes per RPC, by method.",
Measure: serverReceivedCompressedBytesPerRPC,
TagKeys: []tag.Key{keyServerMethod},
Aggregation: bytesDistribution,
Expand Down

0 comments on commit b638faf

Please sign in to comment.