{
  "annotations": {
    "list": []
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 1,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "title": "Traductions (dernières 24h)",
      "type": "stat",
      "gridPos": { "h": 4, "w": 6, "x": 0, "y": 0 },
      "targets": [
        {
          "expr": "sum(increase(translation_total[24h]))",
          "legendFormat": "Total"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "thresholds": {
            "steps": [
              { "color": "blue", "value": null },
              { "color": "green", "value": 10 },
              { "color": "orange", "value": 50 }
            ]
          },
          "unit": "none"
        }
      }
    },
    {
      "title": "Temps moyen (secondes)",
      "type": "stat",
      "gridPos": { "h": 4, "w": 6, "x": 6, "y": 0 },
      "targets": [
        {
          "expr": "avg(rate(translation_duration_seconds_sum[5m]) / rate(translation_duration_seconds_count[5m]))",
          "legendFormat": "Avg"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "thresholds": {
            "steps": [
              { "color": "green", "value": null },
              { "color": "yellow", "value": 30 },
              { "color": "red", "value": 60 }
            ]
          },
          "unit": "s"
        }
      }
    },
    {
      "title": "Taux d'erreur (%)",
      "type": "stat",
      "gridPos": { "h": 4, "w": 6, "x": 12, "y": 0 },
      "targets": [
        {
          "expr": "sum(rate(http_requests_total{status=~\"5..\"}[5m])) / sum(rate(http_requests_total[5m])) * 100",
          "legendFormat": "Error %"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "thresholds": {
            "steps": [
              { "color": "green", "value": null },
              { "color": "yellow", "value": 1 },
              { "color": "red", "value": 5 }
            ]
          },
          "unit": "percent",
          "max": 100
        }
      }
    },
    {
      "title": "Utilisateurs actifs (1h)",
      "type": "stat",
      "gridPos": { "h": 4, "w": 6, "x": 18, "y": 0 },
      "targets": [
        {
          "expr": "count(increase(http_requests_total{path!=\"/health\",path!=\"/metrics\"}[1h]) > 0)",
          "legendFormat": "Active"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "thresholds" },
          "thresholds": {
            "steps": [
              { "color": "blue", "value": null },
              { "color": "green", "value": 5 }
            ]
          }
        }
      }
    },
    {
      "title": "Requetes par minute (par endpoint)",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 0, "y": 4 },
      "targets": [
        {
          "expr": "sum by (path) (rate(http_requests_total[5m]) * 60)",
          "legendFormat": "{{path}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "palette-classic" },
          "custom": {
            "lineWidth": 2,
            "fillOpacity": 10
          },
          "unit": "req/min"
        }
      }
    },
    {
      "title": "Temps de traduction (percentiles)",
      "type": "timeseries",
      "gridPos": { "h": 8, "w": 12, "x": 12, "y": 4 },
      "targets": [
        {
          "expr": "histogram_quantile(0.5, sum(rate(translation_duration_seconds_bucket[5m])) by (le))",
          "legendFormat": "p50"
        },
        {
          "expr": "histogram_quantile(0.95, sum(rate(translation_duration_seconds_bucket[5m])) by (le))",
          "legendFormat": "p95"
        },
        {
          "expr": "histogram_quantile(0.99, sum(rate(translation_duration_seconds_bucket[5m])) by (le))",
          "legendFormat": "p99"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": { "mode": "palette-classic" },
          "custom": {
            "lineWidth": 2,
            "fillOpacity": 5
          },
          "unit": "s"
        }
      }
    },
    {
      "title": "Traductions par provider",
      "type": "piechart",
      "gridPos": { "h": 8, "w": 8, "x": 0, "y": 12 },
      "targets": [
        {
          "expr": "sum by (provider) (increase(translation_total[24h]))",
          "legendFormat": "{{provider}}"
        }
      ]
    },
    {
      "title": "Taille des fichiers uploades",
      "type": "histogram",
      "gridPos": { "h": 8, "w": 8, "x": 8, "y": 12 },
      "targets": [
        {
          "expr": "sum by (le) (increase(file_size_bytes_bucket[24h]))",
          "legendFormat": "{{le}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes"
        }
      }
    },
    {
      "title": "Fichiers par type",
      "type": "piechart",
      "gridPos": { "h": 8, "w": 8, "x": 16, "y": 12 },
      "targets": [
        {
          "expr": "sum by (file_type) (increase(translation_total[24h]))",
          "legendFormat": "{{file_type}}"
        }
      ]
    }
  ],
  "refresh": "30s",
  "schemaVersion": 39,
  "tags": ["wordly", "application"],
  "templating": { "list": [] },
  "time": { "from": "now-24h", "to": "now" },
  "timepicker": {},
  "timezone": "Europe/Paris",
  "title": "Wordly - Application",
  "uid": "wordly-app",
  "version": 1
}
