Algos.Insights documentation

Production-ready observability for ASP.NET Core.

Algos.Insights captures requests, logs, exceptions, metrics, traces, dependency calls, and feature or module usage, then presents them inside a secure built-in Razor Pages dashboard.

NuGet: Algos.Insights .NET 6, 7, 8, 9 ASP.NET Core apps and APIs MIT

Package information

Package ID
Algos.Insights
Primary use case
ASP.NET Core web apps and APIs
Targets
.NET 6, .NET 7, .NET 8, .NET 9
Dashboard route
/myinsights

Highlights

Designed for teams that want practical application insight without standing up a full observability stack on day one.

Automatic ASP.NET Core request logging

Secure built-in Razor Class Library dashboard

Request detail drawer with headers, correlation IDs, trace IDs, exceptions, dependencies, and hierarchy

Feature and module usage analytics

Metrics for request volume, latency, percentiles, status codes, and error rate

Manual logging, metrics, tracing, feature tracking, and dependency tracking APIs

Sensitive data redaction before storage, export, dashboard display, or AI context

In-memory storage, JSON file storage, JSON and CSV export, SMTP alerts, and AI provider abstraction

Installation

NuGet
dotnet add package Algos.Insights
Local development project reference
<ProjectReference Include="..\src\Algos.Insights\Algos.Insights.csproj" />

Quick start

Program.cs
using Algos.Insights.Extensions;
using Algos.Insights.Options;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddAlgosInsights(options =>
{
    options.ApplicationName = "My Production API";
    options.EnvironmentName = builder.Environment.EnvironmentName;

    options.EnableAutomaticRequestLogging = true;
    options.EnableRequestBodyLogging = false;
    options.EnableResponseBodyLogging = false;
    options.MaxBodySizeInBytes = 4096;

    options.IgnoreRoutes = new[]
    {
        "/myinsights",
        "/favicon.ico"
    };

    options.Storage.UseInMemory(memory =>
    {
        memory.MaxRequestLogs = 10000;
        memory.MaxExceptionLogs = 5000;
        memory.RetentionHours = 48;
    });

    options.Dashboard.Enabled = true;
    options.Dashboard.Route = "/myinsights";
    options.Dashboard.Title = "Algos Insights";
    options.Dashboard.AuthMode = AlgosInsightsAuthMode.Basic;
    options.Dashboard.Username = builder.Configuration["AlgosInsights:Username"];
    options.Dashboard.Password = builder.Configuration["AlgosInsights:Password"];
    options.Dashboard.EnableDataExport = true;
});

var app = builder.Build();

app.UseAlgosInsights();

app.MapAlgosInsightsDashboard("/myinsights", dashboard =>
{
    dashboard.RequireBasicAuth("admin", "strong-password");
    dashboard.Title = "Algos Insights";
});

app.Run();

Open the dashboard at /myinsights.

Dashboard

The dashboard is delivered as a Razor Class Library area. Consuming applications do not need to copy views, JavaScript, or CSS files.

Routes

/myinsights
/myinsights/requests
/myinsights/features
/myinsights/exceptions
/myinsights/dependencies
/myinsights/traces

Capabilities

  • Overview health score and request explorer
  • Method, status, search, and sort controls
  • Trace ID and correlation ID copy buttons
  • Request hierarchy, modules, features, dependencies, exceptions
  • JSON and CSV exports

The dashboard does not auto-poll. It loads once and refreshes when the user clicks Refresh.

What gets captured

HTTP method, path, query string, status code, duration

Request size, response size, client IP, user agent

Authenticated user name when available

Trace ID, span ID, parent span ID, correlation ID

Route name, controller/action, endpoint metadata

Redacted request and response headers

Optional request body

Optional response body

Exceptions, dependencies, traces, and feature usage

Request and response body logging are disabled by default.

Manual telemetry

Inject IAlgosInsightsLogger to track scopes, feature usage, events, metrics, and dependency calls.

PaymentService.cs
using Algos.Insights.Logging;

public sealed class PaymentService
{
    private readonly IAlgosInsightsLogger _insights;

    public PaymentService(IAlgosInsightsLogger insights)
    {
        _insights = insights;
    }

    public async Task ProcessPaymentAsync()
    {
        using var scope = _insights.BeginScope("PaymentProcessing", new
        {
            Module = "Payments",
            Feature = "StripeCheckout"
        });

        _insights.TrackFeatureUsage("Payments", "StripeCheckout", new
        {
            PaymentType = "Card",
            Currency = "USD"
        });

        _insights.TrackEvent("PaymentStarted", new
        {
            Amount = 100,
            Currency = "USD"
        });

        _insights.TrackMetric("payment.amount", 100, new
        {
            Currency = "USD"
        });

        await _insights.TrackDependencyAsync("Stripe API", "CreatePaymentIntent", async () =>
        {
            await Task.Delay(120);
        });
    }
}

Feature usage

Manual tracking
_insights.TrackFeatureUsage("Billing", "Invoice Download");
Endpoint metadata
using Algos.Insights.Models;

app.MapPost("/api/payments/stripe", () => Results.Ok())
   .WithMetadata(new AlgosFeatureAttribute("Payments", "Stripe Checkout"));

Storage and exports

In-memory storage
options.Storage.UseInMemory(memory =>
{
    memory.MaxRequestLogs = 10000;
    memory.MaxExceptionLogs = 5000;
    memory.RetentionHours = 48;
});
JSON file storage
options.Storage.UseJsonFile(json =>
{
    json.DirectoryPath = "App_Data/AlgosInsights";
});

Protected export routes

/myinsights/export/requests.json
/myinsights/export/requests.csv

Export output is limited by Dashboard.MaxExportRows.

Security

Security defaults are intentionally conservative.

Request body logging is off by default

Response body logging is off by default

Dashboard route is excluded from request logging

Sensitive headers and fields are masked

AI is disabled by default

Exports require dashboard authentication

Default sensitive fields
password, token, authorization, cookie, set-cookie, otp, secret,
access_token, refresh_token, card, cvv, api_key, connectionstring
Customize redaction
options.Redaction.MaskFields = new[]
{
    "password",
    "token",
    "authorization",
    "cookie",
    "secret",
    "api_key"
};

Health checks

/health is ignored by default because most production systems call health endpoints very frequently.

Log health checks by overriding IgnoreRoutes
options.IgnoreRoutes = new[]
{
    "/myinsights",
    "/favicon.ico"
};

Alerts

Configure SMTP alert rules with windows, thresholds, cooldowns, and email delivery.

SMTP and repeated 500 errors
options.EmailAlerts.ConfigureSmtp(smtp =>
{
    smtp.Enabled = true;
    smtp.Host = builder.Configuration["Smtp:Host"];
    smtp.Port = 587;
    smtp.Username = builder.Configuration["Smtp:Username"];
    smtp.Password = builder.Configuration["Smtp:Password"];
    smtp.From = "alerts@myapp.com";
    smtp.To = new[] { "admin@myapp.com" };
});

options.Alerts.AddRule(rule =>
{
    rule.Name = "Repeated 500 Errors";
    rule.WhenStatusCodeIs = 500;
    rule.TriggerWhenCountGreaterThan = 10;
    rule.WindowMinutes = 5;
    rule.CooldownMinutes = 20;
    rule.SendEmail = true;
});

AI assistant

AI is disabled by default. The package currently exposes an AI provider abstraction for future integrations. AI context must be redacted before use, and API keys are never displayed in the dashboard.

Provider abstraction
public interface IAlgosAiProvider
{
    Task<AlgosAiResponse> AskAsync(
        AlgosAiRequest request,
        CancellationToken cancellationToken = default);
}

OpenAI-compatible APIs

Azure OpenAI

Custom HTTP endpoints

Local LLM endpoints

Architecture

Repository layout
src/
  Algos.Insights/
    Areas/
      AlgosInsights/
        Pages/
          Index.cshtml
          Requests.cshtml
          Features.cshtml
          Exceptions.cshtml
          Dependencies.cshtml
          Traces.cshtml
    Dashboard/
      Assets/
      Endpoints/
      Security/
    Middleware/
    Models/
    Options/
    Logging/
    Storage/
    Export/
    Alerts/
    AI/
    Redaction/

samples/
  Algos.Insights.SampleApi/

Sample API

Run sample
dotnet run --project samples/Algos.Insights.SampleApi/Algos.Insights.SampleApi.csproj

Open: /myinsights

Username: admin

Password: strong-password

Production recommendations

Use strong dashboard credentials

Serve the dashboard only over HTTPS

Keep body logging disabled unless diagnosing a specific issue

Keep retention bounded

Exclude noisy routes unless you really need them

Disable exports in sensitive environments if required

Store dashboard credentials in configuration or secret storage

Treat AI output as advisory only

Roadmap

OpenTelemetry exporter integration

Azure Application Insights and Azure Monitor providers

AWS CloudWatch provider

SQL Server, PostgreSQL, SQLite, MongoDB storage providers

Elasticsearch/OpenSearch provider

Rich trace waterfall UI

Alert history dashboard

Webhook, Slack, and Teams alert providers

AI chat provider implementations

Role/policy-based dashboard authorization