drupal/ai_observability_opentel_recipe

Enables Drupal AI observability + OpenTelemetry and points them at an OTLP collector (pairs with the ddev-drupal-ai-observability DDEV add-on). No AI provider, no agents.

Maintainers

Package info

git.drupalcode.org/project/ai_observability_opentel_recipe.git

Type:drupal-recipe

pkg:composer/drupal/ai_observability_opentel_recipe

Transparency log

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

1.0.0-alpha3 2026-07-20 13:14 UTC

This package is auto-updated.

Last update: 2026-07-21 14:08:55 UTC


README

Enables and configures the Drupal-side half of the AI observability setup:

  • Modules: ai + ai_observability, opentelemetry + opentelemetry_metrics + opentelemetry_logs.
  • Config: points opentelemetry.settings at the OTLP collector (http://grafana-alloy:4318, http/protobuf) and switches on ai_observability's OpenTelemetry export (spans + metrics).

It pairs with the ddev-drupal-ai-observability DDEV add-on, which provides the receiving Grafana/Tempo/Mimir/Loki/Alloy stack and the dashboards. Install the add-on first; then every AI request your site makes shows up in Grafana.

What it deliberately does NOT do

  • No AI provider — install and configure one yourself (e.g. drupal/ai_provider_openai) including its API key (use the Key module with an env-var provider; never commit keys).
  • No agents — the agent dashboards light up once you install drupal/ai_agents (≥ 1.4) and create agents; nothing here depends on it.
  • No prompt/response storageotel_spans_store_input/_output stay off (privacy default). The Grafana Message flow panel needs them:

    drush cset ai_observability.settings otel_spans_store_input true -y
    drush cset ai_observability.settings otel_spans_store_output true -y
    

    ⚠️ This stores prompt/response text (truncated ~1 KB) in your traces.

Zero-to-running with the one-line installer

This repo ships a .drupalaibp.json for the one_line_installer (drupalaibp), which builds the whole project unattended — DDEV + Drupal + the ddev-drupal-ai-observability Grafana stack + this recipe:

git clone https://git.drupalcode.org/project/ai_observability_opentel_recipe.git
cd ai_observability_opentel_recipe
bash <(curl -fsSL https://project.pages.drupalcode.org/one_line_installer/drupalaibp)

The installer detects .drupalaibp.json and runs the build from it. You land on a site where the observability pipeline is fully wired — no AI provider is installed, by design: pick whichever you want (see below), and as soon as it makes its first request it shows up traced, metered, and priced in Grafana.

Apply (recipe only, on an existing site)

The modules must be present in the codebase first (recipes don't run Composer):

ddev composer require drupal/ai_observability_opentel_recipe
ddev drush recipe:apply /var/www/html/recipes/ai_observability_opentel_recipe
ddev drush cr

(Requiring the recipe via Composer pulls drupal/ai and drupal/opentelemetry in for you — its composer.json declares both.)

After applying

  1. Install + configure an AI provider and set default models at /admin/config/ai/settings.
  2. Make an AI call — then open Grafana at https://<project>.ddev.site:3000 and check the AI Requests — Overview dashboard.
  3. Optional: drupal/ai_agents for the agent-session dashboards, and ddev sync-model-prices for live cost pricing.

Customizing the endpoint

Not on DDEV / different collector? Override after applying:

drush cset opentelemetry.settings endpoint 'http://my-collector:4318' -y