Skip to content

Drush commands

Native Observability ships seven Drush commands across three modules: native_observability (base), native_observability_metrics, and native_observability_spans. All commands are available once the owning module is enabled.

native_observability:preset:raw

Class: PresetInstallCommands::presetRaw. Alias: no:preset:raw.

Enables the RAW tier: native_observability, native_observability_spans, native_observability_metrics, native_observability_cache_observer, native_observability_export. No arguments or options.

drush no:preset:raw

Prints the module list for the tier, which modules were already enabled and skipped, which were newly installed, and next-step hints (configure the Prometheus bearer token before exposing the scrape endpoint publicly).

native_observability:preset:dashboard

Class: PresetInstallCommands::presetDashboard. Alias: no:preset:dashboard.

Enables the DASHBOARD tier: RAW plus native_observability_execution, native_observability_database_observer, native_observability_dashboard, native_observability_report, native_observability_status_block. No arguments or options.

drush no:preset:dashboard

Prints the same style of module summary as preset:raw, plus a hint pointing to /admin/reports/native-observability/dashboard.

native_observability:preset:integrations

Class: PresetInstallCommands::presetIntegrations. Alias: no:preset:integrations.

Enables the INTEGRATIONS tier: DASHBOARD plus native_observability_otel and native_observability_eca_bridge. No arguments or options. native_observability_eca_bridge_demo is excluded by design and must be enabled separately.

drush no:preset:integrations

Prints the module summary plus hints for configuring the OTLP endpoint and a note that the ECA bridge events are now available to ECA models.

On a clean site, the very first preset invocation needs the base module enabled first, because Drush only discovers a module's commands once that module is enabled:

drush en native_observability -y
drush no:preset:raw

native_observability:sanity-check

Class: SanityCheckCommands::sanityCheck. Alias: no:sanity-check.

Runs ServiceIntegrityInspector::inspect() and prints a table with columns Status, Point, Owner, Detail, one row per checked integration point (decorators, wrappers, middleware, subscribers). No arguments or options.

drush no:sanity-check

Exit code is 0 when the overall status is green or amber (a warning), and 1 when the overall status is error (a conflicting override), so the command can gate test scripts.

native_observability:token:generate

Class: TokenCommands::generate. Alias: no:token:generate.

Argument: target, one of prometheus, otlp, or all (default all).

drush no:token:generate all
drush no:token:generate prometheus
drush no:token:generate otlp

Generates a 32-byte random value (64 hex characters) per target and stores it in Drupal State:

Target State key
prometheus native_observability_export.secret.prometheus_bearer_token
otlp native_observability_otel.otlp_bearer_token

A target whose owning module is not enabled is skipped with a warning. The generated token is printed once in the command output; it is never shown again, matching the write-only behavior of the corresponding settings form fields.

native-observability-metric:aggregate

Class: NativeObservabilityMetricsCommands::aggregate. Alias: nom:aggregate.

Options:

Option Description
--rolling Enable rolling window aggregation. Accepts 1 or 0; command default 0
--seconds Rolling window duration in seconds, used only when --rolling=1; command default 300
drush native-observability-metric:aggregate
drush native-observability-metric:aggregate --rolling=1 --seconds=300

Without --rolling, aggregates the latest completed metrics window via RouteMetricsAggregator::aggregateLatestCompletedWindow. With --rolling=1, aggregates a rolling window ending now via aggregateRollingWindow($seconds). Prints a table with columns Route, Requests, Throughput / min, Avg duration (ms), P95 (ms), P99 (ms). When no metrics are generated, prints a warning and still returns success.

native-observability-span:http-test

Class: NativeObservabilitySpansCommands::httpTest. Alias: nos:http-test.

Options:

Option Description
--timeout Request timeout in seconds; command default 8
--connect-timeout Connection timeout in seconds; command default 4
drush native-observability-span:http-test
drush native-observability-span:http-test --timeout=5 --connect-timeout=2

Runs a fixed set of outbound HTTP calls through Drupal's http_client service (example.com, Google's generate_204, two httpbin.org status endpoints, and one call to a non-resolving host to exercise the DNS-failure path). Prints a table with columns Test, Method, URL, Status, Error, Body (response body truncated to 250 characters). Purely diagnostic: it validates that the HTTP client decoration used for span generation is producing spans, without asserting on trace storage itself.

Naming note

The preset, sanity-check, and token commands use the underscore namespace native_observability:*. The metric and span commands use the hyphenated namespace native-observability-metric:* and native-observability-span:*. Both forms are correct; use whichever full name or alias is shown above for each command.