diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs index 61441a1a4c..969a921a5e 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs @@ -398,7 +398,7 @@ public ChangeFeedEstimatorFeedResponse( public override string IndexMetrics => null; - internal override string QueryAdvice => null; + public override string QueryAdvice => null; internal override RequestMessage RequestMessage => null; @@ -435,7 +435,7 @@ public ChangeFeedEstimatorEmptyFeedResponse(ITrace trace) public override string IndexMetrics => null; - internal override string QueryAdvice => null; + public override string QueryAdvice => null; internal override RequestMessage RequestMessage => null; diff --git a/Microsoft.Azure.Cosmos/src/Query/v3Query/FeedResponse.cs b/Microsoft.Azure.Cosmos/src/Query/v3Query/FeedResponse.cs index 816bb7ff6d..33da048e5e 100644 --- a/Microsoft.Azure.Cosmos/src/Query/v3Query/FeedResponse.cs +++ b/Microsoft.Azure.Cosmos/src/Query/v3Query/FeedResponse.cs @@ -60,7 +60,7 @@ protected FeedResponse() /// /// The query advice. /// - internal virtual string QueryAdvice => null; + public virtual string QueryAdvice => null; /// /// Request Message for this feed response diff --git a/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryResponse.cs b/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryResponse.cs index ef993ac79d..40886bf1f8 100644 --- a/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryResponse.cs +++ b/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryResponse.cs @@ -204,7 +204,7 @@ private QueryResponse( private Lazy QueryAdviceText { get; } - internal override string QueryAdvice => this.QueryAdviceText?.Value; + public override string QueryAdvice => this.QueryAdviceText?.Value; public override IEnumerator GetEnumerator() { diff --git a/Microsoft.Azure.Cosmos/src/Query/v3Query/ReadFeedResponse.cs b/Microsoft.Azure.Cosmos/src/Query/v3Query/ReadFeedResponse.cs index fb017b7cf0..ad84b52b1a 100644 --- a/Microsoft.Azure.Cosmos/src/Query/v3Query/ReadFeedResponse.cs +++ b/Microsoft.Azure.Cosmos/src/Query/v3Query/ReadFeedResponse.cs @@ -38,7 +38,7 @@ internal ReadFeedResponse( public override string IndexMetrics { get; } - internal override string QueryAdvice { get; } + public override string QueryAdvice { get; } internal override RequestMessage RequestMessage { get; } diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs index 3f5a3f6fe2..48a66f719d 100644 --- a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs @@ -123,8 +123,28 @@ public class QueryRequestOptions : RequestOptions /// The results will be displayed in FeedResponse.QueryAdvice. Please note that this options will incur overhead, so it should be /// enabled only when debugging queries. /// + /// + /// + /// page = itemQuery.ReadNextAsync().Result; + /// + /// // query advice is the same across pages so we only need to log it once + /// if (queryAdvice == null) + /// { + /// queryAdvice = page.QueryAdvice; + /// } + /// } + /// ]]> + /// + /// /// - internal bool? PopulateQueryAdvice { get; set; } + public bool? PopulateQueryAdvice { get; set; } /// /// Gets or sets the consistency level required for the request in the Azure Cosmos DB service. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json index 16796b74e9..2bccdd548f 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json @@ -4830,10 +4830,20 @@ "Attributes": [], "MethodInfo": "System.String get_IndexMetrics();IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.String get_QueryAdvice()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.String get_QueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.String IndexMetrics": { "Type": "Property", "Attributes": [], "MethodInfo": "System.String IndexMetrics;CanRead:True;CanWrite:False;System.String get_IndexMetrics();IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String QueryAdvice": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "System.String QueryAdvice;CanRead:True;CanWrite:False;System.String get_QueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -7577,11 +7587,23 @@ ], "MethodInfo": "System.Nullable`1[System.Boolean] get_PopulateIndexMetrics();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Nullable`1[System.Boolean] get_PopulateQueryAdvice()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[System.Boolean] get_PopulateQueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Nullable`1[System.Boolean] PopulateIndexMetrics": { "Type": "Property", "Attributes": [], "MethodInfo": "System.Nullable`1[System.Boolean] PopulateIndexMetrics;CanRead:True;CanWrite:True;System.Nullable`1[System.Boolean] get_PopulateIndexMetrics();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PopulateIndexMetrics(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Nullable`1[System.Boolean] PopulateQueryAdvice": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "System.Nullable`1[System.Boolean] PopulateQueryAdvice;CanRead:True;CanWrite:True;System.Nullable`1[System.Boolean] get_PopulateQueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Nullable`1[System.Int32] get_MaxBufferedItemCount()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ @@ -7715,6 +7737,13 @@ ], "MethodInfo": "Void set_PopulateIndexMetrics(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Void set_QueryTextMode(Microsoft.Azure.Cosmos.QueryTextMode)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ @@ -8768,11 +8797,23 @@ ], "MethodInfo": "System.Nullable`1[System.Boolean] get_PopulateIndexMetrics();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Nullable`1[System.Boolean] get_PopulateQueryAdvice()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[System.Boolean] get_PopulateQueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Nullable`1[System.Boolean] PopulateIndexMetrics": { "Type": "Property", "Attributes": [], "MethodInfo": "System.Nullable`1[System.Boolean] PopulateIndexMetrics;CanRead:True;CanWrite:True;System.Nullable`1[System.Boolean] get_PopulateIndexMetrics();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PopulateIndexMetrics(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Nullable`1[System.Boolean] PopulateQueryAdvice": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "System.Nullable`1[System.Boolean] PopulateQueryAdvice;CanRead:True;CanWrite:True;System.Nullable`1[System.Boolean] get_PopulateQueryAdvice();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.Nullable`1[System.Int32] get_MaxBufferedItemCount()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ @@ -8906,6 +8947,13 @@ ], "MethodInfo": "Void set_PopulateIndexMetrics(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_PopulateQueryAdvice(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Void set_QueryTextMode(Microsoft.Azure.Cosmos.QueryTextMode)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [