Operation timing events and opt-in native storage metrics.
Public database operations, direct query execution and individual query
stream open/next/close calls emit [:lancedb, :operation, :start | :stop | :exception]. Metadata includes :operation, :operation_id, and :execution_id. A query enumeration shares its execution ID across open/next/close events; eager queries also provide :parent_operation_id on child events. Independent callback operations receive independent IDs; stop metadata includes :status
(:ok or :error) and :error_kind. Direct query execution also identifies
:query_kind. Public calls made inside callbacks emit their own spans. Internal adapter calls do not emit spans. Durations use Erlang native time units. Records, SQL,
connection credentials, and table handles are not included. Exception events
use the standard telemetry exception metadata, which can contain user data in
the exception reason or stacktrace.
Call enable_native_metrics/0 before opening connections to collect native
metrics. The recorder is process-global, cannot be disabled, and reports
cumulative values across all connections in this NIF. It does not reset when
read. An incompatible existing native recorder produces an error.
For session-local index and metadata cache statistics, use
LanceDB.Table.cache_stats/1; that API needs no global recorder and reports
the table's actual session, including any other handles sharing its caches.
poll/0 emits one [:lancedb, :native, :metric] event per metric series. Scalar
measurements contain :value; histogram measurements contain :count and
:sum. Metadata contains :name, :kind, :attributes, and histogram
:buckets (cumulative pairs of upper-bound strings and counts).
These are cumulative snapshots, not individual observations: do not sum
successive counter snapshots or feed histogram sums into a distribution.
Metric names and attributes stay strings and depend on the upstream SDK.
Native attributes may include storage paths; filter them before export when
necessary. Call poll/0 from your own scheduler or telemetry_poller; this
package starts no background polling process.
Summary
Functions
Returns metric descriptions with string keys; empty until metrics are described.
Installs the native recorder, returning :ok even if already installed.
An incompatible existing recorder returns {:error, %LanceDB.Error{}}
with operation :enable_native_metrics.
Emits native metric snapshots as telemetry events.
Returns cumulative metric series with string keys, without emitting events.
Functions
@spec catalog() :: [map()]
Returns metric descriptions with string keys; empty until metrics are described.
@spec enable_native_metrics() :: :ok | {:error, LanceDB.Error.t()}
Installs the native recorder, returning :ok even if already installed.
An incompatible existing recorder returns {:error, %LanceDB.Error{}}
with operation :enable_native_metrics.
@spec poll() :: :ok
Emits native metric snapshots as telemetry events.
@spec snapshot() :: [map()]
Returns cumulative metric series with string keys, without emitting events.