Skip to content

Commit

Permalink
Rename methods and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf committed Jun 7, 2022
1 parent 3655af2 commit f4a7bfb
Show file tree
Hide file tree
Showing 7 changed files with 308 additions and 368 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,24 @@

import static io.opencensus.stats.Measure.MeasureLong;

import com.google.api.core.InternalApi;
import io.opencensus.tags.TagKey;

@InternalApi("For internal use only")
public class BuiltinMeasureConstants {
/** Built-in metrics that will be readable under bigtable.googleapis.com/client namespace */
class BuiltinMeasureConstants {
// TagKeys
public static final TagKey PROJECT_ID = TagKey.create("project_id");
public static final TagKey INSTANCE_ID = TagKey.create("instance_id");
public static final TagKey APP_PROFILE = TagKey.create("app_profile");
public static final TagKey METHOD = TagKey.create("method");
public static final TagKey STREAMING = TagKey.create("streaming");
public static final TagKey STATUS = TagKey.create("status");
public static final TagKey CLIENT_NAME = TagKey.create("client_name");
public static final TagKey CLIENT_ID = TagKey.create("client_id");
static final TagKey PROJECT_ID = TagKey.create("project_id");
static final TagKey INSTANCE_ID = TagKey.create("instance_id");
static final TagKey APP_PROFILE = TagKey.create("app_profile");
static final TagKey METHOD = TagKey.create("method");
static final TagKey STREAMING = TagKey.create("streaming");
static final TagKey STATUS = TagKey.create("status");
static final TagKey CLIENT_NAME = TagKey.create("client_name");
static final TagKey CLIENT_ID = TagKey.create("client_id");

// Monitored resource TagKeys
public static final TagKey TABLE = TagKey.create("table");
public static final TagKey CLUSTER = TagKey.create("cluster");
public static final TagKey ZONE = TagKey.create("zone");
static final TagKey TABLE = TagKey.create("table");
static final TagKey CLUSTER = TagKey.create("cluster");
static final TagKey ZONE = TagKey.create("zone");

// Units
private static final String COUNT = "1";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@
import static com.google.cloud.bigtable.stats.BuiltinMeasureConstants.ZONE;
import static io.opencensus.stats.Aggregation.Distribution;

import com.google.api.core.InternalApi;
import com.google.common.collect.ImmutableList;
import io.opencensus.stats.Aggregation;
import io.opencensus.stats.BucketBoundaries;
import io.opencensus.stats.View;

@InternalApi("For internal use only")
public class BuiltinViewConstants {
/** Create built-in metrics views under bigtable.googleapis.com/internal/client namespace */
class BuiltinViewConstants {
private static final Aggregation AGGREGATION_WITH_MILLIS_HISTOGRAM =
Distribution.create(
BucketBoundaries.create(
Expand All @@ -67,8 +66,7 @@ public class BuiltinViewConstants {
100.0, 150.0, 200.0, 250.0, 300.0, 400.0, 500.0, 650.0, 800.0, 1000.0, 2000.0,
5000.0, 10000.0, 20000.0, 50000.0, 75000.0, 100000.0)));

// TODO: move project id, instance id to monitored resource
public static final View OPERATION_LATENCIES_VIEW =
static final View OPERATION_LATENCIES_VIEW =
View.create(
View.Name.create("bigtable.googleapis.com/internal/client/operation_latencies"),
"Total time until final operation success or failure, including retries and backoff.",
Expand All @@ -86,7 +84,7 @@ public class BuiltinViewConstants {
ZONE,
TABLE));

public static final View ATTEMPT_LATENCIES_VIEW =
static final View ATTEMPT_LATENCIES_VIEW =
View.create(
View.Name.create("bigtable.googleapis.com/internal/client/attempt_latencies"),
"Client observed latency per RPC attempt.",
Expand All @@ -104,7 +102,7 @@ public class BuiltinViewConstants {
ZONE,
TABLE));

public static final View RETRY_COUNT_VIEW =
static final View RETRY_COUNT_VIEW =
View.create(
View.Name.create("bigtable.googleapis.com/internal/client/retry_count"),
"The number of additional RPCs sent after the initial attempt.",
Expand All @@ -121,7 +119,7 @@ public class BuiltinViewConstants {
ZONE,
TABLE));

public static final View FIRST_RESPONSE_LATENCIES_VIEW =
static final View FIRST_RESPONSE_LATENCIES_VIEW =
View.create(
View.Name.create("bigtable.googleapis.com/internal/client/first_response_latencies"),
"Latency from operation start until the response headers were received. The publishing of the measurement will be delayed until the attempt response has been received.",
Expand All @@ -138,7 +136,7 @@ public class BuiltinViewConstants {
ZONE,
TABLE));

public static final View SERVER_LATENCIES_VIEW =
static final View SERVER_LATENCIES_VIEW =
View.create(
View.Name.create("bigtable.googleapis.com/internal/client/server_latencies"),
"The latency measured from the moment that the RPC entered the Google data center until the RPC was completed.",
Expand All @@ -156,7 +154,7 @@ public class BuiltinViewConstants {
ZONE,
TABLE));

public static final View CONNECTIVITY_ERROR_COUNT_VIEW =
static final View CONNECTIVITY_ERROR_COUNT_VIEW =
View.create(
View.Name.create("bigtable.googleapis.com/internal/client/connectivity_error_count"),
"Number of requests that failed to reach the Google datacenter. (Requests without google response headers).",
Expand All @@ -173,7 +171,7 @@ public class BuiltinViewConstants {
ZONE,
TABLE));

public static final View APPLICATION_LATENCIES_VIEW =
static final View APPLICATION_LATENCIES_VIEW =
View.create(
View.Name.create("bigtable.googleapis.com/internal/client/application_latencies"),
"The latency of the client application consuming available response data.",
Expand All @@ -190,7 +188,7 @@ public class BuiltinViewConstants {
ZONE,
TABLE));

public static final View THROTTLING_LATENCIES_VIEW =
static final View THROTTLING_LATENCIES_VIEW =
View.create(
View.Name.create("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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.opencensus.stats.View;
import io.opencensus.stats.ViewManager;

/** For registering built-in metric views */
@InternalApi("For internal use only")
public class BuiltinViews {
private static StatsWrapper statsWrapper;
Expand Down
Loading

0 comments on commit f4a7bfb

Please sign in to comment.