Diagnostics: Adds gateway hedging suppression marker#5894
Open
orange-dot wants to merge 1 commit into
Open
Conversation
f8495b3 to
bbe0a80
Compare
bbe0a80 to
ce9b0ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #5871.
Adds customer-visible diagnostics for gateway-driven hedging suppression. When the gateway disable flag first suppresses hedging for a client,
CosmosDiagnosticsnow includesdb.cosmosdb.hedging_disabled_by_gateway = true.The marker is intentionally one-shot per gateway true-cycle: it is emitted on the first suppressed request for a client, remains quiet for later suppressed requests while the flag stays true, and is emitted again after the flag cycles back to false and then true.
The marker is emitted only when the gateway suppresses an availability strategy that would otherwise hedge that specific request. The diagnostics contract uses a typed internal boolean trace datum for this marker, so the new field serializes as a JSON boolean without changing the existing fallback behavior for generic
booltrace data.Type of change
Changes
DocumentClient: tracks gateway suppression with a monotonic diagnostics generation instead of a shared bit, so stale requests from an older true-cycle cannot consume the marker for a newer true-cycle; exposes the gateway-suppressed stashed strategy through a small internal accessor.RequestInvokerHandler: emits the diagnostics marker only after gateway suppression is active and the effective availability strategy would hedge the specific request; non-hedgeable requests such as document creates or non-document reads do not consume the marker.TraceWriter: adds an internalBooleanTraceDatumpath for JSON boolean diagnostics while preserving the existing genericboolfallback as string output.Acceptance coverage
db.cosmosdb.hedging_disabled_by_gateway = trueRequestInvokerHandler_FlagTrue_FirstSuppressedRequest_EmitsDiagnosticsOnce; emulator testGatewayDrivenHedgingSuppressionDiagnostics_EmitsOnceAndReEmitsAfterFlagCyclevalidates the customer-visibleCosmosDiagnostics.ToString()outputRequestInvokerHandler_FlagFalse_DoesNotEmitDiagnostics; emulator test covers the initial false/inactive state and the explicit false state after a flag cycleDisabledStrategy()do not consume the markerRequestInvokerHandler_FlagTrue_NoEffectiveStrategy_DoesNotConsumeDiagnosticsMarker;RequestInvokerHandler_FlagTrue_PerRequestDisabledStrategy_DoesNotConsumeDiagnosticsMarkerRequestInvokerHandler_FlagTrue_DocumentCreate_DoesNotConsumeDiagnosticsMarker;RequestInvokerHandler_FlagTrue_NonDocumentRead_DoesNotConsumeDiagnosticsMarkerRequestInvokerHandler_FlagTrue_FirstSuppressedRequest_EmitsDiagnosticsOnce; emulator test verifies the second suppressed request has no markerRequestInvokerHandler_FlagTrueFalseTrue_ReEmitsDiagnosticsAfterFlagCycle; emulator test verifies the second true cycle emits againDocumentClient_ObservedSuppressionThenFlagFalse_DiagnosticMarkerStillConsumableDocumentClient_ObservedSuppressionThenFlagFalseTrue_DoesNotConsumeNewCycleMarkerRequestInvokerHandler_FlagTrue_ConcurrentFirstSuppressedRequests_EmitsDiagnosticsOnceTraceWriterBaselineTests.Serializationbaseline includes typedBooleanTraceDatumas JSON boolean and raw generic bool as string"True"Behavior
db.cosmosdb.hedging_disabled_by_gateway = trueis emittedValidation
The validation focused on the runtime diagnostics path, emulator compile coverage, and the trace serialization contract.
GatewayHedgingOverrideTests: 23/23 passedMicrosoft.Azure.Cosmos.EmulatorTests.csprojbuild: passedGatewayDrivenHedgingSuppressionDiagnostics_EmitsOnceAndReEmitsAfterFlagCycle: passed in the fork emulator validationgit diff --check: cleanChangelog
### Unreleased/#### Features Addedfor the diagnostics/supportability change.