Context
The experimental_span_attributes feature in opentelemetry-appender-tracing
is ready to be stabilized. Today its only API is:
.with_span_attribute_allowlist(["session.id"]) // requires cargo feature
When we drop the cargo feature, we also need a way to enable the
behavior at runtime — not every user wants to pay per-span overhead.
Two builder shapes under consideration. Pick one.
Option A — two methods, allowlist implies enable
.with_span_attributes(true) // enable, copy all
.with_span_attribute_allowlist(["session.id"]) // implies enable + filter
- Two methods; subtle interaction if both called.
bool argument enables conditional config: b.with_span_attributes(cfg.enable).
Option B — one method, allowlist semantics
.with_span_attributes([]) // enable, copy all
.with_span_attributes(["session.id"]) // enable, allowlist
// (not called) // disabled
- Single method, no boolean trap.
- Empty iterator = "enable all" sentinel — slight cognitive load.
- Conditional enable requires
if cfg.enable { b = b.with_span_attributes(...) }.
In both options:
- Default is disabled (no per-span work).
- Last call wins if invoked twice.
Context
The
experimental_span_attributesfeature inopentelemetry-appender-tracingis ready to be stabilized. Today its only API is:
When we drop the cargo feature, we also need a way to enable the
behavior at runtime — not every user wants to pay per-span overhead.
Two builder shapes under consideration. Pick one.
Option A — two methods, allowlist implies enable
boolargument enables conditional config:b.with_span_attributes(cfg.enable).Option B — one method, allowlist semantics
if cfg.enable { b = b.with_span_attributes(...) }.In both options: