Skip to content

Commit da3f901

Browse files
committed
chore: Clean up PR
1 parent 0a0d897 commit da3f901

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/telemetry/BuiltInDatastoreMetricsProvider.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
*/
5151
class BuiltInDatastoreMetricsProvider {
5252

53-
public static final BuiltInDatastoreMetricsProvider INSTANCE =
54-
new BuiltInDatastoreMetricsProvider();
53+
static final BuiltInDatastoreMetricsProvider INSTANCE = new BuiltInDatastoreMetricsProvider();
5554

5655
private static final Logger logger =
5756
Logger.getLogger(BuiltInDatastoreMetricsProvider.class.getName());

java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/telemetry/DatastoreCloudMonitoringExporter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ static class CachedMetricsClient {
124124
* responses and can mask the real failure reason.
125125
*
126126
* <p>{@code createTimeSeries} is used instead of {@code createServiceTimeSeries} because the
127-
* Firestore namespace in Cloud Monitoring has not yet been deployed as a service resource. Once
128-
* the namespace is available, this should be migrated to {@code createServiceTimeSeries} for
129-
* correct quota and resource attribution.
127+
* Firestore namespace in Cloud Monitoring (b/405457573) has not yet been deployed as a service
128+
* resource. Once the namespace is available, this should be migrated to {@code
129+
* createServiceTimeSeries} for correct quota and resource attribution.
130130
*
131131
* @param projectId the GCP project ID where metrics will be exported.
132132
* @param credentials the credentials used to authenticate with Cloud Monitoring.

java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/telemetry/DatastoreCloudMonitoringExporterUtils.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,27 @@ static List<TimeSeries> convertToDatastoreTimeSeries(
8484

8585
// Metrics should already been filtered for Gax and Datastore related ones
8686
for (MetricData metricData : collection) {
87+
// TODO(b/405457573): The monitored resource is currently written to `global` because the
88+
// Firestore
89+
// namespace in Cloud Monitoring has not been deployed yet. Once the namespace is available,
90+
// database_id and location labels should be added here using RESOURCE_LABEL_DATABASE_ID
91+
// and RESOURCE_LABEL_LOCATION respectively.
92+
8793
// Map OTel resource attributes to the specific monitored resource labels.
8894
MonitoredResource.Builder monitoredResourceBuilder =
8995
MonitoredResource.newBuilder().setType(DATASTORE_RESOURCE_TYPE);
9096

9197
Attributes resourceAttributes = metricData.getResource().getAttributes();
9298
String resourceProjectId = resourceAttributes.get(TelemetryConstants.PROJECT_ID_KEY);
93-
String resourceDatabaseId = resourceAttributes.get(TelemetryConstants.DATABASE_ID_KEY);
94-
String resourceLocation = resourceAttributes.get(TelemetryConstants.LOCATION_ID_KEY);
99+
// String resourceDatabaseId =
100+
// resourceAttributes.get(TelemetryConstants.DATABASE_ID_KEY);
101+
// String resourceLocation = resourceAttributes.get(TelemetryConstants.LOCATION_ID_KEY);
95102

96103
if (resourceProjectId != null) {
97104
monitoredResourceBuilder.putLabels(
98105
TelemetryConstants.RESOURCE_LABEL_PROJECT_ID, resourceProjectId);
99106
}
100107

101-
// TODO: The monitored resource is currently written to `global` because the Datastore
102-
// namespace in Cloud Monitoring has not been deployed yet. Once the namespace is available,
103-
// database_id and location labels should be added here using RESOURCE_LABEL_DATABASE_ID
104-
// and RESOURCE_LABEL_LOCATION respectively.
105-
106108
// Convert each point in the metric data to a TimeSeries.
107109
metricData.getData().getPoints().stream()
108110
.map(

java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/telemetry/TelemetryConstants.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
@InternalApi
3434
public class TelemetryConstants {
3535

36-
// The Firestore namespace has not been deployed yet. Must target the custom namespace
37-
// until this is implemented.
36+
// TODO(b/405457573): The Firestore namespace has not been deployed yet. Must target the
37+
// custom namespace until this is implemented.
3838
public static final String METRIC_PREFIX = "custom.googleapis.com/internal/client";
3939
public static final String DATASTORE_METER_NAME = "java-datastore";
4040

@@ -63,17 +63,16 @@ public class TelemetryConstants {
6363
// GAX-emitted metrics for the built-in Cloud Monitoring export pipeline.
6464
public static final Set<String> GAX_METRICS = GAX_METRIC_NAME_MAP.keySet();
6565

66-
// The subset of GAX_METRICS that are histograms (latency metrics). Explicit enumeration here
67-
// avoids fragile name-suffix matching (endsWith("latency")) in view registration logic.
66+
// The subset of GAX_METRICS that are histograms (e.g. latency metrics)
6867
public static final Set<String> GAX_HISTOGRAM_METRICS =
6968
ImmutableSet.of(METRIC_NAME_SHORT_OPERATION_LATENCY, METRIC_NAME_SHORT_ATTEMPT_LATENCY);
7069

7170
// Monitored resource type for Cloud Monitoring
7271
public static final String DATASTORE_RESOURCE_TYPE = "global";
7372

7473
// Resource label keys for the monitored resource
75-
// The Firestore namespace has not been deployed yet. Must target the global
76-
// Monitored Resource until this is implemented.
74+
// TODO(b/405457573): The Firestore namespace has not been deployed yet. Must
75+
// target the global Monitored Resource until this is implemented.
7776
public static final String RESOURCE_LABEL_PROJECT_ID = "project_id";
7877
public static final String RESOURCE_LABEL_DATABASE_ID = "database_id";
7978
public static final String RESOURCE_LABEL_LOCATION = "location";

0 commit comments

Comments
 (0)