{
  "description": "User activity and behavior monitoring dashboard",
  "tags": ["user", "activity", "behavior"],
  "name": "bakery-ia-user-activity",
  "title": "Bakery IA - User Activity",
  "uploadedGrafana": false,
  "uuid": "bakery-ia-user-01",
  "version": "v4",
  "collapsableRowsMigrated": true,
  "layout": [
    {
      "x": 0,
      "y": 0,
      "w": 6,
      "h": 3,
      "i": "active-users",
      "moved": false,
      "static": false
    },
    {
      "x": 6,
      "y": 0,
      "w": 6,
      "h": 3,
      "i": "user-sessions",
      "moved": false,
      "static": false
    },
    {
      "x": 0,
      "y": 3,
      "w": 6,
      "h": 3,
      "i": "user-actions",
      "moved": false,
      "static": false
    },
    {
      "x": 6,
      "y": 3,
      "w": 6,
      "h": 3,
      "i": "page-views",
      "moved": false,
      "static": false
    },
    {
      "x": 0,
      "y": 6,
      "w": 12,
      "h": 4,
      "i": "geo-visitors",
      "moved": false,
      "static": false
    }
  ],
  "variables": {
    "service": {
      "id": "service-var",
      "name": "service",
      "description": "Filter by service name",
      "type": "QUERY",
      "queryValue": "SELECT DISTINCT(serviceName) FROM signoz_traces.distributed_signoz_index_v2 ORDER BY serviceName",
      "customValue": "",
      "textboxValue": "",
      "showALLOption": true,
      "multiSelect": false,
      "order": 1,
      "modificationUUID": "",
      "sort": "ASC",
      "selectedValue": "bakery-frontend"
    }
  },
  "widgets": [
    {
      "id": "active-users",
      "title": "Active Users",
      "description": "Number of active users by service",
      "isStacked": false,
      "nullZeroValues": "zero",
      "opacity": "1",
      "panelTypes": "graph",
      "query": {
        "builder": {
          "queryData": [
            {
              "dataSource": "traces",
              "queryName": "A",
              "aggregateOperator": "count_distinct",
              "aggregateAttribute": {
                "key": "user.id",
                "dataType": "string",
                "type": "tag",
                "isColumn": true
              },
              "timeAggregation": "count_distinct",
              "spaceAggregation": "sum",
              "functions": [],
              "filters": {
                "items": [
                  {
                    "key": {
                      "key": "serviceName",
                      "dataType": "string",
                      "type": "tag",
                      "isColumn": true
                    },
                    "op": "=",
                    "value": "{{.service}}"
                  }
                ],
                "op": "AND"
              },
              "expression": "A",
              "disabled": false,
              "having": [],
              "stepInterval": 60,
              "limit": null,
              "orderBy": [],
              "groupBy": [
                {
                  "key": "serviceName",
                  "dataType": "string",
                  "type": "tag",
                  "isColumn": true
                }
              ],
              "legend": "{{serviceName}}",
              "reduceTo": "sum"
            }
          ],
          "queryFormulas": []
        },
        "queryType": "builder"
      },
      "fillSpans": false,
      "yAxisUnit": "none"
    },
    {
      "id": "user-sessions",
      "title": "User Sessions",
      "description": "Total user sessions by service",
      "isStacked": false,
      "nullZeroValues": "zero",
      "opacity": "1",
      "panelTypes": "graph",
      "query": {
        "builder": {
          "queryData": [
            {
              "dataSource": "traces",
              "queryName": "A",
              "aggregateOperator": "count",
              "aggregateAttribute": {
                "key": "session.id",
                "dataType": "string",
                "type": "tag",
                "isColumn": true
              },
              "timeAggregation": "count",
              "spaceAggregation": "sum",
              "functions": [],
              "filters": {
                "items": [
                  {
                    "key": {
                      "key": "serviceName",
                      "dataType": "string",
                      "type": "tag",
                      "isColumn": true
                    },
                    "op": "=",
                    "value": "{{.service}}"
                  },
                  {
                    "key": {
                      "key": "span.name",
                      "dataType": "string",
                      "type": "tag",
                      "isColumn": true
                    },
                    "op": "=",
                    "value": "user_session"
                  }
                ],
                "op": "AND"
              },
              "expression": "A",
              "disabled": false,
              "having": [],
              "stepInterval": 60,
              "limit": null,
              "orderBy": [],
              "groupBy": [
                {
                  "key": "serviceName",
                  "dataType": "string",
                  "type": "tag",
                  "isColumn": true
                }
              ],
              "legend": "{{serviceName}}",
              "reduceTo": "sum"
            }
          ],
          "queryFormulas": []
        },
        "queryType": "builder"
      },
      "fillSpans": false,
      "yAxisUnit": "none"
    },
    {
      "id": "user-actions",
      "title": "User Actions",
      "description": "Total user actions by service",
      "isStacked": false,
      "nullZeroValues": "zero",
      "opacity": "1",
      "panelTypes": "graph",
      "query": {
        "builder": {
          "queryData": [
            {
              "dataSource": "traces",
              "queryName": "A",
              "aggregateOperator": "count",
              "aggregateAttribute": {
                "key": "user.action",
                "dataType": "string",
                "type": "tag",
                "isColumn": true
              },
              "timeAggregation": "count",
              "spaceAggregation": "sum",
              "functions": [],
              "filters": {
                "items": [
                  {
                    "key": {
                      "key": "serviceName",
                      "dataType": "string",
                      "type": "tag",
                      "isColumn": true
                    },
                    "op": "=",
                    "value": "{{.service}}"
                  },
                  {
                    "key": {
                      "key": "span.name",
                      "dataType": "string",
                      "type": "tag",
                      "isColumn": true
                    },
                    "op": "=",
                    "value": "user_action"
                  }
                ],
                "op": "AND"
              },
              "expression": "A",
              "disabled": false,
              "having": [],
              "stepInterval": 60,
              "limit": null,
              "orderBy": [],
              "groupBy": [
                {
                  "key": "serviceName",
                  "dataType": "string",
                  "type": "tag",
                  "isColumn": true
                }
              ],
              "legend": "{{serviceName}}",
              "reduceTo": "sum"
            }
          ],
          "queryFormulas": []
        },
        "queryType": "builder"
      },
      "fillSpans": false,
      "yAxisUnit": "none"
    },
    {
      "id": "page-views",
      "title": "Page Views",
      "description": "Total page views by service",
      "isStacked": false,
      "nullZeroValues": "zero",
      "opacity": "1",
      "panelTypes": "graph",
      "query": {
        "builder": {
          "queryData": [
            {
              "dataSource": "traces",
              "queryName": "A",
              "aggregateOperator": "count",
              "aggregateAttribute": {
                "key": "page.path",
                "dataType": "string",
                "type": "tag",
                "isColumn": true
              },
              "timeAggregation": "count",
              "spaceAggregation": "sum",
              "functions": [],
              "filters": {
                "items": [
                  {
                    "key": {
                      "key": "serviceName",
                      "dataType": "string",
                      "type": "tag",
                      "isColumn": true
                    },
                    "op": "=",
                    "value": "{{.service}}"
                  },
                  {
                    "key": {
                      "key": "span.name",
                      "dataType": "string",
                      "type": "tag",
                      "isColumn": true
                    },
                    "op": "=",
                    "value": "page_view"
                  }
                ],
                "op": "AND"
              },
              "expression": "A",
              "disabled": false,
              "having": [],
              "stepInterval": 60,
              "limit": null,
              "orderBy": [],
              "groupBy": [
                {
                  "key": "serviceName",
                  "dataType": "string",
                  "type": "tag",
                  "isColumn": true
                }
              ],
              "legend": "{{serviceName}}",
              "reduceTo": "sum"
            }
          ],
          "queryFormulas": []
        },
        "queryType": "builder"
      },
      "fillSpans": false,
      "yAxisUnit": "none"
    },
    {
      "id": "geo-visitors",
      "title": "Geolocation Visitors",
      "description": "Number of visitors who shared location data",
      "isStacked": false,
      "nullZeroValues": "zero",
      "opacity": "1",
      "panelTypes": "value",
      "query": {
        "builder": {
          "queryData": [
            {
              "dataSource": "traces",
              "queryName": "A",
              "aggregateOperator": "count",
              "aggregateAttribute": {
                "key": "user.id",
                "dataType": "string",
                "type": "tag",
                "isColumn": true
              },
              "timeAggregation": "count",
              "spaceAggregation": "sum",
              "functions": [],
              "filters": {
                "items": [
                  {
                    "key": {
                      "key": "serviceName",
                      "dataType": "string",
                      "type": "tag",
                      "isColumn": true
                    },
                    "op": "=",
                    "value": "{{.service}}"
                  },
                  {
                    "key": {
                      "key": "span.name",
                      "dataType": "string",
                      "type": "tag",
                      "isColumn": true
                    },
                    "op": "=",
                    "value": "user_location"
                  }
                ],
                "op": "AND"
              },
              "expression": "A",
              "disabled": false,
              "having": [],
              "stepInterval": 60,
              "limit": null,
              "orderBy": [],
              "groupBy": [],
              "legend": "Visitors with Location Data (See GEOLOCATION_VISUALIZATION_GUIDE.md for map integration)",
              "reduceTo": "sum"
            }
          ],
          "queryFormulas": []
        },
        "queryType": "builder"
      },
      "fillSpans": false,
      "yAxisUnit": "none"
    }
  ]
}