Table of Contents

Interface IApplicationInsightsService

Namespace
Quilt4Net.Toolkit.Features.ApplicationInsights
Assembly
Quilt4Net.Toolkit.dll
public interface IApplicationInsightsService

Methods

CanConnectAsync(IApplicationInsightsContext)

Task<bool> CanConnectAsync(IApplicationInsightsContext context)

Parameters

context IApplicationInsightsContext

Returns

Task<bool>

GetCapTimelineAsync(IApplicationInsightsContext, int, CancellationToken)

Daily ingestion-cap timeline over the last days days: the configured daily cap (GB) plus, per day, the ingested volume, the cap-hit time (from the workspace "data collection stopped due to daily limit" operation events), and an estimate of the uncapped volume. Degrades to an empty timeline when the Operation/Usage tables aren't readable.

Task<CapTimeline> GetCapTimelineAsync(IApplicationInsightsContext context, int days, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
days int
cancellationToken CancellationToken

Returns

Task<CapTimeline>

GetClusterNodeCpuAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)

Kubernetes node CPU-used percentage per node (k8s.node.name) over timeSpan. Computed as 100 * k8s.node.cpu.usage / k8s.node.allocatable_cpu (cores used / total schedulable cores; on k3s allocatable == physical cores). Only bins where allocatable_cpu is present render, so coverage starts when the collector began emitting it. Series is the node name. Bin size scales with the window.

IAsyncEnumerable<MetricSample> GetClusterNodeCpuAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

GetClusterNodeFilesystemAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)

Kubernetes node filesystem-used percentage per node (k8s.node.name) over timeSpan. Computed as 100 * usage / capacity from kubeletstats k8s.node.filesystem.usage and k8s.node.filesystem.capacity — answers "is a node running out of disk". Series is the node name. Bin size scales with the window. (Host disk I/O is intentionally not surfaced: the cluster Linux nodes' system.disk.* rows carry no host identity, so it cannot be attributed.)

IAsyncEnumerable<MetricSample> GetClusterNodeFilesystemAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

GetClusterNodeMemoryAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)

Kubernetes node memory-used percentage per node (k8s.node.name) over timeSpan. Computed per bin as 100 * usage / (usage + available) from kubeletstats k8s.node.memory.usage and k8s.node.memory.available (there is no direct capacity metric; the pair sums to total). Series is the node name. Bin size scales with the window.

IAsyncEnumerable<MetricSample> GetClusterNodeMemoryAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

GetClusterPodCpuAsync(IApplicationInsightsContext, string, TimeSpan, CancellationToken)

Per-pod CPU usage in cores for the pods scheduled on node (k8s.node.name) over timeSpan. Source: kubeletstats k8s.pod.cpu.usage. This is the node→pod drill-down for GetClusterNodeCpuAsync(IApplicationInsightsContext, TimeSpan, CancellationToken). Series is {k8s.namespace.name}/{k8s.pod.name}. Bin size scales with the window.

IAsyncEnumerable<MetricSample> GetClusterPodCpuAsync(IApplicationInsightsContext context, string node, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
node string
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

GetClusterPodMemoryAsync(IApplicationInsightsContext, string, TimeSpan, CancellationToken)

Per-pod memory usage in MB for the pods scheduled on node (k8s.node.name) over timeSpan. Source: kubeletstats k8s.pod.memory.usage (absolute bytes — pods have no consistent capacity to render a percentage against, unlike nodes). This is the node→pod drill-down for GetClusterNodeMemoryAsync(IApplicationInsightsContext, TimeSpan, CancellationToken). Series is {k8s.namespace.name}/{k8s.pod.name}. Bin size scales with the window.

IAsyncEnumerable<MetricSample> GetClusterPodMemoryAsync(IApplicationInsightsContext context, string node, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
node string
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

GetClusterTotalCpuAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)

Whole-cluster CPU-used percentage over timeSpan, capacity-weighted: 100 * Σ usage / Σ allocatable_cpu across all nodes per bin (a 12-core node contributes proportionally more than a 2-core node). Source: k8s.node.cpu.usage / k8s.node.allocatable_cpu. Series is "Cluster".

IAsyncEnumerable<MetricSample> GetClusterTotalCpuAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

GetClusterTotalFilesystemAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)

Whole-cluster total filesystem-used percentage over timeSpan, weighted by capacity: 100 * Σ usage / Σ capacity across all nodes per bin. Source: k8s.node.filesystem.usage / k8s.node.filesystem.capacity. Series is "Cluster".

IAsyncEnumerable<MetricSample> GetClusterTotalFilesystemAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

GetClusterTotalMemoryAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)

Whole-cluster total memory-used percentage over timeSpan, weighted by capacity: 100 * Σ usage / Σ (usage + available) across all nodes per bin (so larger nodes dominate the total). Source: k8s.node.memory.usage / k8s.node.memory.available. Series is "Cluster".

IAsyncEnumerable<MetricSample> GetClusterTotalMemoryAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

GetCountAsync(IApplicationInsightsContext, string, TimeSpan, CancellationToken)

IAsyncEnumerable<CountData> GetCountAsync(IApplicationInsightsContext context, string environment, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
environment string
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<CountData>

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

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

GetDetail(IApplicationInsightsContext, string, LogSource, string, TimeSpan)

Task<LogDetails> GetDetail(IApplicationInsightsContext context, string id, LogSource source, string environment, TimeSpan timeSpan)

Parameters

context IApplicationInsightsContext
id string
source LogSource
environment string
timeSpan TimeSpan

Returns

Task<LogDetails>

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

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<DiskCapacity>

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

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

GetEnvironments(IApplicationInsightsContext)

IAsyncEnumerable<EnvironmentOption> GetEnvironments(IApplicationInsightsContext context)

Parameters

context IApplicationInsightsContext

Returns

IAsyncEnumerable<EnvironmentOption>

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

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<LogCountByServiceCell>

GetMeasureAsync(IApplicationInsightsContext, string, TimeSpan, CancellationToken)

IAsyncEnumerable<MeasureData> GetMeasureAsync(IApplicationInsightsContext context, string environment, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
environment string
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MeasureData>

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

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

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

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<MetricSample>

GetSummaries(IApplicationInsightsContext, string, TimeSpan, CancellationToken)

IAsyncEnumerable<SummarySubset> GetSummaries(IApplicationInsightsContext context, string environment, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
environment string
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<SummarySubset>

GetSummary(IApplicationInsightsContext, string, LogSource, string, TimeSpan, int, string)

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. application scopes the instances to a single application (matching the summary row); null/empty means no application filter.

Task<SummaryData> GetSummary(IApplicationInsightsContext context, string fingerprint, LogSource source, string environment, TimeSpan timeSpan, int maxItems = 100, string application = null)

Parameters

context IApplicationInsightsContext
fingerprint string
source LogSource
environment string
timeSpan TimeSpan
maxItems int
application string

Returns

Task<SummaryData>

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

context IApplicationInsightsContext
lookback TimeSpan?
forceRefresh bool

Returns

IAsyncEnumerable<VersionMatrixCell>

GetVolumeBySourceAsync(IApplicationInsightsContext, DateTimeOffset, DateTimeOffset, CancellationToken)

Billed ingestion volume (MB) per source table over an absolute UTC window — used for the "Today" / "Yesterday" (UTC) ranges. Same Usage-table source and graceful-degrade behaviour as the relative overload.

IAsyncEnumerable<VolumeBySource> GetVolumeBySourceAsync(IApplicationInsightsContext context, DateTimeOffset fromUtc, DateTimeOffset toUtc, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
fromUtc DateTimeOffset
toUtc DateTimeOffset
cancellationToken CancellationToken

Returns

IAsyncEnumerable<VolumeBySource>

GetVolumeBySourceAsync(IApplicationInsightsContext, TimeSpan, CancellationToken)

Billed ingestion volume (MB) per source table over timeSpan, from the workspace Usage table — billing-grade and cheap (no telemetry scan). Backs the logging cost dashboard's per-source breakdown. Returns empty when the Usage table can't be read (permissions) rather than throwing, so the view degrades gracefully.

IAsyncEnumerable<VolumeBySource> GetVolumeBySourceAsync(IApplicationInsightsContext context, TimeSpan timeSpan, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
timeSpan TimeSpan
cancellationToken CancellationToken

Returns

IAsyncEnumerable<VolumeBySource>

GetVolumeTimelineAsync(IApplicationInsightsContext, DateTimeOffset, DateTimeOffset, CancellationToken)

Billed ingestion volume (MB) per source table per UTC day over an absolute window — backs the multi-day logging-volume line chart. Same Usage-table source and graceful-degrade behaviour.

IAsyncEnumerable<VolumeTimelinePoint> GetVolumeTimelineAsync(IApplicationInsightsContext context, DateTimeOffset fromUtc, DateTimeOffset toUtc, CancellationToken cancellationToken = default)

Parameters

context IApplicationInsightsContext
fromUtc DateTimeOffset
toUtc DateTimeOffset
cancellationToken CancellationToken

Returns

IAsyncEnumerable<VolumeTimelinePoint>

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

context IApplicationInsightsContext
environment string
text string
timeSpan TimeSpan
minSeverityLevel SeverityLevel
cancellationToken CancellationToken

Returns

IAsyncEnumerable<LogItem>

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

context IApplicationInsightsContext
correlationId string
timeSpan TimeSpan

Returns

IAsyncEnumerable<LogItem>

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

context IApplicationInsightsContext
incidentId string
timeSpan TimeSpan

Returns

IAsyncEnumerable<LogItem>