Telemetry Guide
View SourceExZarr v1.1+ emits :telemetry events for streaming and chunk I/O.
Events
Chunk read and write use :telemetry.span/3. Attach to the :stop events for
duration measurements. Stream start/stop use :telemetry.execute/3.
| Event | Measurements | Metadata |
|---|---|---|
[:ex_zarr, :chunk, :read, :stop] | %{duration: native_time} | %{array: ref, chunk_index: tuple} |
[:ex_zarr, :chunk, :write, :stop] | %{duration: native_time, bytes: integer} | %{array: ref, chunk_index: tuple} |
[:ex_zarr, :stream, :start] | %{} | %{array: ref, type: atom, opts: keyword} |
[:ex_zarr, :stream, :stop] | %{duration: native_time, count: integer} | %{array: ref, type: atom} |
ExZarr.Telemetry.events/0 returns all attachable event names, including
:start and :exception variants for chunk spans.
Installation
defmodule MyApp.Application do
use Application
def start(_type, _args) do
:telemetry.attach(
"ex-zarr-chunk-reads",
[:ex_zarr, :chunk, :read, :stop],
fn _event, measurements, metadata, _config ->
IO.inspect({measurements.duration, metadata.chunk_index})
end,
nil
)
Supervisor.start_link([], strategy: :one_for_one)
end
endStream Monitoring
:telemetry.attach(
"ex-zarr-stream-stop",
[:ex_zarr, :stream, :stop],
fn _event, %{duration: duration, count: count}, %{type: type}, _config ->
IO.inspect({type, count, duration})
end,
nil
)
array
|> ExZarr.Array.stream_chunks(concurrency: 4)
|> Enum.to_list()Notes
arraymetadata is a tuple{shape, chunks, dtype}, not the full struct.- Stream
:typeis:chunks,:slices, or:write. - Chunk span
:exceptionevents include metadata but no duration measurement.