{
  "name": "MTE Relay v5",
  "description": "MTE Relay v5 (MRS/MAR) — log-based dashboard over the structured event schema. See https://relay.eclypses.com (Monitoring & Integrations → New Relic). Replace accountIds [0] with your account ID before import, or let the import dialog do it.",
  "permissions": "PUBLIC_READ_WRITE",
  "pages": [
    {
      "name": "Traffic & MTE Performance",
      "description": "Request rates, latency, and MTE phase timings from performance_event and encryption_event logs.",
      "widgets": [
        {
          "title": "Relayed requests per second",
          "layout": { "column": 1, "row": 1, "width": 6, "height": 3 },
          "visualization": { "id": "viz.line" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT rate(count(*), 1 second) AS 'req/s' FROM Log WHERE service = 'mte-relay' AND `performance_event.event_type` = 'request_timing' TIMESERIES AUTO"
              }
            ]
          }
        },
        {
          "title": "Request latency (ms) — p50 / p95 / p99",
          "layout": { "column": 7, "row": 1, "width": 6, "height": 3 },
          "visualization": { "id": "viz.line" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT percentile(numeric(`performance_event.total_time_ms`), 50, 95, 99) FROM Log WHERE service = 'mte-relay' AND `performance_event.event_type` = 'request_timing' TIMESERIES AUTO"
              }
            ]
          }
        },
        {
          "title": "Phase breakdown (avg ms): decrypt / validate / proxy / encrypt",
          "layout": { "column": 1, "row": 4, "width": 6, "height": 3 },
          "visualization": { "id": "viz.area" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT average(numeric(`performance_event.decryption_ms`)) AS 'MTE decrypt', average(numeric(`performance_event.validation_ms`)) AS 'validate', average(numeric(`performance_event.proxy_ms`)) AS 'upstream proxy', average(numeric(`performance_event.encryption_ms`)) AS 'MTE encrypt' FROM Log WHERE service = 'mte-relay' AND `performance_event.event_type` = 'phase_breakdown' TIMESERIES AUTO"
              }
            ]
          }
        },
        {
          "title": "Responses by status code",
          "layout": { "column": 7, "row": 4, "width": 6, "height": 3 },
          "visualization": { "id": "viz.stacked-bar" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT count(*) FROM Log WHERE service = 'mte-relay' AND `performance_event.event_type` = 'request_timing' FACET `performance_event.status_code` TIMESERIES AUTO"
              }
            ]
          }
        },
        {
          "title": "MTE encode/decode time (avg ms, audit events)",
          "layout": { "column": 1, "row": 7, "width": 6, "height": 3 },
          "visualization": { "id": "viz.line" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT average(numeric(`encryption_event.decryption_time_ms`)) AS 'decrypt (inbound request)', average(numeric(`encryption_event.encryption_time_ms`)) AS 'encrypt (outbound response)' FROM Log WHERE service = 'mte-relay' AND `encryption_event.event_type` IS NOT NULL TIMESERIES AUTO"
              }
            ]
          }
        },
        {
          "title": "Encrypted data volume (bytes)",
          "layout": { "column": 7, "row": 7, "width": 6, "height": 3 },
          "visualization": { "id": "viz.area" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT sum(numeric(`performance_event.encrypted_data_bytes`)) AS 'encrypted bytes', sum(numeric(`performance_event.decrypted_data_bytes`)) AS 'plaintext bytes' FROM Log WHERE service = 'mte-relay' AND `performance_event.event_type` = 'phase_breakdown' TIMESERIES AUTO"
              }
            ]
          }
        },
        {
          "title": "Requests by product / instance",
          "layout": { "column": 1, "row": 10, "width": 12, "height": 3 },
          "visualization": { "id": "viz.line" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT count(*) FROM Log WHERE service = 'mte-relay' AND `performance_event.event_type` = 'request_timing' FACET product, instance TIMESERIES AUTO"
              }
            ]
          }
        }
      ]
    },
    {
      "name": "Security & Errors",
      "description": "security_event and error_event streams: signature failures, replay signals, state-store health, recovered panics.",
      "widgets": [
        {
          "title": "High / critical security events",
          "layout": { "column": 1, "row": 1, "width": 6, "height": 3 },
          "visualization": { "id": "viz.stacked-bar" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT count(*) FROM Log WHERE service = 'mte-relay' AND `security_event.severity` IN ('high', 'critical') FACET `security_event.event_type` TIMESERIES AUTO"
              }
            ]
          }
        },
        {
          "title": "Security events by type",
          "layout": { "column": 7, "row": 1, "width": 6, "height": 3 },
          "visualization": { "id": "viz.pie" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT count(*) FROM Log WHERE service = 'mte-relay' AND `security_event.event_type` IS NOT NULL FACET `security_event.event_type`"
              }
            ]
          }
        },
        {
          "title": "Security event origins (top 10)",
          "layout": { "column": 1, "row": 4, "width": 6, "height": 3 },
          "visualization": { "id": "viz.bar" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT count(*) FROM Log WHERE service = 'mte-relay' AND `security_event.event_type` IS NOT NULL FACET `security_event.origin` LIMIT 10"
              }
            ]
          }
        },
        {
          "title": "State store failures (Redis health)",
          "layout": { "column": 7, "row": 4, "width": 6, "height": 3 },
          "visualization": { "id": "viz.line" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT count(*) FROM Log WHERE service = 'mte-relay' AND `security_event.event_type` IN ('state_save_failed', 'state_not_found', 'state_restore_failed') FACET `security_event.event_type` TIMESERIES AUTO"
              }
            ]
          }
        },
        {
          "title": "Error events (incl. panics)",
          "layout": { "column": 1, "row": 7, "width": 6, "height": 3 },
          "visualization": { "id": "viz.stacked-bar" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT count(*) FROM Log WHERE service = 'mte-relay' AND `error_event.event_type` IS NOT NULL FACET `error_event.event_type` TIMESERIES AUTO"
              }
            ]
          }
        },
        {
          "title": "Recent high-severity events",
          "layout": { "column": 7, "row": 7, "width": 6, "height": 3 },
          "visualization": { "id": "viz.table" },
          "rawConfiguration": {
            "nrqlQueries": [
              {
                "accountIds": [0],
                "query": "SELECT timestamp, `security_event.event_type`, `security_event.origin`, `security_event.reason`, correlation_id FROM Log WHERE service = 'mte-relay' AND `security_event.severity` IN ('high', 'critical') LIMIT 50"
              }
            ]
          }
        }
      ]
    }
  ]
}
