NuGet · nuget

Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Metrik

Metrics & Tracing feature for Eltheon based on OpenTelemetry

Install

Install-Kommandos

dotnet add package Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Metrik --version 0.9.0.7
<PackageReference Include="Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Metrik" Version="0.9.0.7" />
paket add Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Metrik --version 0.9.0.7
Install-Package Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Metrik -Version 0.9.0.7

README

Vorschau

Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Metrik

Provides the abstraction layer for Metrics and Tracing inside Eltheon. Exposes the IMetrics / ITracer contracts, default OpenTelemetry-based implementations, Null fallbacks, configuration bindings, and feature-specific integration helpers (HTTP, Identity, DataProvider, SignalR, Logging).

What's inside

  • v1.Abstractions – stable contracts for counters, gauges, histograms, and trace spans.
  • v1.Configuration.MetricsConfig – ConfigFiles model that controls whether metrics/tracing are enabled and which exporters should be used.
  • v1.Implementation.OpenTelemetry – the production implementation that wires Meter, MeterProvider, ActivitySource, and exporters.
  • v1.Implementation.Null – noop fallbacks that are automatically used when the feature is disabled.
  • v1.Integration.* – convenience helpers with pre-defined metric names/labels for HTTP, Identity, database providers, SignalR, and logging.
  • v1.DependencyInjection.MetrikServiceCollectionExtensions – registers everything via AddEltheonMetrik().

How to use

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEltheonMetrik();

// uses IMetrics behind the scenes
builder.Services.AddSingleton<RequestMetricsMiddleware>();

The module reads its configuration through MetricsConfig (ConfigFiles). Enable the feature under Admin → Configs → Metrics and add one or more providers:

  • Prometheus – enables /metrics via UseOpenTelemetryPrometheusScrapingEndpoint. Optional setting: Endpoint=/metrics.
  • OTLP – pushes to the configured OTLP HTTP endpoint (Endpoint=https://otel.example:4318).
  • Console – writes metric snapshots and traces to stdout for debugging.

Example entry in Configs/Configs.json:

{
  "$type": "Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Metrik.v1.Configuration.MetricsConfig, Redeon.SuperSiteEngineCore.Web.Eltheon.Core.Features.Metrik",
  "Caption": "Metrics",
  "Enabled": true,
  "TracingEnabled": true,
  "Providers": [
    {
      "Type": "Prometheus",
      "Enabled": true,
      "Settings": {
        "Endpoint": "/metrics"
      }
    },
    {
      "Type": "Otlp",
      "Enabled": false,
      "Settings": {
        "Endpoint": "https://otel-gateway:4318"
      }
    }
  ]
}

Tracing piggybacks on the same configuration. When TracingEnabled is set, the OpenTelemetryTracer exposes an ActivitySource so features can start spans without depending on OT packages.

Extending features

Every feature can depend on the abstractions only:

public class LoginService
{
    private readonly IMetrics _metrics;

    public LoginService(IMetrics metrics) => _metrics = metrics;

    public Task SignInAsync(string user, bool success)
    {
        _metrics.RecordLoginAttempt(success ? "success" : "failed");
        // ...
    }
}

The helper extensions under v1.Integration.* contain the canonical metric names so dashboards stay consistent across hosts.