Skip to main content
Doku can automatically send LLM usage data from Doku to Grafana Cloud using the Grafana Cloud Influx Telegraf and Loki Push HTTP API Add the following to your doku configuration file(doku.yml).
doku.yml
observabilityPlatform:
  enabled: true                                               # Enable or Disable the Observability Platform, Example: true
    grafanaCloud:
      promUrl: <your-grafana-cloud-influx-line-proxy-url>     # URL to the Influx Line Proxy URL of the Grafana Cloud Prometheus Instance
      promUsername: <your-prometheus-userid>                  # Prometheus User ID of the Grafana Cloud Prometheus Instance
      lokiUrl: <your-loki-push-url>                           # URL to the Loki Push URL of the Grafana Cloud Loki Instance
      lokiUsername: <your-loki-username>                      # Loki Username of the Grafana Cloud Loki Instance
      accessToken: <your-grafana-cloud-access-token>          # Access Token of the Grafana Cloud Instance

Grafana Resources

{
"annotations": {
  "list": [
    {
      "builtIn": 1,
      "datasource": {
        "type": "grafana",
        "uid": "-- Grafana --"
      },
      "enable": true,
      "hide": true,
      "iconColor": "rgba(0, 211, 255, 1)",
      "name": "Annotations & Alerts",
      "type": "dashboard"
    }
  ]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 14,
"links": [
  {
    "icon": "info",
    "tags": [],
    "targetBlank": true,
    "title": "Doku Documentation",
    "tooltip": "",
    "type": "link",
    "url": "https://docs.dokulabs.com/"
  },
  {
    "icon": "info",
    "tags": [],
    "targetBlank": true,
    "title": "Doku Community",
    "tooltip": "",
    "type": "link",
    "url": "https://dokulabs.slack.com/"
  },
  {
    "icon": "info",
    "tags": [],
    "targetBlank": true,
    "title": "Dokulabs GitHub",
    "tooltip": "",
    "type": "link",
    "url": "https://github.com/dokulabs/"
  }
],
"liveNow": false,
"panels": [
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "gridPos": {
      "h": 4,
      "w": 11,
      "x": 0,
      "y": 0
    },
    "id": 23,
    "options": {
      "code": {
        "language": "plaintext",
        "showLineNumbers": false,
        "showMiniMap": false
      },
      "content": "---\n---\n---\n---\n---\n---",
      "mode": "markdown"
    },
    "pluginVersion": "10.4.0-65875",
    "transparent": true,
    "type": "text"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "gridPos": {
      "h": 4,
      "w": 2,
      "x": 11,
      "y": 0
    },
    "id": 2,
    "options": {
      "code": {
        "language": "plaintext",
        "showLineNumbers": false,
        "showMiniMap": false
      },
      "content": "![Doku Logo](https://github.com/dokulabs/.github/blob/main/profile/assets/favicon.png?raw=true)",
      "mode": "markdown"
    },
    "pluginVersion": "10.4.0-65875",
    "transparent": true,
    "type": "text"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "gridPos": {
      "h": 4,
      "w": 11,
      "x": 13,
      "y": 0
    },
    "id": 22,
    "options": {
      "code": {
        "language": "plaintext",
        "showLineNumbers": false,
        "showMiniMap": false
      },
      "content": "---\n---\n---\n---\n---\n---",
      "mode": "markdown"
    },
    "pluginVersion": "10.4.0-65875",
    "transparent": true,
    "type": "text"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "This panel shows the total number of requests sent to Large Language Models (LLM) Platforms in the selected time interval.",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "thresholds"
        },
        "mappings": [],
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {
              "color": "green",
              "value": null
            },
            {
              "color": "red",
              "value": 80
            }
          ]
        },
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 3,
      "w": 6,
      "x": 0,
      "y": 4
    },
    "id": 3,
    "options": {
      "colorMode": "background",
      "graphMode": "area",
      "justifyMode": "auto",
      "orientation": "auto",
      "reduceOptions": {
        "calcs": [
          "lastNotNull"
        ],
        "fields": "",
        "values": false
      },
      "showPercentChange": false,
      "textMode": "auto",
      "wideLayout": true
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "count_over_time(doku_llm_requestDuration{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}[$__interval])",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT count(*) FROM DOKU\nWHERE $__timeFilter(time)",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "name": "COUNT",
              "parameters": [
                {
                  "name": "environment",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      }
    ],
    "title": "Total Requests",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "sum"
              ],
              "operation": "aggregate"
            },
            "job": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      }
    ],
    "transparent": true,
    "type": "stat"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "This panel shows the average time taken to process each request by the Large Language Models (LLM), offering a snapshot of system performance and efficiency.",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "thresholds"
        },
        "mappings": [],
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {
              "color": "green",
              "value": null
            },
            {
              "color": "red",
              "value": 5
            }
          ]
        },
        "unit": "s",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 3,
      "w": 4,
      "x": 6,
      "y": 4
    },
    "id": 4,
    "options": {
      "colorMode": "background",
      "graphMode": "area",
      "justifyMode": "auto",
      "orientation": "auto",
      "reduceOptions": {
        "calcs": [
          "lastNotNull"
        ],
        "fields": "",
        "values": false
      },
      "showPercentChange": false,
      "textMode": "auto",
      "wideLayout": true
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "doku_llm_requestDuration{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT AVG(requestduration) FROM doku\nWHERE $__timeFilter(time)",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "name": "AVG",
              "parameters": [
                {
                  "name": "requestduration",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      }
    ],
    "title": "Avg Request Duration",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "mean"
              ],
              "operation": "aggregate"
            },
            "job": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      }
    ],
    "transparent": true,
    "type": "stat"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "This panel shows the average count of Total tokens used per LLM request",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "thresholds"
        },
        "mappings": [],
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {
              "color": "green",
              "value": null
            },
            {
              "color": "red",
              "value": 1000
            }
          ]
        },
        "unit": "none",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 3,
      "w": 4,
      "x": 10,
      "y": 4
    },
    "id": 5,
    "options": {
      "colorMode": "background",
      "graphMode": "area",
      "justifyMode": "auto",
      "orientation": "auto",
      "reduceOptions": {
        "calcs": [
          "lastNotNull"
        ],
        "fields": "",
        "values": false
      },
      "showPercentChange": false,
      "textMode": "auto",
      "wideLayout": true
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "doku_llm_totalTokens{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT AVG(totaltokens) FROM doku\nWHERE $__timeFilter(time)",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "name": "AVG",
              "parameters": [
                {
                  "name": "totaltokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      }
    ],
    "title": "Avg Tokens per Request",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "mean"
              ],
              "operation": "aggregate"
            },
            "job": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      }
    ],
    "transparent": true,
    "type": "stat"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "This panel shows the average cost incurred per request to the LLM, helping monitor and optimize budget allocation for LLM usage.",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "thresholds"
        },
        "mappings": [],
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {
              "color": "green",
              "value": null
            },
            {
              "color": "red",
              "value": 5
            }
          ]
        },
        "unit": "currencyUSD",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 3,
      "w": 4,
      "x": 14,
      "y": 4
    },
    "id": 6,
    "options": {
      "colorMode": "background",
      "graphMode": "area",
      "justifyMode": "auto",
      "orientation": "auto",
      "reduceOptions": {
        "calcs": [
          "lastNotNull"
        ],
        "fields": "",
        "values": false
      },
      "showPercentChange": false,
      "textMode": "auto",
      "wideLayout": true
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "doku_llm_usageCost{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT AVG(usagecost) FROM doku \nWHERE $__timeFilter(time)",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "name": "AVG",
              "parameters": [
                {
                  "name": "usagecost",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      }
    ],
    "title": "Avg Cost / Request",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "mean"
              ],
              "operation": "aggregate"
            },
            "job": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      }
    ],
    "transparent": true,
    "type": "stat"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "This panel shows the total cost on LLM requests over the selected period.",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "continuous-BlPu"
        },
        "mappings": [],
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {
              "color": "green",
              "value": null
            }
          ]
        },
        "unit": "currencyUSD",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 3,
      "w": 6,
      "x": 18,
      "y": 4
    },
    "id": 10,
    "options": {
      "colorMode": "background",
      "graphMode": "area",
      "justifyMode": "auto",
      "orientation": "auto",
      "reduceOptions": {
        "calcs": [
          "lastNotNull"
        ],
        "fields": "",
        "values": false
      },
      "showPercentChange": false,
      "textMode": "auto",
      "wideLayout": true
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "doku_llm_usageCost{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT SUM(usagecost) FROM doku\nWHERE $__timeFilter(time)",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "name": "SUM",
              "parameters": [
                {
                  "name": "usagecost",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      }
    ],
    "title": "Total Cost",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "sum"
              ],
              "operation": "aggregate"
            },
            "job": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      }
    ],
    "transparent": true,
    "type": "stat"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "This panel shows the count of API requests made to LLMs over the selected time.",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "continuous-BlPu"
        },
        "custom": {
          "axisBorderShow": false,
          "axisCenteredZero": false,
          "axisColorMode": "series",
          "axisGridShow": true,
          "axisLabel": "",
          "axisPlacement": "auto",
          "barAlignment": 0,
          "drawStyle": "line",
          "fillOpacity": 54,
          "gradientMode": "hue",
          "hideFrom": {
            "legend": false,
            "tooltip": false,
            "viz": false
          },
          "insertNulls": false,
          "lineInterpolation": "smooth",
          "lineStyle": {
            "dash": [
              10,
              10
            ],
            "fill": "dash"
          },
          "lineWidth": 2,
          "pointSize": 5,
          "scaleDistribution": {
            "type": "linear"
          },
          "showPoints": "always",
          "spanNulls": true,
          "stacking": {
            "group": "A",
            "mode": "none"
          },
          "thresholdsStyle": {
            "mode": "off"
          }
        },
        "fieldMinMax": false,
        "mappings": [],
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {
              "color": "green",
              "value": null
            }
          ]
        },
        "unit": "none",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 5,
      "w": 24,
      "x": 0,
      "y": 7
    },
    "id": 17,
    "options": {
      "legend": {
        "calcs": [],
        "displayMode": "list",
        "placement": "bottom",
        "showLegend": false
      },
      "tooltip": {
        "mode": "single",
        "sort": "none"
      }
    },
    "pluginVersion": "10.2.3",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "count(count_over_time(doku_llm_requestDuration{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}[$__interval]))",
        "format": "time_series",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "Requests",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT\n  DATE_TRUNC('day', \"time\") AS \"time\",\n  COUNT(endpoint) AS total_requests\nFROM \n  doku\nWHERE\n  $__timeFilter(\"time\")\nGROUP BY \n  DATE_TRUNC('day', \"time\")\nORDER BY \n  \"time\";",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "alias": "\"Prompt Tokens\"",
              "parameters": [
                {
                  "name": "prompttokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            },
            {
              "alias": "\"time\"",
              "parameters": [
                {
                  "name": "\"time\"",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            },
            {
              "alias": "\"Completion Tokens\"",
              "parameters": [
                {
                  "name": "completiontokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            },
            {
              "alias": "\"Total Tokens\"",
              "parameters": [
                {
                  "name": "totaltokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      }
    ],
    "title": "Total Requests overtime",
    "transformations": [],
    "type": "timeseries"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "This panel illustrates the distribution of LLM requests across different usage categories: Chat Generations, Embeddings, Image Generations, Audio Generations, and Fine Tuning. It visualizes the relative volume of requests, helping to identify which types of operations are most frequently performed and providing insights into usage patterns by category.",
    "fieldConfig": {
      "defaults": {
        "color": {
          "fixedColor": "blue",
          "mode": "palette-classic"
        },
        "custom": {
          "hideFrom": {
            "legend": false,
            "tooltip": false,
            "viz": false
          }
        },
        "mappings": [],
        "unit": "none",
        "unitScale": true
      },
      "overrides": [
        {
          "__systemRef": "hideSeriesFrom",
          "matcher": {
            "id": "byNames",
            "options": {
              "mode": "exclude",
              "names": [
                "Value (sum)",
                "Chat"
              ],
              "prefix": "All except:",
              "readOnly": true
            }
          },
          "properties": [
            {
              "id": "custom.hideFrom",
              "value": {
                "legend": false,
                "tooltip": false,
                "viz": true
              }
            }
          ]
        }
      ]
    },
    "gridPos": {
      "h": 9,
      "w": 6,
      "x": 0,
      "y": 12
    },
    "id": 12,
    "options": {
      "displayLabels": [
        "name",
        "value"
      ],
      "legend": {
        "displayMode": "list",
        "placement": "bottom",
        "showLegend": true,
        "values": []
      },
      "pieType": "pie",
      "reduceOptions": {
        "calcs": [
          "allValues"
        ],
        "fields": "",
        "values": true
      },
      "tooltip": {
        "mode": "single",
        "sort": "asc"
      }
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "count_over_time(doku_llm_requestDuration{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}[$__interval])",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT \n    category,\n    CAST(COUNT(*) AS INTEGER) AS Requests,\n    ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER(), 2) AS percentage\n    FROM \n        (\n            SELECT \n                CASE\n                  WHEN endpoint LIKE 'openai.chat%' THEN 'Chat'\n                  WHEN endpoint LIKE 'openai.completions%' THEN 'Chat'\n                  WHEN endpoint LIKE 'anthropic.completions%' THEN 'Chat'\n                  WHEN endpoint LIKE 'cohere.summarize%' THEN 'Chat'\n                  WHEN endpoint LIKE 'cohere.generate%' THEN 'Chat'\n                  WHEN endpoint LIKE 'cohere.chat%' THEN 'Chat'\n                  WHEN endpoint LIKE '%embed%' THEN 'Embeddings'\n                  WHEN endpoint LIKE 'openai.images%' THEN 'Image'\n                  WHEN endpoint LIKE 'openai.audio%' THEN 'Audio'\n                  WHEN endpoint LIKE 'openai.fine_tuning%' THEN 'Fine Tuning'\n                END AS category,\n                endpoint\n            FROM doku\n            WHERE $__timeFilter(time)\n        ) AS subquery\n    GROUP BY category",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "parameters": [],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "useBackend": false
      }
    ],
    "title": "Usage by Category",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "sum"
              ],
              "operation": "aggregate"
            },
            "generation": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      }
    ],
    "transparent": true,
    "type": "piechart"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "Displays the cost breakdown by provider (OpenAI, Cohere, Anthropic) for LLM requests, offering insights into financial deployment across different services.",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "palette-classic"
        },
        "custom": {
          "hideFrom": {
            "legend": false,
            "tooltip": false,
            "viz": false
          }
        },
        "mappings": [],
        "unit": "currencyUSD",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 9,
      "w": 6,
      "x": 6,
      "y": 12
    },
    "id": 16,
    "options": {
      "displayLabels": [
        "name",
        "value"
      ],
      "legend": {
        "displayMode": "list",
        "placement": "bottom",
        "showLegend": true,
        "values": []
      },
      "pieType": "pie",
      "reduceOptions": {
        "calcs": [
          "allValues"
        ],
        "fields": "",
        "values": true
      },
      "tooltip": {
        "mode": "single",
        "sort": "asc"
      }
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "doku_llm_usageCost{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT\n  CASE\n    WHEN endpoint LIKE 'openai.%' THEN 'OpenAI'\n    WHEN endpoint LIKE 'cohere.%' THEN 'Cohere'\n    WHEN endpoint LIKE 'anthropic.%' THEN 'Anthropic'\n  END AS provider,\n  SUM(usageCost) AS total_cost\nFROM\n  doku\nWHERE $__timeFilter(time)\nGROUP BY\n  provider\nORDER BY\n  total_cost DESC;",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "parameters": [],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "useBackend": false
      }
    ],
    "title": "Usage cost by Provider",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "sum"
              ],
              "operation": "aggregate"
            },
            "generation": {
              "aggregations": []
            },
            "platform": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      }
    ],
    "transparent": true,
    "type": "piechart"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "This panel presents a pie chart detailing the distribution of expenses for LLM requests by various applications. It shows how budget allocations are consumed by different applications, enabling a deeper understanding of cost drivers and facilitating cost optimization efforts.",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "palette-classic"
        },
        "custom": {
          "hideFrom": {
            "legend": false,
            "tooltip": false,
            "viz": false
          }
        },
        "mappings": [],
        "unit": "currencyUSD",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 9,
      "w": 6,
      "x": 12,
      "y": 12
    },
    "id": 24,
    "options": {
      "displayLabels": [
        "name",
        "value"
      ],
      "legend": {
        "displayMode": "list",
        "placement": "bottom",
        "showLegend": true,
        "values": []
      },
      "pieType": "pie",
      "reduceOptions": {
        "calcs": [
          "allValues"
        ],
        "fields": "/.*/",
        "values": true
      },
      "tooltip": {
        "mode": "single",
        "sort": "asc"
      }
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "doku_llm_usageCost{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT\n  CASE\n    WHEN endpoint LIKE 'openai.%' THEN 'OpenAI'\n    WHEN endpoint LIKE 'cohere.%' THEN 'Cohere'\n    WHEN endpoint LIKE 'anthropic.%' THEN 'Anthropic'\n  END AS provider,\n  SUM(usageCost) AS total_cost\nFROM\n  doku\nWHERE $__timeFilter(time)\nGROUP BY\n  provider\nORDER BY\n  total_cost DESC;",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "parameters": [],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "useBackend": false
      }
    ],
    "title": "Usage cost by Application",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "sum"
              ],
              "operation": "aggregate"
            },
            "applicationName": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      }
    ],
    "transparent": true,
    "type": "piechart"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "Visualizes the allocation of LLM request expenses across different environments, such as development, staging, and production. This breakdown helps in tracking and managing costs with respect to operational environments.",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "palette-classic"
        },
        "custom": {
          "hideFrom": {
            "legend": false,
            "tooltip": false,
            "viz": false
          }
        },
        "mappings": [],
        "unit": "currencyUSD",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 9,
      "w": 6,
      "x": 18,
      "y": 12
    },
    "id": 25,
    "options": {
      "displayLabels": [
        "name",
        "value"
      ],
      "legend": {
        "displayMode": "list",
        "placement": "bottom",
        "showLegend": true,
        "values": []
      },
      "pieType": "pie",
      "reduceOptions": {
        "calcs": [
          "allValues"
        ],
        "fields": "/.*/",
        "values": true
      },
      "tooltip": {
        "mode": "single",
        "sort": "asc"
      }
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "doku_llm_usageCost{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT\n  CASE\n    WHEN endpoint LIKE 'openai.%' THEN 'OpenAI'\n    WHEN endpoint LIKE 'cohere.%' THEN 'Cohere'\n    WHEN endpoint LIKE 'anthropic.%' THEN 'Anthropic'\n  END AS provider,\n  SUM(usageCost) AS total_cost\nFROM\n  doku\nWHERE $__timeFilter(time)\nGROUP BY\n  provider\nORDER BY\n  total_cost DESC;",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "parameters": [],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "useBackend": false
      }
    ],
    "title": "Usage cost by Environment",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "sum"
              ],
              "operation": "aggregate"
            },
            "applicationName": {
              "aggregations": []
            },
            "environment": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      }
    ],
    "transparent": true,
    "type": "piechart"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "This panel shows the average count of Prompt tokens used per LLM request",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "continuous-YlBl"
        },
        "mappings": [],
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {
              "color": "green"
            },
            {
              "color": "red",
              "value": 5
            }
          ]
        },
        "unit": "none",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 3,
      "w": 6,
      "x": 0,
      "y": 21
    },
    "id": 9,
    "options": {
      "colorMode": "background",
      "graphMode": "area",
      "justifyMode": "auto",
      "orientation": "auto",
      "reduceOptions": {
        "calcs": [
          "lastNotNull"
        ],
        "fields": "",
        "values": false
      },
      "showPercentChange": false,
      "textMode": "auto",
      "wideLayout": true
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "doku_llm_promptTokens{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT AVG(prompttokens) FROM doku WHERE \n  $__timeFilter(\"time\")",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "name": "AVG",
              "parameters": [
                {
                  "name": "prompttokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      }
    ],
    "title": "Avg Prompt Tokens / Request",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "mean"
              ],
              "operation": "aggregate"
            },
            "job": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      }
    ],
    "type": "stat"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "Provides a time-series analysis of token consumption for LLM requests, highlighting trends in usage intensity and complexity over time.",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "continuous-BlYlRd"
        },
        "custom": {
          "axisBorderShow": false,
          "axisCenteredZero": false,
          "axisColorMode": "series",
          "axisGridShow": true,
          "axisLabel": "",
          "axisPlacement": "auto",
          "barAlignment": 0,
          "drawStyle": "line",
          "fillOpacity": 50,
          "gradientMode": "hue",
          "hideFrom": {
            "legend": false,
            "tooltip": false,
            "viz": false
          },
          "insertNulls": 86400000,
          "lineInterpolation": "smooth",
          "lineStyle": {
            "dash": [
              10,
              10
            ],
            "fill": "dash"
          },
          "lineWidth": 1,
          "pointSize": 6,
          "scaleDistribution": {
            "type": "linear"
          },
          "showPoints": "always",
          "spanNulls": true,
          "stacking": {
            "group": "A",
            "mode": "none"
          },
          "thresholdsStyle": {
            "mode": "off"
          }
        },
        "fieldMinMax": false,
        "mappings": [],
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {
              "color": "green"
            },
            {
              "color": "red",
              "value": 80
            }
          ]
        },
        "unit": "none",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 6,
      "w": 18,
      "x": 6,
      "y": 21
    },
    "id": 11,
    "options": {
      "legend": {
        "calcs": [],
        "displayMode": "list",
        "placement": "bottom",
        "showLegend": true
      },
      "tooltip": {
        "mode": "single",
        "sort": "none"
      }
    },
    "pluginVersion": "10.2.3",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "avg(doku_llm_completionTokens{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"})",
        "format": "time_series",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "Completion Tokens",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT prompttokens AS \"Prompt Tokens\", \"time\" AS \"time\", completiontokens AS \"Completion Tokens\", totaltokens AS \"Total Tokens\" FROM doku",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "alias": "\"Prompt Tokens\"",
              "parameters": [
                {
                  "name": "prompttokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            },
            {
              "alias": "\"time\"",
              "parameters": [
                {
                  "name": "\"time\"",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            },
            {
              "alias": "\"Completion Tokens\"",
              "parameters": [
                {
                  "name": "completiontokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            },
            {
              "alias": "\"Total Tokens\"",
              "parameters": [
                {
                  "name": "totaltokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      },
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "builder",
        "expr": "avg(doku_llm_promptTokens)",
        "format": "time_series",
        "fullMetaSearch": false,
        "hide": false,
        "includeNullMetadata": true,
        "legendFormat": "Prompt Tokens",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT prompttokens AS \"Prompt Tokens\", \"time\" AS \"time\", completiontokens AS \"Completion Tokens\", totaltokens AS \"Total Tokens\" FROM doku",
        "refId": "B",
        "sql": {
          "columns": [
            {
              "alias": "\"Prompt Tokens\"",
              "parameters": [
                {
                  "name": "prompttokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            },
            {
              "alias": "\"time\"",
              "parameters": [
                {
                  "name": "\"time\"",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            },
            {
              "alias": "\"Completion Tokens\"",
              "parameters": [
                {
                  "name": "completiontokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            },
            {
              "alias": "\"Total Tokens\"",
              "parameters": [
                {
                  "name": "totaltokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      }
    ],
    "title": "Token usage overtime",
    "type": "timeseries"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "This panel shows the average count of Completion tokens used per LLM request",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "continuous-BlPu"
        },
        "mappings": [],
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {
              "color": "green"
            }
          ]
        },
        "unit": "none",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 3,
      "w": 6,
      "x": 0,
      "y": 24
    },
    "id": 7,
    "options": {
      "colorMode": "background",
      "graphMode": "area",
      "justifyMode": "auto",
      "orientation": "auto",
      "reduceOptions": {
        "calcs": [
          "lastNotNull"
        ],
        "fields": "",
        "values": false
      },
      "showPercentChange": false,
      "textMode": "auto",
      "wideLayout": true
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "doku_llm_completionTokens{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT AVG(completiontokens) FROM doku WHERE \n  $__timeFilter(\"time\")",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "name": "AVG",
              "parameters": [
                {
                  "name": "completiontokens",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      }
    ],
    "title": "Avg Completion Tokens / Request",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "mean"
              ],
              "operation": "aggregate"
            },
            "job": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      }
    ],
    "type": "stat"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "Displays the frequency of model usage over time, identifying the most utilised models and showcasing usage trends across different periods",
    "fieldConfig": {
      "defaults": {
        "color": {
          "fixedColor": "purple",
          "mode": "continuous-YlBl"
        },
        "mappings": [],
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {
              "color": "green"
            },
            {
              "color": "red",
              "value": 80
            }
          ]
        },
        "unit": "none",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 6,
      "w": 12,
      "x": 0,
      "y": 27
    },
    "id": 13,
    "options": {
      "displayMode": "lcd",
      "maxVizHeight": 165,
      "minVizHeight": 0,
      "minVizWidth": 75,
      "namePlacement": "left",
      "orientation": "horizontal",
      "reduceOptions": {
        "calcs": [
          "allValues"
        ],
        "fields": "",
        "values": true
      },
      "showUnfilled": true,
      "sizing": "auto",
      "valueMode": "color"
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "topk(5,count by(model) (sum_over_time(doku_llm_requestDuration{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}[$__interval])))",
        "format": "table",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "__auto",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT \n  model,\n  total_count,\n  percentage_usage\nFROM \n  (\n    SELECT \n      model,\n      COUNT(*) AS total_count,\n      ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER(), 2) AS percentage_usage\n    FROM \n      doku\n    WHERE $__timeFilter(time)\n    GROUP BY \n      model\n    ORDER BY \n      percentage_usage DESC\n  ) sub\nLIMIT 5;",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "parameters": [
                {
                  "name": "model",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      }
    ],
    "title": "Top models by usage",
    "transformations": [
      {
        "id": "groupBy",
        "options": {
          "fields": {
            "Value": {
              "aggregations": [
                "sum"
              ],
              "operation": "aggregate"
            },
            "model": {
              "aggregations": [],
              "operation": "groupby"
            }
          }
        }
      },
      {
        "id": "sortBy",
        "options": {
          "fields": {},
          "sort": [
            {
              "desc": true,
              "field": "Value (sum)"
            }
          ]
        }
      }
    ],
    "type": "bargauge"
  },
  {
    "datasource": {
      "type": "prometheus",
      "uid": "grafanacloud-prom"
    },
    "description": "Breaks down token usage across different LLM models, offering insights into which models are driving the highest token consumption.",
    "fieldConfig": {
      "defaults": {
        "color": {
          "mode": "palette-classic"
        },
        "custom": {
          "axisBorderShow": false,
          "axisCenteredZero": false,
          "axisColorMode": "text",
          "axisLabel": "",
          "axisPlacement": "auto",
          "barAlignment": 0,
          "drawStyle": "line",
          "fillOpacity": 23,
          "gradientMode": "hue",
          "hideFrom": {
            "legend": false,
            "tooltip": false,
            "viz": false
          },
          "insertNulls": false,
          "lineInterpolation": "linear",
          "lineStyle": {
            "dash": [
              10,
              10
            ],
            "fill": "dash"
          },
          "lineWidth": 1,
          "pointSize": 9,
          "scaleDistribution": {
            "type": "linear"
          },
          "showPoints": "always",
          "spanNulls": true,
          "stacking": {
            "group": "A",
            "mode": "none"
          },
          "thresholdsStyle": {
            "mode": "off"
          }
        },
        "mappings": [],
        "thresholds": {
          "mode": "absolute",
          "steps": [
            {
              "color": "green"
            },
            {
              "color": "red",
              "value": 80
            }
          ]
        },
        "unit": "none",
        "unitScale": true
      },
      "overrides": []
    },
    "gridPos": {
      "h": 6,
      "w": 12,
      "x": 12,
      "y": 27
    },
    "id": 14,
    "options": {
      "legend": {
        "calcs": [],
        "displayMode": "list",
        "placement": "bottom",
        "showLegend": true
      },
      "tooltip": {
        "mode": "single",
        "sort": "none"
      }
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "prometheus",
          "uid": "grafanacloud-prom"
        },
        "disableTextWrap": false,
        "editorMode": "code",
        "expr": "sum_over_time(doku_llm_totalTokens{job=\"doku\", applicationName=~\"$Application\", environment=~\"$Environment\"}[$__interval])",
        "format": "time_series",
        "fullMetaSearch": false,
        "includeNullMetadata": true,
        "legendFormat": "{{model}}",
        "range": true,
        "rawQuery": true,
        "rawSql": "SELECT \n  DATE_TRUNC('day', \"time\") AS \"time\",\n  model,\n  COUNT(*) AS \"Model:\"\nFROM \n  doku\nWHERE \n  $__timeFilter(\"time\")\nGROUP BY \n  1, model\nORDER BY \n  \"time\" ASC, model;",
        "refId": "A",
        "sql": {
          "columns": [
            {
              "parameters": [
                {
                  "name": "model",
                  "type": "functionParameter"
                }
              ],
              "type": "function"
            }
          ],
          "groupBy": [
            {
              "property": {
                "type": "string"
              },
              "type": "groupBy"
            }
          ],
          "limit": 50
        },
        "table": "doku",
        "useBackend": false
      }
    ],
    "title": "Token usage by model",
    "transformations": [],
    "type": "timeseries"
  },
  {
    "datasource": {
      "type": "loki",
      "uid": "grafanacloud-logs"
    },
    "description": "Displays a log of all prompt messages sent to the LLM, providing insights into the inputs and interactions leading up to LLM responses.",
    "gridPos": {
      "h": 8,
      "w": 12,
      "x": 0,
      "y": 33
    },
    "id": 26,
    "options": {
      "dedupStrategy": "none",
      "enableLogDetails": true,
      "prettifyLogMessage": true,
      "showCommonLabels": false,
      "showLabels": false,
      "showTime": true,
      "sortOrder": "Descending",
      "wrapLogMessage": false
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "loki",
          "uid": "grafanacloud-logs"
        },
        "editorMode": "code",
        "expr": "{job=\"doku\", type=\"prompt\", applicationName=~\"$Application\", environment=~\"$Environment\"}",
        "hide": false,
        "queryType": "range",
        "refId": "B"
      }
    ],
    "title": "Prompts",
    "transformations": [
      {
        "id": "extractFields",
        "options": {
          "format": "auto",
          "source": "labels"
        }
      }
    ],
    "transparent": true,
    "type": "logs"
  },
  {
    "datasource": {
      "type": "loki",
      "uid": "grafanacloud-logs"
    },
    "description": "Displays a log of all responses from the LLM, offering a comprehensive view of how the model interprets prompts and the information it generates.",
    "gridPos": {
      "h": 8,
      "w": 12,
      "x": 12,
      "y": 33
    },
    "id": 27,
    "options": {
      "dedupStrategy": "none",
      "enableLogDetails": true,
      "prettifyLogMessage": true,
      "showCommonLabels": false,
      "showLabels": false,
      "showTime": true,
      "sortOrder": "Descending",
      "wrapLogMessage": true
    },
    "pluginVersion": "10.4.0-65875",
    "targets": [
      {
        "datasource": {
          "type": "loki",
          "uid": "grafanacloud-logs"
        },
        "editorMode": "code",
        "expr": "{job=\"doku\", type=\"response\", applicationName=~\"$Application\", environment=~\"$Environment\"}",
        "hide": false,
        "queryType": "range",
        "refId": "B"
      }
    ],
    "title": "Responses",
    "transformations": [
      {
        "id": "extractFields",
        "options": {
          "format": "auto",
          "source": "labels"
        }
      }
    ],
    "transparent": true,
    "type": "logs"
  }
],
"refresh": "",
"schemaVersion": 39,
"tags": [
  "Doku",
  "OpenAI",
  "Cohere",
  "Anthropic"
],
"templating": {
  "list": [
    {
      "current": {
        "selected": true,
        "text": [
          "All"
        ],
        "value": [
          "$__all"
        ]
      },
      "datasource": {
        "type": "prometheus",
        "uid": "grafanacloud-prom"
      },
      "definition": "label_values(applicationName)",
      "hide": 0,
      "includeAll": true,
      "label": "Application",
      "multi": true,
      "name": "Application",
      "options": [],
      "query": {
        "qryType": 1,
        "query": "label_values(applicationName)",
        "refId": "PrometheusVariableQueryEditor-VariableQuery"
      },
      "refresh": 1,
      "regex": "",
      "skipUrlSync": false,
      "sort": 0,
      "type": "query"
    },
    {
      "current": {
        "selected": true,
        "text": [
          "All"
        ],
        "value": [
          "$__all"
        ]
      },
      "datasource": {
        "type": "prometheus",
        "uid": "grafanacloud-prom"
      },
      "definition": "label_values(environment)",
      "hide": 0,
      "includeAll": true,
      "label": "Environment",
      "multi": true,
      "name": "Environment",
      "options": [],
      "query": {
        "qryType": 1,
        "query": "label_values(environment)",
        "refId": "PrometheusVariableQueryEditor-VariableQuery"
      },
      "refresh": 1,
      "regex": "",
      "skipUrlSync": false,
      "sort": 0,
      "type": "query"
    }
  ]
},
"time": {
  "from": "now-24h",
  "to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Doku - LLM Monitoring",
"uid": "doku-llm-monitoring",
"version": 1,
"weekStart": ""
}