nclient / NClient

:dizzy: NClient is an automatic type-safe .Net HTTP client that allows you to call web service API methods using annotated interfaces or controllers without boilerplate code.
Apache License 2.0
43 stars 11 forks source link

Using Activity for requests #453

Open smolchanovsky opened 1 year ago

smolchanovsky commented 1 year ago

This allows to collect more telemetry about the request for monitoring and investigation of problems. This will be helpful for usage of NClient, as well as for the development and debugging of the library.

Considering two user cases, I suggest making two types of activities: public and internal.

  1. One public activity is enough. It will show the execution time of the client's method. It is important to measure the execution of the interface method, not just interceptor. This can probably be done with ProcessingAsyncInterceptor<TState>, which should be used here.
  2. Ideally, each type of provider should have its own activity, but this is not required yet, so I suggest adding only one. It will measure the execution time of the transport request that occurs here.

Additional links:

  1. Basic information about Activity: https://docs.microsoft.com/en-us/dotnet/core/diagnostics/distributed-tracing-concepts
  2. Usage example: https://jimmybogard.com/activity-enrichment-in-asp-net-core-6-0/
parthvnp commented 1 year ago

@smolchanovsky Happy to work on this issue if help is still needed!

smolchanovsky commented 1 year ago

Hi @parthvnp ! It will be very cool if you do it =) Assigned the issue to you