-
Notifications
You must be signed in to change notification settings - Fork 307
Adding EventSource events to Hosting #883
Comments
Will you add additional EventSource instrumentation for Request start/end? I thought the guidance is to use DiagnosticSource since it has a bridge to EventSource anyway?! |
We're definitely not doing this everywhere 😆 We're adding these particular event source data because they provide value to us for performance work. We've added DiagnosticSource and Logging at other times because it provides value in those cases. Each of these systems is optimized for a few particular things |
DiagnosticSource is great - I'm using it in my upcoming OpenTracing instrumentation! I'm just wondering because the DiagnosticSource events seems to have the same information. What do you see as use cases for EventSource vs DiagnosticSource vs. DiagnosticSource->EventSource bridge? |
Down at the bottom is a dump of my design notes from a conversation around logging/diagnostic source (back when it was In terms of how we are using it, event source is for us, logging is for all of you, and diagnostic source is for partners. We intend to use event source with etw/dtrace/etc to do performance and reliability work. As such we're primarily interested in using it for things that we can write tooling around. We're starting with the most obvious things and will add more as we find cases where we need it. I think of event source as very similar to logging in a few ways.
Event source can even include a human-readable message if you so desire. In a way that's similar to logging, we will use event source to "bookend" things like a request start/stop to provide context. Regarding DiagnosticSource, Lou and I took a walk and thought about what an dreamy technology would look like for a partner like Glimpse or MiniProfiler. Basically an event bus with proxy generation support. The event bus part made it into CoreFx and we ship the proxy part as a standalone. There's more about it in the design notes, but basically we provide a lot of context and state in our DS notifications. The consumer decides what information is relevant and they collect it. I haven't personally played with the ds -> es bridge. We're generally using DS to provide highly structured objects that aren't really suitable for use with something like ETW. Warning Design Notes DumpSo we've got two diagnostics systems, Logging ( ComparisonLogging usually looks like: logger.LogVerbose(
"Skipped content negotiation as content type '{ContentType}' is explicitly set for the response.",
ContentTypes[0]); Logging sometimes looks like: using (_logger.BeginScope("ActionId: {ActionId}", actionDescriptor.Id))
{
_logger.LogVerbose("Executing action {ActionDisplayName}", actionDescriptor.DisplayName);
...
} Telemetry Source looks like:
So what's the difference?There is a major difference of course in format. Logging is always human-readable text, optionally with key-value pairs to support processing with tools. Telemetry is always complex objects, it would be rare to see a string sent to telemetry at all. At its most bare-bones, logging is always something that could be used by a human pattern-matcher to interpret a serial set of events or solve a problem. Each event in a log has a clean meaning, it has to state a fact -- Telemetry data is often free of any interpretation or inherent meaning - if it were stating a fact it wouldn't be very insightful -- The usage of the data provider also differs. Logging data, with key-value pairs is persisted either to a file, or a database of some kind. With a passing nod to filtering by verbosity... a logging sink is generally interested in all events rather than specific events. Ultimately to use the logging data, an adminstrator is likely doing BI by performing queries over key-value data or troubleshooting by looking for a root cause of a failure in the event stream. In either case, the logging statements in code specify what data is available in a fixed set. A listener may choose to dial up or down the verbosity per-component, but the onus is always on the application developer to determine what events and data bear the most significance. Telemetry data doesn't specify any format for persistance and isn't friendly to generalized storage and querying. Telemetry data is always used by tools, and those tools register interest in specific events that are meaningful for the type of analysis they provide. For consuming telemetry data, the tool author is in control. A telemetry event provides all of the useful context data, and the tool interpreting it decides what pieces of the data are relevant for analysis. A few general conclusions:
GuidanceUse logging for significant results of framework processing - Ex: Use logging to provide context around user-code - Ex: creating a scope for the action in MVC We decide what to log in the framework. We're responsible for determining what's useful for troubleshooting. Use telemetry in significant stages of framework processing - Ex: before/after action in MVC
It's not wrong to use telemetry to record a significant framework result - Ex: searching for a view in MVC
Telemetry events aren't useful without a partner signed up to build tooling. Don't eagerly add Telemetry without a significant and realistic tooling scenario commited. |
Events
@davidfowl @rynowak @shirhatti
The text was updated successfully, but these errors were encountered: