Datadog and Grafana dashboards (community)
Two importable dashboards and three Datadog monitor templates for the OTLP data Shield KYA already exports. They are community dashboards kept in this repo. They are not an official Datadog integration, Marketplace tile, or Grafana plugin.
| File | What it is |
|---|---|
integrations/datadog/kya-dashboard.json |
Datadog dashboard (ordered layout, template variables service, env, hosted_service) |
integrations/datadog/monitors.json |
Three monitor bodies: DENY spike, never-list hit, no decision spans for 30 minutes |
integrations/grafana/kya-dashboard.json |
Grafana dashboard (schemaVersion 42, Grafana 12.3 or newer) with ${DS_TEMPO} and ${DS_PROMETHEUS} import inputs |
integrations/otlp-fields.json |
Every span attribute and metric name the dashboards may use, read from the emitting code |
The files are not in the npm package. Take them from the GitHub repo; they are in the public repo from the first release that includes them.
What the panels read
The decision-span and connected-mode names below were captured from a real kya run (see How the field list is checked). The hosted-only names were not captured: they are read from the hosted plane source.
Decision spans (service.name=shield-kya-cli, one span per decision, see otlp.md):
- DENY, REQUIRE_APPROVE, never-list hits (
kya.reason_code=NEVER_EVENT) - Gate failures:
PLANE_UNREACHABLEandPLANE_AUTH_REJECTED(MCP gate could not reach or authenticate to the hosted plane; recorded as DENY) andFAIL_CLOSED(opt-in fail-closed hook hit an internal error) - Decisions over time by
kya.verdict - Top deny reasons by
kya.reason_code - Tool calls by tool (
gen_ai.tool.name, top 10) - Decisions by gate host (
kya.host:ideorruntime) and mode (kya.mode:observe,hold,offline)
Connected mode only: the kya.client.evaluate.latency histogram, tagged verdict and host. Panels: decision mix and evaluate latency p50 / p95. It is recorded only when the CLI calls the hosted plane evaluate API with KYA_OTLP_ENDPOINT set, and the CLI exports metrics every 15 seconds without a flush on exit. In practice that means a connected, long-lived MCP gate or gateway. Hooks always evaluate offline and never emit it; offline and keyless gates never emit it either.
Hosted only (hosted plane with KYA_OTLP_ENABLED=true): decision counters (kya.policy.deny, kya.policy.require_approve, kya.policy.approve_granted, kya.evaluate.count), evaluate latency (kya.evaluate.latency, kya.evaluate.max_ms), kill latency against its SLO (kya.kill.last_ms, kya.kill.slo_ms), and PII redaction hits (kya.redaction.hits). These names come from the hosted plane source. They are not in the captured fixture.
Send KYA data to Datadog
Run a Datadog Agent with OTLP ingest, or an OpenTelemetry Collector with the datadog exporter, on the same host. Keep DD_API_KEY on the Agent or Collector, not in the KYA process. The sample Collector config is otel-collector-kya.yaml.
# Verdict spans (OSS CLI). Long-lived MCP gate / gateway exports every verdict.
export KYA_OTLP_EXPORT_ENDPOINT=http://127.0.0.1:4318
# Evaluate-latency metric (OSS CLI, connected mode only).
export KYA_OTLP_ENDPOINT=http://127.0.0.1:4318
.kya/config.json works too: { "otlpExport": { "endpoint": "http://127.0.0.1:4318" } }. For the hosted plane, see otlp.md, Hosted plane.
Import the dashboard with POST /api/v1/dashboard and the file as the body, or create an empty dashboard and use Configure > Import dashboard JSON (this overwrites that dashboard). Create each entry of monitors.json with POST /api/v1/monitor, one body per call. Add your notification handle to each message first.
Datadog setup the dashboard needs:
- A custom APM retention filter on
service:shield-kya-cli. Span widgets andtrace-analyticsmonitors only see indexed spans. Datadog states that Analytics monitors evaluate only spans kept by custom retention filters, not the intelligent retention filter. - Facets for
@kya.verdict,@kya.reason_code,@kya.host,@kya.modeand@gen_ai.tool.nameare recommended so they show in the Trace Explorer facet panel and group-by pickers (Datadog facets doc below). - Delta temporality is not available from the CLI. The CLI histogram is cumulative. Datadog converts cumulative histograms to distributions from the second point onward and recommends delta, so the first export after a CLI start is not counted.
- Percentiles on the distribution
kya.client.evaluate.latencymust be enabled in the metric settings for the p50 / p95 panel. - The
envtemplate variable only filters when your Agent or Collector adds anenvtag (KYA does not setdeployment.environment).
Send KYA data to Grafana
The Grafana dashboard reads spans from Tempo with TraceQL and metrics from Prometheus (or Mimir / Grafana Cloud) with PromQL. Point the same env vars at an OpenTelemetry Collector or Grafana Alloy that forwards traces to Tempo and metrics to Prometheus:
export KYA_OTLP_EXPORT_ENDPOINT=http://127.0.0.1:4318 # spans -> Tempo
export KYA_OTLP_ENDPOINT=http://127.0.0.1:4318 # metric -> Prometheus (connected mode only)
Import: Dashboards > New > Import, upload grafana/kya-dashboard.json, then pick your Tempo and Prometheus data sources for the DS_TEMPO and DS_PROMETHEUS inputs. The HTTP API works too: POST /api/dashboards/import with the file as dashboard and both inputs set (without them, Grafana refuses the import with missing dashboard input variable DS_TEMPO). The service variable defaults to shield-kya-cli, and hosted_job defaults to shield-agent (the hosted plane’s spring.application.name).
Grafana setup the dashboard needs:
- Tempo 2.8 or newer with TraceQL metrics enabled. On Tempo 2.x, turn on the
local-blocksprocessor (metrics_generator.processor.local_blocksandprocessors: [local-blocks]in the overrides). Tempo 3.x removed that processor (Tempo 3.1.0 does not start with those config keys) and serves TraceQL metrics without extra config. Every span panel usescount_over_time(), and the top-N panels usetopk(10), which older Tempo versions reject. - Prometheus naming. The PromQL assumes the Prometheus OTLP receiver default,
UnderscoreEscapingWithSuffixes: dots become underscores, unitmsadds_milliseconds, histograms get_bucket/_sum/_count, andservice.namebecomes thejoblabel. Sokya.client.evaluate.latencyis queried askya_client_evaluate_latency_milliseconds_bucket{job="shield-kya-cli"}. Grafana Cloud and the Collector / Alloy Prometheus exporters add these suffixes. Self-hosted Mimir’s OTLP endpoint drops unit suffixes by default (otel_metric_suffixes_enabledis false), so the latency and evaluate-count panels come back empty there: route OTLP through a Collector or Alloy, enableotel_metric_suffixes_enabled, or remove_millisecondsfrom those queries. If your pipeline keeps UTF-8 names, adjust the queries too. - File provisioning. Grafana provisioning does not fill the import inputs. A provisioned copy of the file loads, but its panels ask for the data source
${DS_TEMPO}and fail withData source not found. Before you provision the file, replace${DS_TEMPO}and${DS_PROMETHEUS}with the uids of your data sources, for examplesed -e 's/\${DS_TEMPO}/my-tempo-uid/g' -e 's/\${DS_PROMETHEUS}/my-prom-uid/g'.
Honest limits
- ALLOW is undercounted from hook-based gates. Hook and wrap gates (for example Claude Code hooks) export only DENY and REQUIRE_APPROVE spans. Only the long-lived MCP gate or gateway exports ALLOW. A hook-only setup will look close to 100% deny or review. The connected-mode metric does not fix this: it also needs a long-lived connected gate.
- No hold or approval latency panel. KYA does not export approval wait time over OTLP today. Decision spans have zero duration.
- No export-failure or fail-open panel. Failed exports are counted only in local
~/.kya/otel-stats.json, not sent anywhere. A default hook that fails open lets the call through without a span, so fail-open events are invisible here; only opt-in fail-closed hooks emitFAIL_CLOSED. - Do not group
kya.client.evaluate.latencyor the hostedkya.evaluate.latencybyhostin Datadog. Both carry ahostattribute (ide/runtime) that becomes a tag on Datadog’s reservedhostkey, which normally names the reporting machine. The dashboard never groups by it, and the validator rejects a Datadog metric query that does. - The silence monitor only makes sense with the MCP gate or gateway. With hooks only, 30 quiet minutes can just mean no denies.
- Grafana: tested live, Datadog: not tested. On 2026-10-20 the maintainers imported the Grafana dashboard through the HTTP API into Grafana 12.4.13 and 13.2.4, with Tempo 2.8.3 and 3.1.0 and Prometheus v3.13.4 (OTLP receiver) in containers. The span and connected-mode data was the captured OTLP from a real
kyarun (see below), replayed with new timestamps. The hosted-only metrics were synthetic, shaped like the hosted plane’s Micrometer gauges and timer. Every panel query ran without errors and returned data, and the file-provisioning path behaved as described above. Not covered: how the panels look in a browser, Grafana Cloud, Mimir and Alloy. The Datadog files follow Datadog’s published JSON schemas and are checked byscripts/validate-dashboards.mjs, but have not been tried against a real Datadog org.
How the field list is checked
pnpm test runs test/dashboards.test.ts, which:
- parses every file and checks the required top-level keys for each format;
- rejects unscoped TraceQL attributes (
.kya.verdict), Datadog span facets without@, and hard-coded values (decisions, modes, hosts, the reason codes the panels filter on) that KYA does not emit; - extracts every span attribute and metric name from the Datadog, TraceQL and PromQL queries and fails if one is not in
integrations/otlp-fields.json; - checks that
otlp-fields.jsonmatches the attribute keys insrc/otel/exporter.tsand the histogram insrc/otel.ts; - checks that every OSS name a dashboard uses appears in
test/fixtures/otlp-capture.json. That fixture holds the OTLP/JSON bodies a realkya serve-mcp --stdiorun sent to a local receiver: ALLOW, REQUIRE_APPROVE, a never-list DENY forpostgres__drop_table, aPLANE_UNREACHABLEDENY, and the evaluate-latency metric.
Run it alone with node scripts/validate-dashboards.mjs.
Sources
- Datadog dashboard JSON: https://docs.datadoghq.com/api/latest/dashboards/create-a-new-dashboard
- Datadog monitor JSON and types: https://docs.datadoghq.com/api/latest/monitors/create-a-monitor
- Datadog APM monitors and retention filters: https://docs.datadoghq.com/monitors/types/apm
- Datadog dashboard JSON import (Configure menu): https://docs.datadoghq.com/dashboards/configure
- Datadog span facets: https://docs.datadoghq.com/tracing/trace_explorer/facets
- Datadog OTLP metric mapping: https://docs.datadoghq.com/metrics/open_telemetry/otlp_metric_types
- Grafana dashboard JSON model: https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/view-dashboard-json-model/
- Tempo TraceQL metrics: https://grafana.com/docs/tempo/latest/metrics-from-traces/metrics-queries/
- Prometheus OTLP naming: https://prometheus.io/docs/guides/opentelemetry/