HuggingfaceClient.Telemetry (huggingface_client v0.1.0)

Copy Markdown View Source

Telemetry integration for HuggingfaceClient inference requests.

All inference calls emit :telemetry.span/3 events under the [:huggingface_client, :request] prefix, carrying:

  • start metadata%{provider: binary(), task: binary(), model: binary() | nil}

  • stop metadata — same as start, plus %{status: non_neg_integer()}

Usage

# Attach the built-in logger (prints events to Logger)
HuggingfaceClient.Telemetry.attach_default_logger(:my_handler)

# … make inference calls …

HuggingfaceClient.Telemetry.detach_default_logger(:my_handler)

Summary

Functions

Attaches a default Logger-based handler under the given handler_id.

Detaches the handler registered under handler_id.

Returns the full list of telemetry event names emitted by this library.

Functions

attach_default_logger(handler_id)

@spec attach_default_logger(term()) :: :ok | {:error, :already_exists}

Attaches a default Logger-based handler under the given handler_id.

Returns :ok or {:error, :already_exists}.

detach_default_logger(handler_id)

@spec detach_default_logger(term()) :: :ok | {:error, :not_found}

Detaches the handler registered under handler_id.

events()

@spec events() :: [list()]

Returns the full list of telemetry event names emitted by this library.