Arcana.Telemetry.Logger (Arcana v1.3.3)

View Source

Ready-to-use telemetry logger for Arcana events.

Logs all Arcana operations with timing information to help identify performance bottlenecks.

Usage

Add to your application's start/2 function:

def start(_type, _args) do
  Arcana.Telemetry.Logger.attach()

  children = [
    # ...
  ]

  Supervisor.start_link(children, strategy: :one_for_one)
end

Example Output

[info] [Arcana] search completed in 42ms (15 results)
[info] [Arcana] llm.complete completed in 1.23s [zai:glm-4.7] ok (156 chars) prompt=892chars
[info] [Arcana] agent.gate completed in 235ms (proceed)
[info] [Arcana] agent.rewrite completed in 235ms
[info] [Arcana] llm.complete completed in 2.1s [zai:glm-4.7] ok (45 chars) prompt=1204chars
[info] [Arcana] agent.expand completed in 2.15s (3 queries)
[info] [Arcana] agent.search completed in 156ms (25 chunks)
[info] [Arcana] agent.reason completed in 1.2s (2 iterations)
[info] [Arcana] agent.rerank completed in 312ms (10/25 kept)
[info] [Arcana] llm.complete completed in 3.2s [zai:glm-4.7] ok (1892 chars) prompt=4521chars
[info] [Arcana] agent.answer completed in 3.25s
[info] [Arcana] ask completed in 6.12s

Options

You can customize the logger by passing options to attach/1:

Arcana.Telemetry.Logger.attach(
  level: :debug,           # Log level (default: :info)
  handler_id: "my-logger"  # Custom handler ID (default: "arcana-telemetry-logger")
)

Detaching

To stop logging, call:

Arcana.Telemetry.Logger.detach()

Summary

Functions

Attaches telemetry handlers for logging Arcana events.

Detaches the telemetry handlers.

Functions

attach(opts \\ [])

Attaches telemetry handlers for logging Arcana events.

Options

  • :level - The log level to use (default: :info)
  • :handler_id - Custom handler ID (default: "arcana-telemetry-logger")

detach(opts \\ [])

Detaches the telemetry handlers.

Options

  • :handler_id - The handler ID to detach (default: "arcana-telemetry-logger")