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

Diagnostics Improvements for quorumAckedLSN, CurrentReplicaSetSize, and replicaStatusList #39844

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

tvaron3
Copy link
Contributor

@tvaron3 tvaron3 commented Apr 22, 2024

Description

Diagnostics now has two new fields inside of the storeResult which is quorumAckedLSN and currrentReplicaSetSize. The replicaStatusList field was changed to use the following format, and it should display all the replicas. The attempting means it could have been looked at in the operation that happened. It also includes whether the replica is a primary or secondary now.

"replicaStatusList": { 
  "Attempting": ["25475:P:Connected"],
  "Ignoring": ["nnnnn:S:UnhealthyPending"]
},

The following is an example of a diagnostic now

{"userAgent":"azsdk-java-cosmos/4.59.0-beta.1 Windows11/10.0 JRE/11.0.22","activityId":"e6888d4d-7955-4370-b97e-26b9957d16a4","requestLatencyInMs":148,"requestStartTimeUTC":"2024-04-29T16:42:11.922469800Z","requestEndTimeUTC":"2024-04-29T16:42:12.071245300Z","responseStatisticsList":[{"storeResult":{"storePhysicalAddress":"rntbd://cdb-ms-prod-westus3-be11.documents.azure.com:14412/apps/3bb2924a-2c0f-4ef7-b543-05db443c4511/services/09f6953f-c129-45e5-9bce-96a81219fd90/partitions/b6087803-45b9-410b-83e8-aa2a8ad45d8a/replicas/133588707014983174p/","lsn":4,"quorumAckedLSN":3,"currentReplicaSetSize":4,"globalCommittedLsn":3,"partitionKeyRangeId":"1","isValid":true,"statusCode":200,"subStatusCode":0,"isGone":false,"isNotFound":false,"isInvalidPartition":false,"isThroughputControlRequestRateTooLarge":false,"requestCharge":10.29,"itemLSN":-1,"sessionToken":"1:-1#4","backendLatencyInMs":3.397,"retryAfterInMs":null,"replicaStatusList":{"Ignoring":["14375:S:Unknown","14145:S:Unknown","14362:S:Unknown"],"Attempting":["14412:P:Connected"]},"transportRequestTimeline":[{"eventName":"created","startTimeUTC":"2024-04-29T16:42:11.938173800Z","durationInMilliSecs":0.0},{"eventName":"queued","startTimeUTC":"2024-04-29T16:42:11.938173800Z","durationInMilliSecs":0.0},{"eventName":"channelAcquisitionStarted","startTimeUTC":"2024-04-29T16:42:11.938173800Z","durationInMilliSecs":68.1448},{"eventName":"pipelined","startTimeUTC":"2024-04-29T16:42:12.006318600Z","durationInMilliSecs":19.1533},{"eventName":"transitTime","startTimeUTC":"2024-04-29T16:42:12.025471900Z","durationInMilliSecs":40.3486},{"eventName":"decodeTime","startTimeUTC":"2024-04-29T16:42:12.065820500Z","durationInMilliSecs":2.9058},{"eventName":"received","startTimeUTC":"2024-04-29T16:42:12.068726300Z","durationInMilliSecs":1.5079},{"eventName":"completed","startTimeUTC":"2024-04-29T16:42:12.070234200Z","durationInMilliSecs":0.0}],"rntbdRequestLengthInBytes":615,"rntbdResponseLengthInBytes":526,"requestPayloadLengthInBytes":91,"responsePayloadLengthInBytes":0,"channelStatistics":{"channelId":"857d980a","channelTaskQueueSize":0,"pendingRequestsCount":0,"lastReadTime":"2024-04-29T16:42:10.820852800Z","waitForConnectionInit":false},"serviceEndpointStatistics":{"availableChannels":1,"acquiredChannels":0,"executorTaskQueueSize":0,"inflightRequests":1,"lastSuccessfulRequestTime":"2024-04-29T16:42:10.822Z","lastRequestTime":"2024-04-29T16:42:10.755Z","createdTime":"2024-04-29T16:42:08.516971300Z","isClosed":false,"cerMetrics":{}}},"requestResponseTimeUTC":"2024-04-29T16:42:12.071245300Z","requestStartTimeUTC":"2024-04-29T16:42:11.938173800Z","requestResourceType":"Document","requestOperationType":"Upsert","requestSessionToken":null,"e2ePolicyCfg":null,"excludedRegions":null}],"supplementalResponseStatisticsList":[],"addressResolutionStatistics":{},"regionsContacted":["west us 3"],"retryContext":{"statusAndSubStatusCodes":null,"retryLatency":0,"retryCount":0},"metadataDiagnosticsContext":{"metadataDiagnosticList":null},"serializationDiagnosticsContext":{"serializationDiagnosticsList":[{"serializationType":"ITEM_SERIALIZATION","startTimeUTC":"2024-04-29T16:42:11.923466700Z","endTimeUTC":"2024-04-29T16:42:11.924464500Z","durationInMilliSecs":0.9978},{"serializationType":"PARTITION_KEY_FETCH_SERIALIZATION","startTimeUTC":"2024-04-29T16:42:11.931164700Z","endTimeUTC":"2024-04-29T16:42:11.931164700Z","durationInMilliSecs":0.0}]},"gatewayStatisticsList":[],"samplingRateSnapshot":1.0,"systemInformation":{"usedMemory":"35094 KB","availableMemory":"4159210 KB","systemCpuLoad":"(2024-04-29T16:41:52.844865500Z 100.0%), (2024-04-29T16:41:57.859051100Z 13.6%), (2024-04-29T16:42:02.850706200Z 6.6%), (2024-04-29T16:42:04.585728700Z 12.0%), (2024-04-29T16:42:09.600528100Z 12.4%)","availableProcessors":12},"clientCfgs":{"id":4,"machineId":"uuid:7b6c22d3-dc35-460e-a4eb-cebb8ab2b842","connectionMode":"DIRECT","numberOfClients":3,"excrgns":"[]","clientEndpoints":{"https://tomasvaron-cdb.documents.azure.com:443/":4},"connCfg":{"rntbd":"(cto:PT5S, nrto:PT5S, icto:PT0S, ieto:PT1H, mcpe:130, mrpc:30, cer:true)","gw":"(cps:1000, nrto:PT1M, icto:PT1M, p:false)","other":"(ed: true, cs: false, rv: true)"},"consistencyCfg":"(consistency: null, mm: true, prgns: [])","proactiveInitCfg":"","e2ePolicyCfg":"","sessionRetryCfg":""}}

Fixes #39775 #39762

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@azure-sdk
Copy link
Collaborator

azure-sdk commented Apr 23, 2024

API change check

APIView has identified API level changes in this PR and created following API reviews.

com.azure:azure-cosmos

@tvaron3 tvaron3 marked this pull request as draft April 23, 2024 04:22
@tvaron3 tvaron3 marked this pull request as ready for review April 23, 2024 17:24
Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

Please see comments...

/***
* Attention: This is only used for fault injection to easier decide whether the address is primary address.
* @param primary
*/
public void setPrimary(boolean primary) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is only called right after a Uri is created and removed the fault injection comment because using it now for the diagnostics

@@ -24,6 +24,10 @@ public class Uri {
private volatile Instant lastUnhealthyPendingTimestamp;
private volatile Instant lastTransitionToUnhealthyTimestamp;
private volatile boolean isPrimary;
public static final String ATTEMPTING = "Attempting";
public static final String NOT_ATTEMPTING = "NotAttempting";
Copy link
Member

Choose a reason for hiding this comment

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

Question for the native english speakers :-) - i would prefer "Ignoring" - but if "NotAttempting" better explains it is definitely ok as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also think ignoring is clearer.

@@ -45,6 +46,20 @@ public Mono<Uri> resolvePrimaryUriAsync(RxDocumentServiceRequest request, boolea
});
}

public Mono<Uri> resolvePrimaryUriAsync(RxDocumentServiceRequest request, boolean forceAddressRefresh, Map<Uri, String> replicaStatuses) {
Copy link
Member

Choose a reason for hiding this comment

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

the other resolvePrimaryUriAsync method is only used in tests method? If that is the case, we can remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not only used in tests. It is used when performing a background refresh of the primary address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants