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

Support capturing diagnostics information using DiagnosticSource #446

Open
8 tasks
smolchanovsky opened this issue Jul 17, 2022 · 6 comments
Open
8 tasks
Assignees
Labels

Comments

@smolchanovsky
Copy link
Member

smolchanovsky commented Jul 17, 2022

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:

  • NClient.Transport.Request.Start
  • NClient.Transport.Request.Stop
  • NClient.Resilience.Attempt.Start
  • NClient.Resilience.Attempt.Stop
  • NClient.Exceptions.UnhandledException
  • NClient.Exceptions.TransportException
  • NClient.Exceptions.ValidationException
  • NClient.Exceptions.ArgumentException

Additional links:

  1. A brief introduction to DiagnosticSource
  2. DiagnosticSource User's Guide
  3. DiagnosticSource and DiagnosticListener (docs.microsoft.com)
@JorgChrist
Copy link

Hey! Can I work on this issue?

@smolchanovsky
Copy link
Member Author

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

@smolchanovsky
Copy link
Member Author

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

@JorgChrist
Copy link

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
Copy link
Member Author

smolchanovsky commented Aug 28, 2022

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:

  • NClient.Transport.Request.* events should be added in TransportNClient class, in this method. This class is responsible for executing requests at the transport layer (usually HTTP).
  • NClient.Resilience.Attempt.* events should be added in the same class, but in an other method.
  • NClient.Exceptions.* events should be added in ClientInterceptor class. All client requests begin and end with this class, so all exceptions are intercepted there.

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
Copy link

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 :)

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

No branches or pull requests

2 participants