Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
30a7011
enable 4 metrics from GAX
milaGGL Aug 14, 2024
ed85413
format
milaGGL Aug 16, 2024
57084c4
add default otel
milaGGL Aug 21, 2024
571c095
format
milaGGL Aug 21, 2024
f4b8416
move constants out
milaGGL Aug 22, 2024
da0fe82
format
milaGGL Aug 23, 2024
61432eb
add additional attributes
milaGGL Aug 26, 2024
b5bfe5c
Merge branch 'main' into mila/client-side-metrics-demo
milaGGL Aug 26, 2024
f0a029d
add attributes to gax metrics
milaGGL Aug 27, 2024
5456038
Update BuiltinMetricsConstants.java
milaGGL Sep 4, 2024
5efaba6
remove current metrics implementation
milaGGL Sep 9, 2024
c0b4cc1
add custom exporter, add latency recorder
milaGGL Sep 11, 2024
3979331
use 2 otel instances
milaGGL Sep 18, 2024
a9d08b5
set custom apiTracerFactory to gax
milaGGL Sep 20, 2024
029bd8c
Merge branch 'main' into mila/client-side-metrics-demo2
milaGGL Sep 23, 2024
50e05fb
fix opentelemtry dependency version conflict issue
milaGGL Sep 23, 2024
53cd48a
use enabled/disabled style
milaGGL Sep 24, 2024
7adb9d6
modify access modifiers
milaGGL Sep 24, 2024
690e4ee
format
milaGGL Sep 24, 2024
e6f8ba6
rename boolean
milaGGL Sep 26, 2024
c4ca4ae
Merge branch 'main' into mila/client-side-metrics-demo2
milaGGL Sep 27, 2024
887221d
chore: generate libraries at Fri Sep 27 19:25:02 UTC 2024
cloud-java-bot Sep 27, 2024
a2c715a
Update pom.xml
milaGGL Sep 27, 2024
ed78182
resolve comments from proto
milaGGL Oct 1, 2024
e0d46be
e2E latency for runTransaction
milaGGL Oct 3, 2024
a72a685
Merge branch 'main' into mila/client-side-metrics-demo2
milaGGL Oct 4, 2024
92c83c1
chore: generate libraries at Fri Oct 4 14:44:19 UTC 2024
cloud-java-bot Oct 4, 2024
c5137c1
remove noise
milaGGL Oct 4, 2024
63b5bd3
reformat code
milaGGL Oct 4, 2024
ac424a6
re-format code
milaGGL Oct 7, 2024
52f428f
add documentations/comments
milaGGL Oct 8, 2024
c06b2cb
remove logger.info
milaGGL Oct 8, 2024
daf9fbe
record AggregationQuery firstResponseLatency
milaGGL Oct 10, 2024
1999ff7
Update BuiltinMetricsProvider.java
milaGGL Oct 10, 2024
81e349b
Merge branch 'main' into mila/client-side-metrics-demo2
milaGGL Oct 16, 2024
f4e36d9
resolve comments
milaGGL Oct 16, 2024
05e8efb
Update pom.xml
milaGGL Oct 16, 2024
b0b1687
remove duplicated tracing dependency
milaGGL Oct 16, 2024
4abbcf0
add opentelemetry-sdk-metrics dependency
milaGGL Oct 17, 2024
328855d
adjust end-to-end latency in streaming queries
milaGGL Oct 19, 2024
5e1fb4b
fix clirr error
milaGGL Oct 21, 2024
4fa8874
add exportBuiltinMetricsToGoogleCloudMonitoring flag
milaGGL Oct 23, 2024
7deb0d6
Merge branch 'main' into mila/client-side-metrics-demo2
milaGGL Oct 29, 2024
637f878
Merge branch 'main' into mila/client-side-metrics-demo2
milaGGL Nov 4, 2024
8480fa8
Update clirr-ignored-differences.xml
milaGGL Nov 4, 2024
ef9baa8
add internalStream clirr change back
milaGGL Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
resolve comments
  • Loading branch information
milaGGL committed Oct 16, 2024
commit f4e36d964f6e4296aff09e0c4fc92cf909e8b144

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,17 @@
@BetaApi
public class FirestoreOpenTelemetryOptions {
private final boolean tracingEnabled;
private final boolean metricsEnabled;
private final @Nullable OpenTelemetry openTelemetry;

FirestoreOpenTelemetryOptions(Builder builder) {
this.tracingEnabled = builder.tracingEnabled;
this.metricsEnabled = builder.metricsEnabled;
this.openTelemetry = builder.openTelemetry;
}

public boolean isTracingEnabled() {
return tracingEnabled;
}

public boolean isMetricsEnabled() {
return metricsEnabled;
}

public OpenTelemetry getOpenTelemetry() {
return openTelemetry;
}
Expand All @@ -63,20 +57,15 @@ public static class Builder {

private boolean tracingEnabled;

private boolean metricsEnabled;

@Nullable private OpenTelemetry openTelemetry;

private Builder() {
tracingEnabled = false;
// TODO(metrics): set this to default on
metricsEnabled = false;
openTelemetry = null;
}

private Builder(FirestoreOpenTelemetryOptions options) {
this.tracingEnabled = options.tracingEnabled;
this.metricsEnabled = options.metricsEnabled;
this.openTelemetry = options.openTelemetry;
}

Expand All @@ -96,18 +85,6 @@ public FirestoreOpenTelemetryOptions.Builder setTracingEnabled(boolean tracingEn
return this;
}

/**
* Sets whether client side metrics should be enabled.
*
* @param metricsEnabled Whether client side metrics should be enabled.
*/
// TODO: change this to public when the feature is ready
@Nonnull
private FirestoreOpenTelemetryOptions.Builder setMetricsEnabled(boolean metricsEnabled) {
this.metricsEnabled = metricsEnabled;
return this;
}

/**
* Sets the {@link OpenTelemetry} to use with this Firestore instance. If telemetry collection
* is enabled, but an `OpenTelemetry` is not provided, the Firestore SDK will attempt to use the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.google.cloud.TransportOptions;
import com.google.cloud.firestore.spi.v1.FirestoreRpc;
import com.google.cloud.firestore.spi.v1.GrpcFirestoreRpc;
import com.google.cloud.firestore.telemetry.CompositeApiTracerFactory;
import com.google.cloud.firestore.telemetry.MetricsUtil;
import com.google.cloud.firestore.v1.FirestoreSettings;
import com.google.cloud.grpc.GrpcTransportOptions;
Expand Down Expand Up @@ -110,18 +111,15 @@ protected String getDefaultHost() {
return FirestoreDefaults.INSTANCE.getHost();
}

@InternalApi
@Override
public ApiTracerFactory getApiTracerFactory() {
return createApiTracerFactory();
}

private ApiTracerFactory createApiTracerFactory() {
List<ApiTracerFactory> apiTracerFactories = new ArrayList<>();
// Prefer any direct ApiTracerFactory that might have been set on the builder.
if (super.getApiTracerFactory() != null) {
apiTracerFactories.add(super.getApiTracerFactory());
}
// Add Metrics Tracer factory if built in metrics are enabled.
// Add Metrics Tracer factory if built-in metrics are enabled.
metricsUtil.addMetricsTracerFactory(apiTracerFactories);

if (apiTracerFactories.isEmpty()) {
Expand Down Expand Up @@ -152,7 +150,7 @@ com.google.cloud.firestore.telemetry.TraceUtil getTraceUtil() {
}

@Nonnull
public com.google.cloud.firestore.telemetry.MetricsUtil getMetricsUtil() {
com.google.cloud.firestore.telemetry.MetricsUtil getMetricsUtil() {
return metricsUtil;
}

Expand Down Expand Up @@ -354,7 +352,7 @@ protected FirestoreOptions(Builder builder) {
? builder.databaseId
: FirestoreDefaults.INSTANCE.getDatabaseId();

// set metrics util after database ID is set
// Set up the `MetricsUtil` instance after the database ID has been set.
this.metricsUtil = MetricsUtil.getInstance(this);

if (builder.channelProvider == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
package com.google.cloud.firestore.telemetry;

import static com.google.cloud.firestore.telemetry.TelemetryConstants.FIRESTORE_METER_NAME;
import static com.google.cloud.firestore.telemetry.TelemetryConstants.METRIC_KEY_CLIENT_UID;
import static com.google.cloud.firestore.telemetry.TelemetryConstants.METRIC_KEY_LIBRARY_NAME;
import static com.google.cloud.firestore.telemetry.TelemetryConstants.METRIC_KEY_LIBRARY_VERSION;
import static com.google.cloud.firestore.telemetry.TelemetryConstants.METRIC_ATTRIBUTE_KEY_CLIENT_UID;
import static com.google.cloud.firestore.telemetry.TelemetryConstants.METRIC_ATTRIBUTE_KEY_LIBRARY_NAME;
import static com.google.cloud.firestore.telemetry.TelemetryConstants.METRIC_ATTRIBUTE_KEY_LIBRARY_VERSION;
import static com.google.cloud.firestore.telemetry.TelemetryConstants.METRIC_NAME_END_TO_END_LATENCY;
import static com.google.cloud.firestore.telemetry.TelemetryConstants.METRIC_NAME_FIRST_RESPONSE_LATENCY;
import static com.google.cloud.firestore.telemetry.TelemetryConstants.METRIC_PREFIX;
Expand Down Expand Up @@ -50,7 +50,7 @@ class BuiltinMetricsProvider {
private final Map<String, String> staticAttributes;

private static final String MILLISECOND_UNIT = "ms";
private static final String FIRESTORE_LIBRARY_NAME = "java_firestore";
private static final String FIRESTORE_LIBRARY_NAME = "com.google.cloud.firestore";

public BuiltinMetricsProvider(OpenTelemetry openTelemetry) {
this.openTelemetry = openTelemetry;
Expand Down Expand Up @@ -111,11 +111,11 @@ private void configureSDKLayerMetrics() {

private Map<String, String> createStaticAttributes() {
Map<String, String> staticAttributes = new HashMap<>();
staticAttributes.put(METRIC_KEY_CLIENT_UID.getKey(), ClientIdentifier.getClientUid());
staticAttributes.put(METRIC_KEY_LIBRARY_NAME.getKey(), FIRESTORE_LIBRARY_NAME);
staticAttributes.put(METRIC_ATTRIBUTE_KEY_CLIENT_UID.getKey(), ClientIdentifier.getClientUid());
staticAttributes.put(METRIC_ATTRIBUTE_KEY_LIBRARY_NAME.getKey(), FIRESTORE_LIBRARY_NAME);
String pkgVersion = this.getClass().getPackage().getImplementationVersion();
if (pkgVersion != null) {
staticAttributes.put(METRIC_KEY_LIBRARY_VERSION.getKey(), pkgVersion);
staticAttributes.put(METRIC_ATTRIBUTE_KEY_LIBRARY_VERSION.getKey(), pkgVersion);
}
return staticAttributes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.lang.management.ManagementFactory;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.UUID;

/** A utility class for retrieving a unique client identifier (CLIENT_UID) */
Expand Down Expand Up @@ -51,7 +50,7 @@ private static String generateClientUid() {
private static String getHostName() {
try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
} catch (Exception e) {
return "localhost";
}
}
Expand Down
Loading
Loading