Portal Community

Emission Pipeline

MetricsInteractionHook
OTel MeterProvider
OTel Prometheus Exporter
/metrics endpoint
Prometheus scrape
BizFirst Observe

Step 1 — Register the Metrics Hook

// Program.cs
builder.Services.AddEdgeInteract(options =>
{
    options.DefaultTimeoutMs = 3_600_000;
});

// Register hooks
builder.Services.AddInteractionHook<AuditInteractionHook>();
builder.Services.AddInteractionHook<MetricsInteractionHook>(); // enables metric emission

Step 2 — Configure OTel

// Add OpenTelemetry with EdgeInteract meter
builder.Services.AddOpenTelemetry()
    .WithMetrics(metrics =>
    {
        metrics
            .AddAspNetCoreInstrumentation()
            .AddRuntimeInstrumentation()
            .AddMeter("BizFirst.EdgeInteract")   // EdgeInteract meter name
            .AddPrometheusExporter();             // exposes /metrics endpoint
    });

// Map the Prometheus scrape endpoint
app.MapPrometheusScrapingEndpoint(); // default: /metrics

Step 3 — Configure Prometheus to Scrape

# prometheus.yml
scrape_configs:
  - job_name: 'edge-interact'
    scrape_interval: 15s
    static_configs:
      - targets: ['your-server:8080']
    metrics_path: /metrics

Available Metrics Reference

interaction_response_time_ms Histogram
Time from displayedAt to respondedAt. Only recorded for interactions that receive a response (not timeouts).
type outcome
interaction_published_total Counter
Incremented each time an interaction passes pre-send hooks and is published to the pipeline.
type priority
interaction_responses_total Counter
Incremented each time a valid user response is received. Tagged by outcome.
type outcome
interaction_timeout_total Counter
Incremented when an interaction's timeout window expires without a response.
type
interaction_in_flight Gauge
Current count of interactions in the pipeline awaiting a response. Incremented on publish, decremented on response or timeout.
type
interaction_blocked_total Counter
Incremented when a pre-send hook blocks an interaction before delivery. Tagged with the hook name that rejected it.
type blocked_by

Verifying Metric Emission

Curl the /metrics endpoint and search for EdgeInteract metrics:

curl http://localhost:8080/metrics | grep interaction_

# Expected output (sample):
# HELP interaction_published_total Total interactions published to the pipeline
# TYPE interaction_published_total counter
interaction_published_total{type="approval",priority="high"} 142
interaction_published_total{type="notification",priority="normal"} 1089
# HELP interaction_response_time_ms Response time from displayed to responded
# TYPE interaction_response_time_ms histogram
interaction_response_time_ms_bucket{type="approval",outcome="approved",le="500"} 0
interaction_response_time_ms_bucket{type="approval",outcome="approved",le="60000"} 12
...
interaction_in_flight{type="approval"} 3
Meter Name The OTel meter name is BizFirst.EdgeInteract. When using the AddMeter() call, this exact string must match to include EdgeInteract metrics in the export pipeline.

BizFirst Observe Dashboard Setup

After Prometheus begins scraping, import the pre-built EdgeInteract dashboard from BizFirst Observe's dashboard library. The dashboard includes panels for: