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

Support capturing diagnostics information using DiagnosticSource #446

Open smolchanovsky opened 2 years ago

smolchanovsky commented 2 years ago

DiagnosticSource is a tool that will allow client users to subscribe to events and use them to log and send metrics. As an example, we can take the Elastic client.

Sample list of events:

Additional links:

  1. A brief introduction to DiagnosticSource
  2. DiagnosticSource User's Guide
  3. DiagnosticSource and DiagnosticListener (docs.microsoft.com)
JorgChrist commented 1 year ago

Hey! Can I work on this issue?

smolchanovsky commented 1 year ago

Hi @JorgChrist ! Sure :) I think you'll need ClientInterceptor.cs class. Write if you have any questions, I will be glad to help

smolchanovsky commented 1 year ago

Hello, @JorgChrist! Can I help you with something? Or did you not want to take this issue?

JorgChrist commented 1 year ago

Hey, @smolchanovsky, sorry for the late reply. I do need some guidance actually.

I know how DiagnosticSource works for the most part and how it's implemented but I'm confused about where shall I implement it in the project!

Sorry, I know this is a newbie problem but I haven't dealt with big projects without guidance before.

smolchanovsky commented 1 year ago

Hi, @JorgChrist! The project has really become quite large, it seems I need to work on a guide for contributors to make it clearer. Unfortunately, I can't do it right now, because I can't do it fast, but I have good news: you know how DiagnosticSource works, which means you're halfway there :)

I will briefly describe where I would add events:

Thus, it is enough to focus on just two classes: ClientInterceptor and TransportNClient. If you need help or you want me to tell you in more detail how these classes work, write, I will be glad to help.

JorgChrist commented 1 year ago

Hey @smolchanovsky. Thank you very much for taking the time to explain this! I'm on it and I'll get back to you with feedback when I make some progress :)