# Native Observability — ECA Bridge Demo

Installs ready-to-use ECA models that demonstrate the events exposed by
`native_observability_eca_bridge`.

This module is intended for local verification, QA, and examples. It imports
working ECA configuration into Drupal, so the rules appear at:

```text
/admin/config/workflow/eca
```

## Requirements

Enable the bridge and ECA modeler dependencies first:

```bash
composer require drupal/bpmn_io
drush pm:install bpmn_io native_observability_eca_bridge
```

`bpmn_io` is needed by ECA's visual model UI. The bridge module enables the ECA
runtime modules declared in its `.info.yml`.

## Install the demo rules

```bash
drush pm:install native_observability_eca_bridge_demo
```

The module installs these ECA config entities from `config/install/`:

| Config entity | What it demonstrates |
|---|---|
| `eca.eca.no_demo_log_all_traces` | Logs every recorded trace |
| `eca.eca.no_demo_500_errors` | Logs only traces with status code `500` |
| `eca.eca.no_demo_slow_requests` | Logs only traces where duration is at least `3000` ms |
| `eca.eca.no_demo_ajax_requests` | Logs only AJAX traces |
| `eca.eca.no_demo_traces_deleted` | Logs bulk trace deletion events |

All demo rules write to Drupal's watchdog channel `native_observability`.

## Verify the demo rules

Confirm the config entities were installed:

```bash
drush config:get eca.eca.no_demo_log_all_traces id
drush config:get eca.eca.no_demo_500_errors id
drush config:get eca.eca.no_demo_slow_requests id
drush config:get eca.eca.no_demo_ajax_requests id
drush config:get eca.eca.no_demo_traces_deleted id
```

Generate site traffic, then inspect the watchdog log:

```bash
drush watchdog:show --type=native_observability --count=20
```

Expected examples:

```text
GET node.view -> 200 (42ms)
500 error on GET system.404 (duration: 18ms)
Slow request: GET custom.route took 3500ms (status: 200)
AJAX: POST views.ajax -> 200 (90ms)
Bulk deletion: 7 trace records removed.
```

## Notes

The `no_demo_log_all_traces` model can create many watchdog entries on a busy
site. Keep the demo module for validation and examples; copy only the rules you
need into project-specific configuration for production.
