PulseContext.telemetry constructor

PulseContext.telemetry({
  1. required Context baseContext,
  2. required String actor,
  3. required String reason,
  4. String purpose = 'METRIC_COLLECTION',
  5. int priority = 10,
})

Syntheses a Telemetry & Observation Blueprint for high‑frequency signals that provide visibility without driving state mutation.

This factory is the architectural standard for Non‑Invasive Monitoring. It ensures that observability pulses carry a consistent Causal Trace while minimising metabolic and storage overhead.

When to use

Use this when emitting heartbeat signals or performance metrics from within a cell.

How it works

  • Sets auditLevel to none to avoid log bloat.
  • Sets priority to 10 (background).
  • Sets sensitivity to public.
  • Uses deterministic strategy.

Non‑obvious

  • These pulses are never audited – they are pure telemetry.
  • They are low priority and will not interfere with critical operations.

Example

final context = PulseContext.telemetry(
  baseContext: currentPulse.context,
  actor: 'Throughput_Monitor',
  reason: 'Reporting batch completion latency',
);

Parameters:

  • baseContext: Ancestral Context for lineage.
  • actor: The monitoring service or sensor name.
  • reason: The specific metric being reported.
  • purpose: Observation category, defaulting to 'METRIC_COLLECTION'.
  • priority: Urgency, defaulting to 10.

Implementation

factory PulseContext.telemetry({
  required Context baseContext,
  required String actor,
  required String reason,
  String purpose = 'METRIC_COLLECTION',
  int priority = 10,
}) {
  return PulseContext.fromEntries([
    // --- Static Pillars (Non-Evolvable Identity) ---
    Provenance.actor.entry(actor),
    Provenance.traceId.entry(Identity.next()),
    if (baseContext is PulseContext)
      Provenance.parentTraceId.entry(baseContext.traceId!),
    Provenance.sensitivity.entry(Sensitivity.public),

    // --- Fluid Boundaries (Evolvable Intent) ---
    Provenance.strategy.entry(ReasoningStrategy.deterministic),
    Provenance.confidence.entry(1.0),

    // Default to none to prevent log-bloat from diagnostic cycles
    Provenance.auditLevel.entry(AuditLevel.none),

    Provenance.priority.entry(priority),
    Provenance.purpose.entry(purpose),
    Provenance.reason.entry(reason),
  ]);
}