-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
spanner: panic on native metrics #11080
Comments
@rahul2393 Can you please help triage this? |
I have succeeded to reproduce the panic. package main
import (
"context"
"testing"
"cloud.google.com/go/spanner"
"cloud.google.com/go/spanner/spannertest"
"github.com/samber/lo"
"google.golang.org/api/option"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
func TestReproduce(t *testing.T) {
// success if true
clientConf := spanner.ClientConfig{DisableNativeMetrics: false}
ctx := context.Background()
server := lo.Must(spannertest.NewServer("localhost:0"))
conn := lo.Must(grpc.NewClient(server.Addr, grpc.WithTransportCredentials(insecure.NewCredentials())))
cli := lo.Must(spanner.NewClientWithConfig(ctx,
"projects/fake-project/instances/fake-instance/databases/fake-database", clientConf, option.WithGRPCConn(conn)))
tx := lo.Must(spanner.NewReadWriteStmtBasedTransaction(ctx, cli))
defer tx.Rollback(ctx)
}
|
I have also noticed the native metrics is enabled as default even if there is no Cloud Monitoring permission, especially integration test. I don't prefer to enable native metrics when |
Thanks @apstndb for reporting the issue.
The PR is created to fix the panic case, it will log a warning message of insufficient permissions when exporting metrics without any other impact. Let me know if you think the patch is not sufficent. |
Thank you for fixing the panic! |
Thanks for the feedback, we do export instance, client_location, and other identifiers as attributes when exporting the metrics which can help you distinguish between the sources. |
I've found another pattern to fail user code, it requires default credentials for metric client even if it uses Cloud Spanner Emulator in testcontainers. It still be reproducible in v1.72.0. |
@apstndb Can you elaborate more, what is the issue you are seeing, failure logs or replication code can help me fix it |
I am now AFK, so I can't make minimum reproducible code but I have encountered in this PR.
|
@apstndb Can you help approve the workflow here apstndb/execspansql#32, want to check if fix fixes the test. |
It seems that Go test have succeeded. |
I have found the client built in metrics(#10419, #10998) can panic in some condition.
Client
Spanner
Environment
go version go1.23.2 darwin/arm64
Code and Dependencies
I can't find minimum reproducing code, but I can reproduce it in cloudspannerecosystem/spanner-cli.
Reproducing branch
Only do
go get cloud.google.com/go/[email protected]
apstndb/spanner-cli#1
Workaround
Use
DisableNativeMetrics: true
.apstndb/spanner-cli#2
Expected behavior
Client built in metrics don't break user code.
The text was updated successfully, but these errors were encountered: