microsoft/aspire · error

Resource view limit of

Error message

Resource view limit of {TelemetryRepositoryLimits.MaxResourceViewCount} reached.

What it means

The SQLite telemetry repository enforces TelemetryRepositoryLimits.MaxResourceViewCount on the number of resource-view rows stored per resource in telemetry_resource_views. GetOrAddCachedResourceView throws this InvalidOperationException when a new view would exceed the per-resource limit. Views represent distinct attribute-projection combinations for a resource; the cap prevents unbounded growth per resource.

Solutions

  1. Keep resource attributes stable per process so a resource maps to a single view.
  2. Reduce distinct view property combinations requested/derived for a resource.
  3. Restart the Dashboard session (clearing cached state) if the limit was reached through many legitimate one-off views.

Example fix

// before: mutating resource metadata over time
resource.Attributes.Add($"state.{DateTime.UtcNow}", state);
// after: fixed attribute set for the resource lifetime
resource.Attributes.Add("service.version", serviceVersion);
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    var viewId = GetOrAddCachedResourceView(connection, tx, resource, incoming);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("Resource view limit"))
{
    logger.LogWarning(ex, "View limit reached for resource {Id}; new view skipped.", resource.ResourceId);
}

Prevention

When it happens

Trigger: GetOrAddCachedResourceView throws when SELECT COUNT(*) FROM telemetry_resource_views WHERE resource_id = @ResourceId >= MaxResourceViewCount and a new view combination for that resource is inserted (path shared by GetOrAddCachedResource, cachedView, and AddMetricsToDatabaseAsync). Triggered when one resource accumulates too many distinct view property sets.

Common situations: A single resource whose attributes keep changing during its lifetime, generating new views on each change; long-running Dashboard sessions aggregating many telemetry shapes for one service; high-cardinality attributes leaking into resource metadata.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/5508ee77b352f4a1. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Dashboard/Otlp/Storage/SqliteTelemetryRepository.Caching.cs:149

                          WHERE a.resource_view_id = v.resource_view_id
                            AND a.ordinal = {index}
                            AND a.attribute_key = @PropertyKey{index}
                            AND a.attribute_value = @PropertyValue{index}
                      )
                    """);
            }
            sql.Append(" LIMIT 1;");

            var resourceViewId = connection.QuerySingleOrDefault<long?>(sql.ToString(), parameters, transaction);
            if (resourceViewId is null)
            {
                var resourceViewCount = connection.QuerySingle<int>(
                    "SELECT COUNT(*) FROM telemetry_resource_views WHERE resource_id = @ResourceId;",
                    new { resource.ResourceId },
                    transaction);
                if (resourceViewCount >= TelemetryRepositoryLimits.MaxResourceViewCount)
                {
                    throw new InvalidOperationException($"Resource view limit of {TelemetryRepositoryLimits.MaxResourceViewCount} reached.");
                }

                resourceViewId = connection.QuerySingle<long>("""
                    INSERT INTO telemetry_resource_views (resource_id)
                    VALUES (@ResourceId)
                    RETURNING resource_view_id;
                    """, new { resource.ResourceId }, transaction);
                var properties = incomingView.Properties
                    .Select((property, ordinal) => (Ordinal: ordinal, property.Key, property.Value))
                    .ToArray();
                SqliteBatchInsert.BatchInsertRows(
                    connection,
                    transaction,
                    properties,
                    MaxMetadataAttributeBatchSize,
                    "telemetry_resource_view_attributes",
                    ["resource_view_id", "ordinal", "attribute_key", "attribute_value"],
                    (property, parameters) =>

View on GitHub (pinned to 25830f84bd)