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

EFCore.Cosmos - RequestCharge #20514

Closed
espray opened this issue Apr 3, 2020 · 1 comment
Closed

EFCore.Cosmos - RequestCharge #20514

espray opened this issue Apr 3, 2020 · 1 comment

Comments

@espray
Copy link

espray commented Apr 3, 2020

Finding an operations RUs is vital for optimizing cosmos db
@AndriySvyryd how can I retrieve the RequestCharge for an operation?

-- Describe the solution you'd like --
Ability to add a CosmosRequestHandler. This can be done by CosmosClientOptions.CustomHandlers.Add(handler)

public class LoggingHandler : CosmosRequestHandler
{
  public override async Task<CosmosResponseMessage> SendAsync(CosmosRequestMessage request, CancellationToken cancellationToken)
  {
    Console.WriteLine($"{request.Method.Method} - {request.RequestUri.ToString()}");
    CosmosResponseMessage response = await base.SendAsync(request, cancellationToken);
    Console.WriteLine("Operation done");
    Console.WriteLine((int)response.StatusCode);
    return response;
  }
}

https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.cosmosclientoptions.customhandlers?view=azure-dotnet#Microsoft_Azure_Cosmos_CosmosClientOptions_CustomHandlers

https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.fluent.cosmosclientbuilder.addcustomhandlers?view=azure-dotnet#Microsoft_Azure_Cosmos_Fluent_CosmosClientBuilder_AddCustomHandlers_Microsoft_Azure_Cosmos_RequestHandler___

https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.cosmos.requesthandler?view=azure-dotnet

@ajcvickers
Copy link
Member

Duplicate of #17298

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

No branches or pull requests

2 participants