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

Draft Proposal for Diagnostics Client Library (a.k.a. "Runtime Client Library") #574

Merged
merged 34 commits into from
Nov 13, 2019

Conversation

sywhang
Copy link
Contributor

@sywhang sywhang commented Oct 18, 2019

This is a draft proposal for the diagnostics client library - which we've been calling the "runtime client library" till now - (yes the rename is part of the proposal but I really want us to stop calling it the runtime client library :p).

Some of the sample code is still left TODO, but I think this is at a point where we can openly start discussing about the design choices.

cc @noahfalk @josalem @mikem8361 @tommcdon

Copy link
Contributor

@josalem josalem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did an initial pass through the proposal. I like what I see! It's definitely cleaner than what we currently have.

documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this together Sung, hope the feedback is useful!

documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
documentation/design-docs/diagnostics-client-library.md Outdated Show resolved Hide resolved
@noahfalk
Copy link
Member

cc @davidfowl @shirhatti

@davidfowl
Copy link
Member

The lack of var in the sample code makes this feel like java.

using System.IO;
using System.Threading.Task;

public void TraceProcessForDuration(int processId, int duration, string traceName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make duration a TimeSpan

source.Process();
}
// NOTE: This exception does not currently exist. It is something that needs to be added to TraceEvent.
catch (EventStreamException e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to create a new exception or could we just catch the exception that caused the stream reading error? I don't want to hide the underlying issue by having the EventSource simply say "something went wrong".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By EventSource do you mean EventPipeEventSource?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops! Yeah, I do.

Copy link
Contributor Author

@sywhang sywhang Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we just catch the exception that caused the stream reading error

This part is a little ambiguous. I think of this EventStreamException as an exception that gets thrown by EventPipeEventSource when there is an exception while reading the stream because either the stream was shut down by something. There could be other exception, like incorrect or corrupted payload, which can probably be encapsulated by a different exception class.

I don't want to hide the underlying issue

The sample is meant to capture the intention to add more exception classes to EventPipeEventSource to make it not throw general Exception to prevent exactly this kind of things from happening.

///<summary>
/// Stops the given session
///</summary>
public void Stop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without a constructor or initialize method, how will Stop() know what session id to send?

Copy link
Contributor Author

@sywhang sywhang Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructor is internal. _sessionId is a private member - the goal here is to provide as simple of an API as possible for the end user. Internal states like sessionId is either internal/private and won't be exposed unless we see a need for it.

@sywhang sywhang merged commit a38b048 into dotnet:master Nov 13, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Jan 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants