feat(spanner): add support of AFE and GRPC metrics in client-side metrics#12067
feat(spanner): add support of AFE and GRPC metrics in client-side metrics#12067
Conversation
908acc1 to
21036a9
Compare
44b311b to
eb2e763
Compare
olavloite
left a comment
There was a problem hiding this comment.
Is there any way that we could add some more tests for this? E.g. would it be possible to have the mock server return these headers, and then verify that these are correctly being collected by the client?
| var ( | ||
| validDBPattern = regexp.MustCompile("^projects/(?P<project>[^/]+)/instances/(?P<instance>[^/]+)/databases/(?P<database>[^/]+)$") | ||
| validDBPattern = regexp.MustCompile("^projects/(?P<project>[^/]+)/instances/(?P<instance>[^/]+)/databases/(?P<database>[^/]+)$") | ||
| serverTimingPattern = regexp.MustCompile(`([a-zA-Z0-9_-]+);\s*dur=(\d*\.?\d+)`) |
There was a problem hiding this comment.
nit: seems that ".5" will also match in this regex. That is probably fine.
|
@olavloite I have updated the unit test to validate the gfe header from mock Session Create/StreamingRead is captured and should be equal to set value for success response and for failed attempt gfe_error_count is exported. |
57986f5 to
d9cbc4b
Compare
| t.Fatalf("could not add result: %v", err) | ||
| } | ||
| iter := client.Single().Read(context.Background(), "Users", spanner.AllKeys(), []string{"email"}) | ||
| iter := client.Single().Query(ctx, spanner.NewStatement("SELECT email FROM Users")) |
There was a problem hiding this comment.
this is done because StreamingRead mock result not sets the gfe latency header, and in this test we assert/expect missing gfe header count for streaming query
…rics (googleapis#12067) * feat(spanner): add support of AFE and GRPC metrics in client-side metrics * incorporate suggestions * added unit test for GFE latencies/error_count and refactored metric collection
This PR adds GFE/AFE/GRPC Metrics available for Spanner Engineers.
GRPC metrics are disabled as default currently. To enable set
SPANNER_DISABLE_DIRECT_ACCESS_GRPC_BUILTIN_METRICS=falseAFE metrics will be enabled by default if direct path is used
GOOGLE_SPANNER_ENABLE_DIRECT_ACCESS =true