Summary
The cognitive loop emits tracing spans but doesn't export them via OpenTelemetry. Add optional OTLP export (behind a feature flag) so users can visualize cognitive cycle timing in Jaeger or Grafana Tempo.
Key spans to instrument
| Span |
Current time |
% of cycle |
hdc_encode |
~580µs |
13.6% |
predict |
~560µs |
13.1% |
consciousness_measure |
— |
part of postprocess |
moral_algebra |
~17µs |
0.4% |
parallel_postprocess |
~1.9ms |
44% |
stability_regime |
~1.35ms |
31.6% |
Total cycle: ~4.3ms (234Hz) in release mode.
Implementation plan
- Add feature flag:
opentelemetry (or otlp)
- Add dependencies:
opentelemetry, opentelemetry-otlp, tracing-opentelemetry
- Initialize OTLP exporter in the cognitive loop constructor when feature is enabled
- Ensure existing
tracing::instrument spans are properly propagated
- Add configuration for OTLP endpoint (default:
http://localhost:4317)
- Graceful degradation when collector is unavailable
Why this matters
Visualizing the cognitive cycle as a trace flamegraph makes it much easier to identify performance regressions, understand phase ordering, and debug consciousness measurement timing. This is especially valuable as we add more subsystems to the pipeline.
Getting started
The codebase already uses the tracing crate extensively. The main integration point is src/cognitive_loop/cycle.rs where the core pipeline runs.
Summary
The cognitive loop emits
tracingspans but doesn't export them via OpenTelemetry. Add optional OTLP export (behind a feature flag) so users can visualize cognitive cycle timing in Jaeger or Grafana Tempo.Key spans to instrument
hdc_encodepredictconsciousness_measuremoral_algebraparallel_postprocessstability_regimeTotal cycle: ~4.3ms (234Hz) in release mode.
Implementation plan
opentelemetry(orotlp)opentelemetry,opentelemetry-otlp,tracing-opentelemetrytracing::instrumentspans are properly propagatedhttp://localhost:4317)Why this matters
Visualizing the cognitive cycle as a trace flamegraph makes it much easier to identify performance regressions, understand phase ordering, and debug consciousness measurement timing. This is especially valuable as we add more subsystems to the pipeline.
Getting started
The codebase already uses the
tracingcrate extensively. The main integration point issrc/cognitive_loop/cycle.rswhere the core pipeline runs.