Skip to main content

PipelineLogAggregator

Namespace: Meshmakers.Octo.Sdk.Common.EtlDataPipeline

Collects repeated per-record conditions of one pipeline execution and reports each of them once, with a count, when the execution ends.

public sealed class PipelineLogAggregator

Inheritance Object → PipelineLogAggregator

Remarks:

A node inside a ForEach@1 runs once per record. A condition it would log per record — for example a missing optional input — turns into one log line per record, which on prod-1 was ~808k warnings a day from ExecuteCSharp@1 alone. A node calls PipelineLogAggregator.Record(Object, String, Action<Int64>) per occurrence instead; the orchestrator calls PipelineLogAggregator.Flush(INodeContext) once at the end of the execution (success or failure), which invokes each entry's report callback once with the number of occurrences.

One instance per execution, shared by every node context of it, exactly like PipelineSecretRegistry: a child node context inherits its parent's, a root node context creates one. Thread-safe, because ForEach@1 iterations may run in parallel.

Entries are keyed by an owner compared by reference — normally the node configuration object, which is the same instance for every iteration of a node, whereas the node path carries the iteration index — plus a string key within that owner.

Constructors​

PipelineLogAggregator()​

public PipelineLogAggregator()

Methods​

Record(Object, String, Action<Int64>)​

Records one occurrence.

public long Record(object owner, string key, Action<long> report)

Parameters​

owner Object
The owner of the entry, compared by reference (normally the node configuration)

key String
The key of the condition within the owner (e.g. the argument name)

report Action<Int64>
Called once by PipelineLogAggregator.Flush(INodeContext) with the number of occurrences. Only the callback of the first occurrence is kept.

Returns​

Int64
The number of occurrences recorded so far, including this one

GetCount(Object, String)​

Gets the number of occurrences recorded for an entry that has not been flushed yet.

public long GetCount(object owner, string key)

Parameters​

owner Object
The owner, compared by reference

key String
The key within the owner

Returns​

Int64
The count, or 0 when nothing was recorded

Flush(INodeContext)​

Reports every recorded entry once and clears them. A report callback that throws is logged as an error on nodeContext and does not stop the other reports.

public void Flush(INodeContext nodeContext)

Parameters​

nodeContext INodeContext
The context that logs a failing report callback (normally the root context)