Skip to content
Saar Shen edited this page Jun 9, 2023 · 21 revisions

Welcome to the DotNetDiagnostics wiki!

Understand different parts in this project

Pipeline

  • An infrastructure from inputting, processing to outputting the result. image

  • One pipeline will be responsible for controlling all aspects of a dotnet tools. For example, a pipeline for dotnet-counters.

Triggers

  • A mean for the pipeline to start processing. For example, process startup trigger for dotnet-counters enables dotnet-counters at the beginning of the application.
  • An http endpoint could be treated as a special case of a manual trigger.
  • A pipeline can have multiple triggers.
  • Triggers are easy to extend to hook up with other systems - alert trigger for example.

Sinks

  • A destination for the data. For example, Application Insights sink for dotnet-counters holds the metrics in Application Insights.
  • Multiple sinks could be configured to work simultaneously.
  • Sinks are easy to extend to output data to other systems - Elastic Search for example.

Job dispatchers/matcher runners

  • For scaled applications that has more than 1 instances, an external mechanism is needed to decide which instance get the job to run, and job dispatcher and the counterpart matcher runner is designed to work in that scenario.

  • For example, the AzureBlobJobDispatcher allows dispatch the jobs to an Azure Storage. See How to run dotnet counters in multiple instances for more details.

Build up the pipeline

We use dependency injects to putting up the pipeline by code, for example:

// Start the builder for the pipeline
builder.Services.AddDotNetCounters(pipeline => {
    pipeline.AddProcessStartTrigger()        // Add a trigger to enable dotnet-counters at the beginning of the application
        .AddAzureBlobJobDispatcher()     // Add job dispatcher so that it will work in multiple-instance environment
        .AddLocalFileSink()              // Add a sink of local file
        .AddAzureBlobSink()              // Add a sink of Azure Blob
        .AddApplicationInsightsSink()    // Add a sink of Application Insights.
});  
    
    

// Register services for Application Insights, this is required for the app insights sink to work.
builder.Services.AddApplicationInsightsTelemetry();
var app = builder.Build();
...
app.MapDotNetCounters("/dotnet-counters");  // Expose the manual trigger
app.Run();

And that builds a pipeline like this:

image

For more details about how to use it, check out the wikis below:

Diagnostics Tools Pipeline

Sinks

Dispatchers

JobDispatcher.AzureBlobs