Portal Community

INodeMetrics Interface

public interface INodeMetrics
{
    void IncrementCounter(string name, long value = 1,
                          IDictionary<string, string>? tags = null);

    void RecordHistogram(string name, double value,
                         IDictionary<string, string>? tags = null);

    void SetGauge(string name, double value,
                  IDictionary<string, string>? tags = null);
}

Counter — Counting Events

// Count business events that happen within this node execution
var metrics = ctx.Observability.Metrics;

// Payment processed
metrics.IncrementCounter("payments.processed");

// Email sent
metrics.IncrementCounter("emails.sent", tags: new Dictionary<string, string>
{
    ["template"] = "invoice",
    ["channel"]  = "sendgrid"
});

// Multiple items processed
metrics.IncrementCounter("items.processed", value: itemCount);

Histogram — Measuring Values

// Measure a business value — payment amount, file size, response time
metrics.RecordHistogram("payment.amount_cents", amount * 100);
metrics.RecordHistogram("api.response_time_ms", externalCallDuration.TotalMilliseconds,
    tags: new Dictionary<string, string> { ["provider"] = "stripe" });

Metric Naming Conventions

ConventionExample
Use dot-separated lowercasepayments.processed
Include unit suffix for histogramsapi.response_time_ms
Node-specific prefix not requiredStandard tags already carry nodeId/nodeType
Avoid high cardinality tagsDo not tag with executionId (each run = new label set)

Standard Tags Pre-applied

All custom metrics automatically include the standard node tags — no need to add them manually:

// Custom metric: payments.processed
// Prometheus labels it receives automatically:
payments_processed{
    nodeId   = "node-payment",
    nodeType = "PaymentNode",
    processId= "proc-xyz",
    tenantId = "tenant-001"
} += 1
Avoid raw IMetricsProvider. Do not inject and use IMetricsProvider directly in an executor. It will not have the standard node tags pre-applied. Always use ctx.Observability.Metrics.