feat(bigtable): populate attempt_latencies2 via peer info#14245
feat(bigtable): populate attempt_latencies2 via peer info#14245sushanb wants to merge 1 commit intogoogleapis:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new metric attempt_latencies2 to capture attempt latencies with additional transport-related dimensions from peer info. The changes look mostly good, but there's an issue in how the transport region and zone are being populated, which would lead to incorrect metric data. I've left a comment with a suggestion to fix it.
| mt.currOp.currAttempt.setTransportRegion(peerInfo.GetApplicationFrontendZone()) | ||
| mt.currOp.currAttempt.setTransportZone(peerInfo.GetApplicationFrontendZone()) |
There was a problem hiding this comment.
Both transportRegion and transportZone are being set to the same value from peerInfo.GetApplicationFrontendZone(). This is incorrect. The region should be extracted from the zone string. For example, if the zone is us-central1-b, the region should be us-central1.
You can extract the region by taking the substring before the last hyphen. Please also remember to add import "strings" to the file.
mt.currOp.currAttempt.setTransportZone(peerInfo.GetApplicationFrontendZone())
zone := peerInfo.GetApplicationFrontendZone()
region := zone
if i := strings.LastIndex(zone, "-"); i != -1 {
region = zone[:i]
}
mt.currOp.currAttempt.setTransportRegion(region)
No description provided.