From 31d1ac56c5ab9e106c81422152ab9c0303cb781e Mon Sep 17 00:00:00 2001 From: Reza Karegar Date: Thu, 1 Feb 2024 10:25:41 -0500 Subject: [PATCH 1/3] Define the metrics for collecting per connection error count. --- .../stats/BuiltinMeasureConstants.java | 20 ++++++++ .../bigtable/stats/BuiltinViewConstants.java | 51 ++++++++++++------- 2 files changed, 53 insertions(+), 18 deletions(-) diff --git a/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinMeasureConstants.java b/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinMeasureConstants.java index 2f51204d4b..54c7dd66df 100644 --- a/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinMeasureConstants.java +++ b/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinMeasureConstants.java @@ -29,6 +29,20 @@ class BuiltinMeasureConstants { static final TagKey ZONE = TagKey.create("zone"); static final TagKey CLIENT_UID = TagKey.create("client_uid"); + // Monitored resource TagKeys for gce_instance + static final TagKey GCE_PROJECT_ID = TagKey.create("gce_project_id"); + static final TagKey GCE_INSTANCE_ID = TagKey.create("gce_instance_id"); + static final TagKey GCE_ZONE = TagKey.create("gce_zone"); + + // Monitored resource TagKeys for gke_container + static final TagKey GKE_PROJECT_ID = TagKey.create("gke_project_id"); + static final TagKey GKE_CLUSTER_NAME = TagKey.create("gke_cluster_name"); + static final TagKey GKE_NAMESPACE_ID = TagKey.create("gke_namespace_id"); + static final TagKey GKE_INSTANCE_ID = TagKey.create("gke_instance_id"); + static final TagKey GKE_POD_ID = TagKey.create("gke_pod_id"); + static final TagKey GKE_CONTAINER_NAME = TagKey.create("gke_container_name"); + static final TagKey GKE_ZONE = TagKey.create("gke_zone"); + // Metrics TagKeys static final TagKey APP_PROFILE = TagKey.create("app_profile"); static final TagKey METHOD = TagKey.create("method"); @@ -88,4 +102,10 @@ class BuiltinMeasureConstants { "bigtable.googleapis.com/internal/client/throttling_latencies", "The artificial latency introduced by the client to limit the number of outstanding requests. The publishing of the measurement will be delayed until the attempt trailers have been received.", MILLISECOND); + + static final MeasureLong PER_CONNECTION_ERROR_COUNT = + MeasureLong.create( + "bigtable.googleapis.com/internal/client/per_connection_error_count", + "Distribution of counts of channels per 'error count per minute'.", + COUNT); } diff --git a/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java b/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java index 7c9dc34d78..4dcee28824 100644 --- a/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java +++ b/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java @@ -15,24 +15,7 @@ */ package com.google.cloud.bigtable.stats; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.APPLICATION_LATENCIES; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.APP_PROFILE; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.ATTEMPT_LATENCIES; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.CLIENT_NAME; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.CLUSTER; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.CONNECTIVITY_ERROR_COUNT; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.FIRST_RESPONSE_LATENCIES; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.INSTANCE_ID; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.METHOD; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.OPERATION_LATENCIES; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.PROJECT_ID; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.RETRY_COUNT; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.SERVER_LATENCIES; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.STATUS; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.STREAMING; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.TABLE; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.THROTTLING_LATENCIES; -import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.ZONE; +import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.*; import static io.opencensus.stats.Aggregation.Distribution; import static io.opencensus.stats.Aggregation.Sum; @@ -59,6 +42,13 @@ class BuiltinViewConstants { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0, 100.0))); + private static final Aggregation PER_CONNECTION_ERROR_COUNT_AGGREGATION = + Distribution.create( + BucketBoundaries.create( + ImmutableList.of( + 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0, 2048.0, 4096.0, + 8192.0, 16384.0, 32768.0))); + private static final Aggregation AGGREGATION_COUNT = Sum.create(); static final View OPERATION_LATENCIES_VIEW = @@ -183,4 +173,29 @@ class BuiltinViewConstants { AGGREGATION_WITH_MILLIS_HISTOGRAM, ImmutableList.of( PROJECT_ID, INSTANCE_ID, APP_PROFILE, METHOD, CLIENT_NAME, CLUSTER, ZONE, TABLE)); + + static final View PER_CONNECTION_ERROR_COUNT_VIEW = + View.create( + View.Name.create("bigtable.googleapis.com/internal/client/per_connection_error_count"), + "Distribution of counts of channels per 'error count per minute'.", + PER_CONNECTION_ERROR_COUNT, + PER_CONNECTION_ERROR_COUNT_AGGREGATION, + ImmutableList.of( + // Metric TagKeys + PROJECT_ID, + INSTANCE_ID, + APP_PROFILE, + CLIENT_NAME, + // gce_instance TagKeys + GCE_PROJECT_ID, + GCE_INSTANCE_ID, + GCE_ZONE, + // gke_container TagKeys + GKE_PROJECT_ID, + GKE_CLUSTER_NAME, + GKE_NAMESPACE_ID, + GKE_INSTANCE_ID, + GKE_POD_ID, + GKE_CONTAINER_NAME, + GKE_ZONE)); } From 5bb72053693fdaaec89729e64e82bc2b9280622d Mon Sep 17 00:00:00 2001 From: Reza Karegar Date: Thu, 1 Feb 2024 12:38:33 -0500 Subject: [PATCH 2/3] Update metric fields and buckets. --- .../stats/BuiltinMeasureConstants.java | 14 -------------- .../bigtable/stats/BuiltinViewConstants.java | 19 +++---------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinMeasureConstants.java b/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinMeasureConstants.java index 54c7dd66df..59e7511d41 100644 --- a/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinMeasureConstants.java +++ b/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinMeasureConstants.java @@ -29,20 +29,6 @@ class BuiltinMeasureConstants { static final TagKey ZONE = TagKey.create("zone"); static final TagKey CLIENT_UID = TagKey.create("client_uid"); - // Monitored resource TagKeys for gce_instance - static final TagKey GCE_PROJECT_ID = TagKey.create("gce_project_id"); - static final TagKey GCE_INSTANCE_ID = TagKey.create("gce_instance_id"); - static final TagKey GCE_ZONE = TagKey.create("gce_zone"); - - // Monitored resource TagKeys for gke_container - static final TagKey GKE_PROJECT_ID = TagKey.create("gke_project_id"); - static final TagKey GKE_CLUSTER_NAME = TagKey.create("gke_cluster_name"); - static final TagKey GKE_NAMESPACE_ID = TagKey.create("gke_namespace_id"); - static final TagKey GKE_INSTANCE_ID = TagKey.create("gke_instance_id"); - static final TagKey GKE_POD_ID = TagKey.create("gke_pod_id"); - static final TagKey GKE_CONTAINER_NAME = TagKey.create("gke_container_name"); - static final TagKey GKE_ZONE = TagKey.create("gke_zone"); - // Metrics TagKeys static final TagKey APP_PROFILE = TagKey.create("app_profile"); static final TagKey METHOD = TagKey.create("method"); diff --git a/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java b/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java index 4dcee28824..3083e7ba1c 100644 --- a/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java +++ b/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java @@ -46,8 +46,8 @@ class BuiltinViewConstants { Distribution.create( BucketBoundaries.create( ImmutableList.of( - 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0, 256.0, 512.0, 1024.0, 2048.0, 4096.0, - 8192.0, 16384.0, 32768.0))); + 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 125.0, 250.0, 500.0, 1_000.0, 2_000.0, 4_000.0, + 8_000.0, 16_000.0, 32_000.0, 64_000.0, 128_000.0, 250_000.0, 500_000.0, 1_000_000.0))); private static final Aggregation AGGREGATION_COUNT = Sum.create(); @@ -181,21 +181,8 @@ class BuiltinViewConstants { PER_CONNECTION_ERROR_COUNT, PER_CONNECTION_ERROR_COUNT_AGGREGATION, ImmutableList.of( - // Metric TagKeys PROJECT_ID, INSTANCE_ID, APP_PROFILE, - CLIENT_NAME, - // gce_instance TagKeys - GCE_PROJECT_ID, - GCE_INSTANCE_ID, - GCE_ZONE, - // gke_container TagKeys - GKE_PROJECT_ID, - GKE_CLUSTER_NAME, - GKE_NAMESPACE_ID, - GKE_INSTANCE_ID, - GKE_POD_ID, - GKE_CONTAINER_NAME, - GKE_ZONE)); + CLIENT_NAME)); } From b01de3198bf1edfb17a4f84b20f4b33a415c09ce Mon Sep 17 00:00:00 2001 From: Reza Karegar Date: Thu, 1 Feb 2024 12:42:36 -0500 Subject: [PATCH 3/3] Fix code formatting. --- .../bigtable/stats/BuiltinViewConstants.java | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java b/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java index 3083e7ba1c..06364a2288 100644 --- a/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java +++ b/google-cloud-bigtable-stats/src/main/java/com/google/cloud/bigtable/stats/BuiltinViewConstants.java @@ -46,8 +46,27 @@ class BuiltinViewConstants { Distribution.create( BucketBoundaries.create( ImmutableList.of( - 1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 125.0, 250.0, 500.0, 1_000.0, 2_000.0, 4_000.0, - 8_000.0, 16_000.0, 32_000.0, 64_000.0, 128_000.0, 250_000.0, 500_000.0, 1_000_000.0))); + 1.0, + 2.0, + 4.0, + 8.0, + 16.0, + 32.0, + 64.0, + 125.0, + 250.0, + 500.0, + 1_000.0, + 2_000.0, + 4_000.0, + 8_000.0, + 16_000.0, + 32_000.0, + 64_000.0, + 128_000.0, + 250_000.0, + 500_000.0, + 1_000_000.0))); private static final Aggregation AGGREGATION_COUNT = Sum.create(); @@ -180,9 +199,5 @@ class BuiltinViewConstants { "Distribution of counts of channels per 'error count per minute'.", PER_CONNECTION_ERROR_COUNT, PER_CONNECTION_ERROR_COUNT_AGGREGATION, - ImmutableList.of( - PROJECT_ID, - INSTANCE_ID, - APP_PROFILE, - CLIENT_NAME)); + ImmutableList.of(PROJECT_ID, INSTANCE_ID, APP_PROFILE, CLIENT_NAME)); }