Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mila/client side metrics demo2 #1840

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from
Draft

Conversation

milaGGL
Copy link
Contributor

@milaGGL milaGGL commented Sep 19, 2024

No description provided.

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: firestore Issues related to the googleapis/java-firestore API. labels Sep 19, 2024
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Sep 20, 2024
static final String FIRESTORE_LIBRARY_NAME = "firestore_java";

// TODO: change to firestore.googleapis.com
public static final String METER_NAME = "custom.googleapis.com/internal/client";
Copy link
Contributor Author

@milaGGL milaGGL Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opentelemetry uses dot separation in metrics naming, while monarch uses slash separation. exporting the built-in metrics to other backends might raise naming conflict.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could have named the metrics with dot seperation, use view to reformat it with slash separation in the default OTEL instance for monarch. But the metrics from Gax uses slash already, using dot separation inside firestore doesn't solves the problem.

// that cannot be tracked client side.
return new ServerSideTransactionRunner<>(this, updateFunction, transactionOptions).run();
MetricsContext metricsContext =
getOptions().getMetricsUtil().createMetricsContext("RunTransaction");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some of the function names are not in SPAN_NAME.. list. add them on.

@@ -97,6 +104,10 @@ public ApiFuture<AggregateQuerySnapshot> get() {
@Nonnull
public ApiFuture<ExplainResults<AggregateQuerySnapshot>> explain(ExplainOptions options) {
TraceUtil.Span span = getTraceUtil().startSpan(TraceUtil.SPAN_NAME_AGGREGATION_QUERY_GET);

MetricsContext metricsContext =
getMetricsUtil().createMetricsContext(TraceUtil.SPAN_NAME_AGGREGATION_QUERY_GET);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics shares the same SPAN_NAME for most of the cases, but it should not directly grab and use. Move the constants out to a shared file/class.

@@ -249,6 +250,9 @@ public void onResponse(BatchGetDocumentsResponse response) {
DocumentReference documentReference;
DocumentSnapshot documentSnapshot;

// TODO(metrics): record first_response_latency here. Need to come up with a way to
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some methods in this calls should have added monitoring info, like recursiveDelete, getAll, runTransaction. discuss with Ehsan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/java-firestore API. size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants