etl_lib.core.InstrumentationWriter module

class CsvInstrumentationWriter(path, sample_every=1)[source]

Bases: InstrumentationWriter

Writes instrumentation events to CSV.

The writer is thread-safe and appends rows to the configured file.

Parameters:
__init__(path, sample_every=1)[source]

Creates a new CSV instrumentation writer.

Parameters:
  • path (Path) – Target CSV path.

  • sample_every (int) – Writes every Nth event. Values < 1 are treated as 1.

enabled: bool = True
write(event)[source]

Appends one event row to the CSV file.

Parameters:

event (dict[str, Any]) – Event payload to persist.

Return type:

None

class InstrumentationWriter[source]

Bases: object

Base writer for instrumentation events.

Implementations decide where and how events are persisted.

enabled: bool = False
write(event)[source]

Persist one instrumentation event.

Parameters:

event (dict[str, Any]) – Event payload to persist.

Return type:

None

class NoopInstrumentationWriter[source]

Bases: InstrumentationWriter

Disabled writer implementation.

enabled: bool = False
write(event)[source]

Ignore instrumentation events.

Parameters:

event (dict[str, Any]) – Event payload to persist.

Return type:

None

create_instrumentation_writer(env_vars)[source]

Creates an instrumentation writer from environment values.

Supported modes via ETL_LIB_INSTRUMENT: - none (default) - csv

Parameters:

env_vars (dict) – Environment dictionary.

Return type:

InstrumentationWriter

Returns:

A configured instrumentation writer.