SnakeBridge.Telemetry.RuntimeForwarder (SnakeBridge v0.16.0)

Copy Markdown View Source

Enriches Snakepit runtime telemetry with SnakeBridge context.

This module listens to Snakepit's call events and re-emits them under the :snakebridge namespace with additional context like the SnakeBridge version and library information.

Events

Original Snakepit events:

  • [:snakepit, :python, :call, :start]
  • [:snakepit, :python, :call, :stop]
  • [:snakepit, :python, :call, :exception]

Are forwarded as:

  • [:snakebridge, :runtime, :call, :start]
  • [:snakebridge, :runtime, :call, :stop]
  • [:snakebridge, :runtime, :call, :exception]

With added metadata:

  • snakebridge_library - The library name from the original event
  • snakebridge_version - The current SnakeBridge version

Usage

# In your application startup
SnakeBridge.Telemetry.RuntimeForwarder.attach()

Summary

Functions

Attaches the runtime forwarder to Snakepit events.

Detaches the runtime forwarder.

Functions

attach()

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

Attaches the runtime forwarder to Snakepit events.

Returns :ok on success or {:error, :already_exists} if already attached.

detach()

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

Detaches the runtime forwarder.