Interface IApplicationInsightsService
- Namespace
- Quilt4Net.Toolkit.Features.ApplicationInsights
- Assembly
- Quilt4Net.Toolkit.dll
public interface IApplicationInsightsService
Methods
CanConnectAsync(IApplicationInsightsContext)
Task<bool> CanConnectAsync(IApplicationInsightsContext context)
Parameters
contextIApplicationInsightsContext
Returns
GetCountAsync(IApplicationInsightsContext, string, TimeSpan, CancellationToken)
IAsyncEnumerable<CountData> GetCountAsync(IApplicationInsightsContext context, string environment, TimeSpan timeSpan, CancellationToken cancellationToken = default)
Parameters
contextIApplicationInsightsContextenvironmentstringtimeSpanTimeSpancancellationTokenCancellationToken
Returns
GetCpuUtilizationAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)
CPU-busy percentage per host (cloud_RoleInstance) over timeSpan.
Derived from the OpenTelemetry system.cpu.utilization idle reading:
100 * (1 - avg(idle)). Bin size scales with the window (see Quilt4Net.Toolkit.Features.ApplicationInsights.MetricsBinSelector).
IAsyncEnumerable<MetricSample> GetCpuUtilizationAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)
Parameters
contextIApplicationInsightsContexttimeSpanTimeSpancancellationTokenCancellationToken
Returns
GetDetail(IApplicationInsightsContext, string, LogSource, string, TimeSpan)
Task<LogDetails> GetDetail(IApplicationInsightsContext context, string id, LogSource source, string environment, TimeSpan timeSpan)
Parameters
contextIApplicationInsightsContextidstringsourceLogSourceenvironmentstringtimeSpanTimeSpan
Returns
GetDiskCapacityAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)
Per-volume disk capacity (total GB, plus the free/used/reserved breakdown) across
timeSpan. Sourced from system.filesystem.usage by summing the
three states per volume — gives the UI a real "% of capacity" reference for free-space bars
instead of needing to scale them relative to whichever host happens to have the most space.
Series label matches GetDiskFreeAsync(IApplicationInsightsContext, TimeSpan, CancellationToken) so consumers can join the two by
Series / Series.
IAsyncEnumerable<DiskCapacity> GetDiskCapacityAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)
Parameters
contextIApplicationInsightsContexttimeSpanTimeSpancancellationTokenCancellationToken
Returns
GetDiskFreeAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)
Filesystem free (GB) per host+device over timeSpan. Source: OpenTelemetry
system.filesystem.usage with state=free — operators want the "how much room is left"
view, where a line trending toward zero means the disk is filling up. Series label is
{host.name} {device} so multiple volumes on one host show as separate lines. Bin
size scales with the window.
IAsyncEnumerable<MetricSample> GetDiskFreeAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)
Parameters
contextIApplicationInsightsContexttimeSpanTimeSpancancellationTokenCancellationToken
Returns
GetEnvironments(IApplicationInsightsContext)
IAsyncEnumerable<EnvironmentOption> GetEnvironments(IApplicationInsightsContext context)
Parameters
contextIApplicationInsightsContext
Returns
GetLogCountByServiceAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)
Counts log entries per (service × severity × environment × source) across AppTraces,
AppExceptions and AppRequests over timeSpan. Severity is
unified across sources: traces use their own SeverityLevel; exceptions are always
counted as Error; requests use Information when Success is true
and Error otherwise. Service is coalesced from Properties.ApplicationName then
AppRoleName.
No server-side env / source filter — admin UIs typically want every dimension at hand so
flipping a filter checkbox can be done locally without an extra round trip. Pre-filtering
is one .Where away at the call site.
IAsyncEnumerable<LogCountByServiceCell> GetLogCountByServiceAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)
Parameters
contextIApplicationInsightsContexttimeSpanTimeSpancancellationTokenCancellationToken
Returns
GetMeasureAsync(IApplicationInsightsContext, string, TimeSpan, CancellationToken)
IAsyncEnumerable<MeasureData> GetMeasureAsync(IApplicationInsightsContext context, string environment, TimeSpan timeSpan, CancellationToken cancellationToken = default)
Parameters
contextIApplicationInsightsContextenvironmentstringtimeSpanTimeSpancancellationTokenCancellationToken
Returns
GetMemoryUtilizationAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)
Memory-used percentage per host (cloud_RoleInstance) over timeSpan.
Source: OpenTelemetry system.memory.utilization with state=used. Bin size scales with
the window (see Quilt4Net.Toolkit.Features.ApplicationInsights.MetricsBinSelector).
IAsyncEnumerable<MetricSample> GetMemoryUtilizationAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)
Parameters
contextIApplicationInsightsContexttimeSpanTimeSpancancellationTokenCancellationToken
Returns
GetNetworkThroughputAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)
Network throughput (MB/s) per host (cloud_RoleInstance) over timeSpan.
Computed as the per-bin delta of system.network.io divided by the bin duration; negative
deltas (host restart / counter reset) are dropped. Bin size scales with the window.
IAsyncEnumerable<MetricSample> GetNetworkThroughputAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)
Parameters
contextIApplicationInsightsContexttimeSpanTimeSpancancellationTokenCancellationToken
Returns
GetSummaries(IApplicationInsightsContext, string, TimeSpan, CancellationToken)
IAsyncEnumerable<SummarySubset> GetSummaries(IApplicationInsightsContext context, string environment, TimeSpan timeSpan, CancellationToken cancellationToken = default)
Parameters
contextIApplicationInsightsContextenvironmentstringtimeSpanTimeSpancancellationTokenCancellationToken
Returns
GetSummary(IApplicationInsightsContext, string, LogSource, string, TimeSpan, int)
Get the latest items for a single fingerprint. Capped at maxItems
(default 100) — a fingerprint can match 100k+ rows over the lookback window, and
returning all of them is what made detail/summary navigation hang. Items are ordered
newest-first; only the top maxItems are returned.
Task<SummaryData> GetSummary(IApplicationInsightsContext context, string fingerprint, LogSource source, string environment, TimeSpan timeSpan, int maxItems = 100)
Parameters
contextIApplicationInsightsContextfingerprintstringsourceLogSourceenvironmentstringtimeSpanTimeSpanmaxItemsint
Returns
GetVersionMatrixAsync(IApplicationInsightsContext, TimeSpan?, bool)
Get the latest version of each (application, environment) combination
seen in the workspace. Tries the Quilt4NetStartup-tagged fast path
first, then falls back to a general scan for cells the fast path
did not cover. Pass null for lookback to
query the workspace's full retention.
IAsyncEnumerable<VersionMatrixCell> GetVersionMatrixAsync(IApplicationInsightsContext context, TimeSpan? lookback = null, bool forceRefresh = false)
Parameters
contextIApplicationInsightsContextlookbackTimeSpan?forceRefreshbool
Returns
SearchAsync(IApplicationInsightsContext, string, string, TimeSpan, SeverityLevel, CancellationToken)
IAsyncEnumerable<LogItem> SearchAsync(IApplicationInsightsContext context, string environment, string text, TimeSpan timeSpan, SeverityLevel minSeverityLevel = SeverityLevel.Verbose, CancellationToken cancellationToken = default)
Parameters
contextIApplicationInsightsContextenvironmentstringtextstringtimeSpanTimeSpanminSeverityLevelSeverityLevelcancellationTokenCancellationToken
Returns
SearchByCorrelationIdAsync(IApplicationInsightsContext, string, TimeSpan)
Returns all telemetry rows whose OperationId or
Properties.CorrelationId matches correlationId.
Searches AppTraces, AppExceptions, and AppRequests over the supplied
lookback window.
IAsyncEnumerable<LogItem> SearchByCorrelationIdAsync(IApplicationInsightsContext context, string correlationId, TimeSpan timeSpan)
Parameters
contextIApplicationInsightsContextcorrelationIdstringtimeSpanTimeSpan
Returns
SearchByIncidentIdAsync(IApplicationInsightsContext, string, TimeSpan)
Returns all telemetry rows whose Properties.IncidentId matches
incidentId. Searches AppTraces, AppExceptions, and
AppRequests over the supplied lookback window. Used by the MCP
quilt4net.lookup_incident tool to map a user-facing incident id
(e.g. from a UI alert) back to the structured log entry that produced it.
IAsyncEnumerable<LogItem> SearchByIncidentIdAsync(IApplicationInsightsContext context, string incidentId, TimeSpan timeSpan)
Parameters
contextIApplicationInsightsContextincidentIdstringtimeSpanTimeSpan