lens.fallbacks

View as Markdown

Canonical no-op fallbacks for when nemo-lens telemetry is not active.

These match the nemo.lens public API signatures so that instrumented code works unchanged regardless of whether telemetry is initialised.

Consumer libraries should use these as their ImportError fallback::

try: from nemo.lens.helpers import managed_span from nemo.lens.state import is_span_group_enabled except ImportError: from nemo.lens.fallbacks import managed_span, is_span_group_enabled

Module Contents

Functions

NameDescription
is_span_group_enabledAlways returns False.
managed_spanNo-op context manager — yields None.
safe_set_span_attributesNo-op.
span_cmNo-op context manager — yields None.
trace_fnNo-op decorator — returns the function unchanged.

API

lens.fallbacks.is_span_group_enabled(
group
)

Always returns False.

lens.fallbacks.managed_span(
group,
name,
tracer = None,
attributes = {}
)

No-op context manager — yields None.

lens.fallbacks.safe_set_span_attributes(
span,
attributes,
redact_keys = None
)

No-op.

lens.fallbacks.span_cm(
name,
tracer = None,
record_exception = True,
attributes = {}
)

No-op context manager — yields None.

lens.fallbacks.trace_fn(
group,
name,
tracer = None
)

No-op decorator — returns the function unchanged.