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

chore(spanner): add support of client side native metrics collection and export #10419

Merged
merged 25 commits into from
Sep 25, 2024

Conversation

rahul2393
Copy link
Contributor

@rahul2393 rahul2393 commented Jun 24, 2024

This PR adds built-in metrics to the Go spanner client library. This will introduce below metrics for the consumers of this library .

This feature is not currently available for customers to use. Once GA'ed consumers of this library will start getting these metrics in the MetricsExplorer



Attempt Latency The latency of an RPC attempt. Useful for monitoring the general health of the applicationWith attributes like “Token Expiry”, “Status” etc, this metric can help us troubleshoot a wide range of issues.
Attempt Count The count of RPC attempts Useful for monitoring trafficUseful for deriving “Error Rate” with status attributes
Operation Latency The total end-to-end latency across all request attempts, including retries. Useful for monitoring the general health of the applicationThe combination of this metric and Attempt Latency can help us troubleshoot connectivity issues.
Operation Count The count of operations Useful for monitoring trafficUseful for deriving “Error Rate” with status labelThe combination of this metric and Attempt Count can be used for deriving Retry Count

@rahul2393 rahul2393 requested review from a team as code owners June 24, 2024 06:45
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Jun 24, 2024
@rahul2393 rahul2393 marked this pull request as draft June 24, 2024 06:45
@rahul2393 rahul2393 force-pushed the client_side_metrics branch 2 times, most recently from 26dc986 to faf5cdb Compare June 25, 2024 05:30
@rahul2393 rahul2393 force-pushed the client_side_metrics branch 2 times, most recently from 765633c to ee86524 Compare June 25, 2024 06:09
@rahul2393 rahul2393 force-pushed the client_side_metrics branch 2 times, most recently from 2d2b5a6 to 23ca77a Compare August 16, 2024 11:52
@rahul2393 rahul2393 marked this pull request as ready for review August 16, 2024 11:53
@rahul2393 rahul2393 force-pushed the client_side_metrics branch 2 times, most recently from c507ea3 to 7ba036f Compare August 22, 2024 20:51
Copy link
Contributor

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

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

Please separate non-standard library imports from standard library imports.

Comment on lines 17 to 22
import (
"cloud.google.com/go/spanner"
"context"
"github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Stylistically in Go, please separate standard library imports from other imports so

import (
	"context"

	"cloud.google.com/go/spanner"
	"github.com/googleapis/gax-go/v2"
	"google.golang.org/api/option"
)

Comment on lines 24 to 25
"github.com/google/uuid"
"github.com/googleapis/gax-go/v2"
"go.opentelemetry.io/otel/metric/noop"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move these downloads out of the standard library imports block.

package spanner

import (
"cloud.google.com/go/spanner/internal"
Copy link
Contributor

Choose a reason for hiding this comment

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

This too, please move down.

@rahul2393 rahul2393 force-pushed the client_side_metrics branch 5 times, most recently from 95db2af to 1affbec Compare August 22, 2024 21:17
@rahul2393
Copy link
Contributor Author

rahul2393 commented Aug 22, 2024

@igorbernstein2 @codyoss
Can you please help providing review here.

Note: PR message is chore intentionally since we want this feature disabled(will be done in next commit here) but other things can be reviewed.

@rahul2393 rahul2393 force-pushed the client_side_metrics branch from 1affbec to fae02f9 Compare August 22, 2024 21:28

clientName = fmt.Sprintf("go-spanner v%v", internal.Version)

bucketBounds = []float64{0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 8.0, 10.0, 13.0, 16.0, 20.0, 25.0, 30.0, 40.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

See internal discussion - please sync with Surbhi on the default buckets we use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rahul2393 rahul2393 requested a review from odeke-em August 23, 2024 03:39
@rahul2393
Copy link
Contributor Author

rahul2393 commented Aug 23, 2024

[Update]
Integration tests passed: http://sponge2/3febe9d1-660f-4743-a310-69195e7ccbc5

@rahul2393 rahul2393 requested review from harshachinta and removed request for odeke-em August 23, 2024 05:02
Copy link
Contributor

@zchee zchee left a comment

Choose a reason for hiding this comment

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

@rahul2393 I'm not a Googler, so sorry for my external review.
I made a few comments about the code style, but it nits.

spanner/client.go Outdated Show resolved Hide resolved
spanner/client.go Show resolved Hide resolved
Copy link
Contributor

@hengfengli hengfengli left a comment

Choose a reason for hiding this comment

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

LGTM.

@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 24, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 24, 2024
@rahul2393 rahul2393 merged commit 6fbd687 into main Sep 25, 2024
13 checks passed
@rahul2393 rahul2393 deleted the client_side_metrics branch September 25, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants