This project is not covered by Drupal’s security advisory policy.

Turns on Drupal's AI observability and OpenTelemetry modules and points them at an OTLP collector, so every AI request produces traces, metrics, and logs you can read in Grafana. It installs no AI provider and no agents, so you decide which model to plug in.

The recipe wires together the pieces that are tedious to configure by hand: the OpenTelemetry endpoint, the export protocol, and the AI observability switches for logging, spans, and metrics. Apply it, add a provider, make a request, and the request shows up on a dashboard.


Features

  • Installs ai, ai_observability, opentelemetry, opentelemetry_metrics, and opentelemetry_logs.
  • Sets the OpenTelemetry endpoint to http://grafana-alloy:4318 over HTTP/protobuf, matching the Alloy receiver shipped by the ddev-drupal-ai-observability add-on.
  • Enables AI observability logging, OpenTelemetry export, spans, and metrics.
  • Leaves input and output span storage off by default, so prompts and responses stay out of your traces unless you opt in.

No provider, no agents, on purpose

This recipe configures observability only. It does not install an AI provider or any agents, so it stays neutral about which model you run and carries no API keys. Add a provider such as ai_provider_openai after applying it.


Installation

To spin up a full test environment from scratch you can use the One Line Installer to setup the environment and apply the recipe for demoing purposes:

bash <(curl -fsSL https://git.drupalcode.org/project/one_line_installer/-/raw/2.0.x/drupalaibp)  https://git.drupalcode.org/project/ai_observability_opentel_recipe/

The installer builds the site, adds the companion ddev-drupal-ai-observability add-on for the Grafana and Alloy stack, and applies this recipe for you.

To apply the recipe on an existing site instead:

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

See your first trace

Configure an AI provider at /admin/config/ai/settings, make an AI request, then open the AI Requests overview dashboard in Grafana at https://project-name.ddev.site:3000.


Requirements

  • drupal/ai 1.4 or newer
  • drupal/opentelemetry 1.0-beta or newer
  • An OTLP collector to receive the data. The ddev-drupal-ai-observability DDEV add-on provides one out of the box; point the endpoint elsewhere if you run your own.

Input and output span storage is off by default to keep prompt and response text out of your traces. The Grafana "Message flow" panel needs it, so turn it on deliberately with drush cset ai_observability.settings otel_spans_store_input true -y and the matching otel_spans_store_output key. Stored text is truncated to roughly 1 KB.


Change the collector endpoint

The recipe targets the add-on's Alloy receiver. To send data somewhere else, override the endpoint:

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

Supporting organizations: 
Development Time

Project information

Releases