Repository navigation
Description
Parent
What to build
The ESP log exporter for all four signals, as specified in the parent issue. An engineer enables one Kconfig option, passes a MakeEspLog*Exporter() factory to the existing setup call, and sees every span, log record, metric data point and profile as an ordinary ESP-IDF log line, filtered by tag and level like any other component's output. The traces, logs, metrics and profiles examples switch to it and show it working in QEMU.
The parent spec's "Implementation Decisions" and "Testing Decisions" sections are the reference for format, tags, levels, filtering and lifecycle.
If this does not fit one session, split it at a signal boundary: traces and profiles first (shared formatting, Kconfig option, header), then log records and metrics.
Acceptance criteria
Configuration and API
-
ESP_OPENTELEMETRY_EXPORTER_ESP_LOGis in "Exporters to compile in",default n. -
MakeEspLogSpanExporter(),MakeEspLogLogRecordExporter()andMakeEspLogMetricExporter()exist only when their signal is enabled;MakeEspLogProfilesExporter()is not gated on a signal. - The public header exposes only the factories. Its comment points to the logs setup header and the ESP log bridge header, and documents that bridged lines print twice when both are enabled.
Output
- One
ESP_LOGxline per item. Labels, fields, order and value formatting mirror the SDK's Ostream exporter, including resource and instrumentation scope on every item, written aslabel: valuejoined by,with nested attributes in braces. - Each span event and each span link prints on its own line carrying the span's
span_id. - Metrics print one line per data point, repeating instrument fields, resource and scope; sum, histogram and last-value points all render.
- Profiles print the raw JSON document on one line with no begin/end markers.
- Lines are never truncated.
Tags, levels, filtering
- Tags:
otel.span,otel.log,otel.metric,otel.profile. - Spans print at INFO, or WARN when status is Error. Metric data points and profiles print at INFO. Log records map TRACE→V, DEBUG→D, INFO→I, WARN→W, ERROR/FATAL→E.
- An item that
esp_logwould not print, whether filtered at compile time or runtime, is skipped before formatting, andExport()still reports success. - A log record with a
log.tagattribute is also skipped when that tag's runtime level would hide it; a record withoutlog.tagis filtered byotel.logalone.
Lifecycle
-
ForceFlush()returnstrueimmediately; afterShutdown(),Export()returns failure and prints nothing.
Examples and tests (fixed-string matches in each example's QEMU test)
- traces: switched to the ESP log exporter; adds a span event and an Error-status span. The test checks an
otel.spanINFO line with the example'sservice.name, an event line with the samespan_id, and the Error span at WARN. - logs: switched; adds a DEBUG record and a bridged
ESP_LOGxunder a tag whose runtime level hides it. The test checks the INFO record'sotel.logline and the absence of both filtered records. - metrics: switched; the test checks an
otel.metricINFO line containingiterations. - profiles: switched; the test checks an
otel.profileINFO line. - All CI jobs pass.
Docs
- README exporter table lists the ESP log exporter.
- README tested-features table has "Tested (QEMU)" rows for the ESP log exporters, and marks
OStreamSpanExporter,OStreamMetricExporterandOStreamLogRecordExporter"Not tested". - Example READMEs describe the ESP log exporter instead of the Ostream exporters.
Activity
Add ESP log exporters for all four signals
Add ESP log exporters for all four signals (#124)