-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat: add the missing xds.authority label #12018
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review comments.
…a as in the existing flow 2. xds: modifies existing tests to account for authority
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit/PR needs more context. Notably, it should include a reference to A78.
@@ -143,7 +143,13 @@ void reportCallbackMetrics(BatchRecorder recorder, XdsClient xdsClient) { | |||
Map<XdsResourceType<?>, Map<String, ResourceMetadata>> metadataByType = | |||
getResourceMetadataCompleted.get(10, TimeUnit.SECONDS); | |||
|
|||
computeAndReportResourceCounts(metadataByType, callback); | |||
ListenableFuture<Map<XdsResourceType<?>, Map<String, String>>> | |||
getResourceAuthorityCompleted = xdsClient.getSubscribedResourcesAuthoritySnapshot(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the data race, but there's still a regular race. The two snapshots may not contain all the same types/resources. We need to either pass the authorities through an existing flow or re-compute it from the resource name.
getResourceAuthorityCompleted = xdsClient.getSubscribedResourcesAuthoritySnapshot(); | ||
|
||
Map<XdsResourceType<?>, Map<String, String>> authorityByType = | ||
getResourceAuthorityCompleted.get(10, TimeUnit.SECONDS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using futures, you'd want to start the operations and only then wait for the completions. That way you only pay the latency cost once.
String cacheState = cacheStateFromResourceStatus(metadata.getStatus(), metadata.isCached()); | ||
resourceCountsByState.compute(cacheState, (k, v) -> (v == null) ? 1 : v + 1); | ||
authorityByState.put(cacheState, authorityByType.get(type).get(resourceName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just randomly assigns authorities to cache states. Authority is another dimension.
This aims to complete the XDS client metrics by adding the remaining grpc.xds.authority metric.