Skip to main content

What are Instrumentations?

Glass is built on OpenTelemetry, the industry-standard for observability. OpenTelemetry uses instrumentations to automatically capture traces from libraries and frameworks — without you changing any code. When you call init(), Glass automatically instruments your AI providers. Every API call is traced with request/response data, token usage, latency, and errors.

Default Instrumentations

Glass automatically instruments these AI providers out of the box:
Default instrumentations are enabled automatically. No configuration needed.
Each traced call captures:
  • Request and response payloads
  • Token usage (input/output/total)
  • Model name and parameters
  • Latency
  • Errors and exceptions

Adding Custom Instrumentations

Need to trace other libraries? You can add any OpenTelemetry-compatible instrumentation.

Example: Adding HTTP Request Tracing

Now all requests library calls are traced alongside your AI calls.

Example: Instrumenting Ollama

For local models served via Ollama, use the Ollama instrumentation:
Install it with pip install opentelemetry-instrumentation-ollama.

Example: Multiple Custom Instrumentations

Custom instrumentations are added on top of the defaults. Your AI providers are still traced automatically.

Disabling Default Instrumentations

If you want full control over what gets instrumented, disable the defaults:

Here are commonly used instrumentations for AI/ML workflows:

OpenTelemetry Registry

Browse all available Python instrumentations in the OpenTelemetry Registry.