/// <summary> /// Constructs a new instance of <see cref="AspNetMetricSource" />. /// </summary> public AspNetMetricSource(IDiagnosticsCollector diagnosticsCollector, MetricSourceOptions options) : base(options) { const string MicrosoftAspNetCoreHostingEventSourceName = "Microsoft.AspNetCore.Hosting"; diagnosticsCollector.AddSource( new EventPipeProvider( MicrosoftAspNetCoreHostingEventSourceName, EventLevel.Informational, arguments: new Dictionary <string, string>() { { "EventCounterIntervalSec", "5" } } ) ); void AddCounterCallback(string eventName, string name, string unit, string description) { var counter = AddCounter(name, unit, description); diagnosticsCollector.AddCounterCallback(MicrosoftAspNetCoreHostingEventSourceName, eventName, counter.Increment); } void AddGaugeCallback(string eventName, string name, string unit, string description) { var gauge = AddSamplingGauge(name, unit, description); diagnosticsCollector.AddGaugeCallback(MicrosoftAspNetCoreHostingEventSourceName, eventName, gauge.Record); } AddCounterCallback("requests-per-sec", "dotnet.kestrel.requests.per_sec", "requests/sec", "Requests per second"); AddGaugeCallback("total-requests", "dotnet.kestrel.requests.total", "requests", "Total requests"); AddGaugeCallback("current-requests", "dotnet.kestrel.requests.current", "requests", "Currently executing requests"); AddGaugeCallback("failed-requests", "dotnet.kestrel.requests.failed", "requests", "Failed requests"); }
public RuntimeServices(INanoContainer container, ISImplHostBuilder hostBuilder, IModuleManager moduleManager, IDiagnosticsCollector diagnostics, RuntimeFlags runtimeFlags) { BootContainer = container; HostBuilder = hostBuilder; ModuleManager = moduleManager; Diagnostics = diagnostics; Flags = runtimeFlags; }
public DiagnosticsHost(IHost host, IModuleManager moduleManager, IBootSequenceFactory bootSequenceFactory, IDiagnosticsCollector diagnostics, RuntimeFlags runtimeFlags, ILogger <DiagnosticsHost> logger) { _host = host; _moduleManager = moduleManager; _bootSequenceFactory = bootSequenceFactory; _diagnostics = diagnostics; _runtimeFlags = runtimeFlags; _logger = logger; }
public DiagnosticsHostBuilder(ISImplHostBuilder hostBuilder, IModuleManager moduleManager, IBootSequenceFactory bootSequenceFactory, IDiagnosticsCollector diagnostics, RuntimeFlags runtimeFlags, ILogger <DiagnosticsHost> logger) { _hostBuilder = hostBuilder; _moduleManager = moduleManager; _bootSequenceFactory = bootSequenceFactory; _diagnostics = diagnostics; _runtimeFlags = runtimeFlags; _logger = logger; _diagnostics.RegisterLapTime("HostBuilder created"); }
/// <summary> /// Constructs a new instance of <see cref="RuntimeMetricSource" />. /// </summary> public RuntimeMetricSource(IDiagnosticsCollector diagnosticsCollector, MetricSourceOptions options) : base(options) { const string SystemRuntimeEventSourceName = "System.Runtime"; diagnosticsCollector.AddSource( new EventPipeProvider( SystemRuntimeEventSourceName, EventLevel.Informational, arguments: new Dictionary <string, string>() { { "EventCounterIntervalSec", "5" } } ) ); void AddCounterCallback(string eventName, string name, string unit, string description) { var counter = AddCounter(name, unit, description); diagnosticsCollector.AddCounterCallback(SystemRuntimeEventSourceName, eventName, counter.Increment); Add(counter); } void AddGaugeCallback(string eventName, string name, string unit, string description) { var gauge = AddSamplingGauge(name, unit, description); diagnosticsCollector.AddGaugeCallback(SystemRuntimeEventSourceName, eventName, gauge.Record); Add(gauge); } AddGaugeCallback("cpu-usage", "dotnet.cpu.usage", "percent", "% CPU usage"); AddGaugeCallback("working-set", "dotnet.mem.working_set", "bytes", "Working set for the process"); // GC AddCounterCallback("gen-0-gc-count", "dotnet.mem.collections.gen0", "collections", "Number of gen-0 collections"); AddCounterCallback("gen-1-gc-count", "dotnet.mem.collections.gen1", "collections", "Number of gen-1 collections"); AddCounterCallback("gen-2-gc-count", "dotnet.mem.collections.gen2", "collections", "Number of gen-2 collections"); AddGaugeCallback("gen-0-size", "dotnet.mem.size.gen0", "bytes", "Total number of bytes in gen-0"); AddGaugeCallback("gen-1-size", "dotnet.mem.size.gen1", "bytes", "Total number of bytes in gen-1"); AddGaugeCallback("gen-2-size", "dotnet.mem.size.gen2", "bytes", "Total number of bytes in gen-2"); AddGaugeCallback("gc-heap-size", "dotnet.mem.size.heap", "bytes", "Total number of bytes across all heaps"); AddGaugeCallback("loh-size", "dotnet.mem.size.loh", "bytes", "Total number of bytes in the LOH"); AddCounterCallback("alloc-rate", "dotnet.mem.allocation_rate", "bytes/sec", "Allocation Rate (Bytes / sec)"); // thread pool AddGaugeCallback("threadpool-thread-count", "dotnet.threadpool.count", "threads", "Number of threads in the threadpool"); AddGaugeCallback("threadpool-queue-length", "dotnet.threadpool.queue_length", "workitems", "Number of work items queued to the threadpool"); AddGaugeCallback("active-timer-count", "dotnet.timers.count", "timers", "Number of active timers"); }
/// <summary> /// Constructs a new instance of <see cref="AspNetMetricSet" />. /// </summary> public AspNetMetricSet(IDiagnosticsCollector diagnosticsCollector) { _diagnosticsCollector = diagnosticsCollector; }
/// <summary> /// Constructs a new instance of <see cref="RuntimeMetricSet" />. /// </summary> public RuntimeMetricSet(IDiagnosticsCollector diagnosticsCollector) { _diagnosticsCollector = diagnosticsCollector; }