Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit 94e930a

Browse files
committed
add TODO comments
1 parent ae8e16d commit 94e930a

3 files changed

Lines changed: 17 additions & 11 deletions

File tree

google-cloud-firestore/src/main/java/com/google/cloud/firestore/telemetry/BuiltinMetricsProvider.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ OpenTelemetry getOpenTelemetry() {
7070
private Map<String, String> createStaticAttributes() {
7171
Map<String, String> staticAttributes = new HashMap<>();
7272
staticAttributes.put(METRIC_ATTRIBUTE_KEY_CLIENT_UID, ClientIdentifier.getClientUid());
73-
74-
staticAttributes.put(METRIC_ATTRIBUTE_KEY_LIBRARY_NAME, FIRESTORE_LIBRARY_NAME);
7573
staticAttributes.put(METRIC_ATTRIBUTE_KEY_SERVICE, FIRESTORE_SERVICE);
7674

7775
return staticAttributes;

google-cloud-firestore/src/main/java/com/google/cloud/firestore/telemetry/EnabledMetricsUtil.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,16 @@ private OpenTelemetry getDefaultOpenTelemetryInstance() throws IOException {
156156
MonitoredResourceDescription monitoredResourceMapping =
157157
new MonitoredResourceDescription(FIRESTORE_RESOURCE_TYPE, FIRESTORE_RESOURCE_LABELS);
158158

159+
// TODO: uncomment the configuration below
159160
MetricExporter metricExporter =
160161
GoogleCloudMetricExporter.createWithConfiguration(
161162
MetricConfiguration.builder()
162163
.setProjectId(firestoreOptions.getProjectId())
164+
// .setPrefix("firestore.googleapis.com")
163165
// Ignore library info as it is collected by the metric attributes as well
164166
.setInstrumentationLibraryLabelsEnabled(false)
165-
.setMonitoredResourceDescription(monitoredResourceMapping)
166-
// .setUseServiceTimeSeries(true)
167+
// .setMonitoredResourceDescription(monitoredResourceMapping)
168+
// .setUseServiceTimeSeries(true)
167169
.build());
168170
metricReader = PeriodicMetricReader.create(metricExporter);
169171
sdkMeterProviderBuilder.registerMetricReader(metricReader);
@@ -176,7 +178,8 @@ Attributes createResourceAttributes() {
176178
Attributes.builder()
177179
.put(RESOURCE_KEY_LOCATION, detectClientLocation())
178180
.put(RESOURCE_KEY_PROJECT, firestoreOptions.getProjectId())
179-
.put(RESOURCE_KEY_DATABASE, firestoreOptions.getDatabaseId());
181+
.put(RESOURCE_KEY_DATABASE, firestoreOptions.getDatabaseId())
182+
.put(RESOURCE_KEY_UID, ClientIdentifier.getClientUid());
180183

181184
String pkgVersion = this.getClass().getPackage().getImplementationVersion();
182185
attributesBuilder.put(

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,39 +60,44 @@ public interface TelemetryConstants {
6060
String GAX_METER_NAME = OpenTelemetryMetricsRecorder.GAX_METER_NAME;
6161
String FIRESTORE_LIBRARY_NAME = "com.google.cloud.firestore";
6262

63-
String FIRESTORE_SERVICE = "firestore V1";
63+
String FIRESTORE_SERVICE = "firestore v1";
6464

6565
// Monitored resource
66+
// TODO: check the monitored resource type with jimit
6667
String FIRESTORE_RESOURCE_TYPE =
67-
"firestore.googleapis.com/Database"; // or maybe "firestore.googleapis.com/Database"
68+
// "datastore_request";
69+
// "datastore_client_raw";
70+
"firestore.googleapis.com/Database";
6871
String RESOURCE_KEY_LOCATION = "location";
6972
String RESOURCE_KEY_INSTANCE = "instance";
7073
String RESOURCE_KEY_DATABASE = "database";
7174
String RESOURCE_KEY_PROJECT = "project";
75+
String RESOURCE_KEY_UID = "uid";
76+
7277
Set<String> FIRESTORE_RESOURCE_LABELS =
7378
ImmutableSet.of(
7479
RESOURCE_KEY_LOCATION,
7580
RESOURCE_KEY_INSTANCE,
7681
RESOURCE_KEY_DATABASE,
77-
RESOURCE_KEY_PROJECT);
82+
RESOURCE_KEY_PROJECT,
83+
RESOURCE_KEY_UID);
7884

7985
// Metric attribute keys for labels
8086
String METRIC_ATTRIBUTE_KEY_METHOD = "method";
8187
String METRIC_ATTRIBUTE_KEY_STATUS = "status";
82-
String METRIC_ATTRIBUTE_KEY_LIBRARY_NAME = "library_name";
8388
String METRIC_ATTRIBUTE_KEY_CLIENT_UID = "client_uid";
8489
String METRIC_ATTRIBUTE_KEY_SERVICE = "service";
8590
Set<String> COMMON_ATTRIBUTES =
8691
ImmutableSet.of(
8792
METRIC_ATTRIBUTE_KEY_CLIENT_UID,
88-
METRIC_ATTRIBUTE_KEY_LIBRARY_NAME,
8993
METRIC_ATTRIBUTE_KEY_STATUS,
9094
METRIC_ATTRIBUTE_KEY_METHOD,
9195
METRIC_ATTRIBUTE_KEY_SERVICE,
9296
RESOURCE_KEY_LOCATION,
9397
RESOURCE_KEY_INSTANCE,
9498
RESOURCE_KEY_DATABASE,
95-
RESOURCE_KEY_PROJECT);
99+
RESOURCE_KEY_PROJECT,
100+
RESOURCE_KEY_UID);
96101

97102
// Metric names
98103
String METRIC_NAME_OPERATION_LATENCY = "operation_latency";

0 commit comments

Comments
 (0)