Grafana dashboard: Javed_Assignment
Description: Customers_Details


{
  "__inputs": [
    {
      "name": "DS_POSTGRESQL",
      "label": "PostgreSQL",
      "description": "",
      "type": "datasource",
      "pluginId": "postgres",
      "pluginName": "PostgreSQL"
    }
  ],
  "__requires": [
    {
      "type": "panel",
      "id": "bargauge",
      "name": "Bar Gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "6.6.0"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "panel",
      "id": "heatmap",
      "name": "Heatmap",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "postgres",
      "name": "PostgreSQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 11687,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_POSTGRESQL}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "hiddenSeries": false,
      "id": 6,
      "legend": {
        "avg": true,
        "current": false,
        "max": true,
        "min": true,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pluginVersion": "6.6.0",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "1h",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(arrival_date,1h),\n  avg(customers) AS \"customers\",\n  max(prospect_customers) AS \"prospect_customers\"\nFROM \"Customer_Data\"\nWHERE\n  $__timeFilter(arrival_date)\nGROUP BY 1\nORDER BY 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "avg"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "customers"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "max"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "\"Customer_Data\"",
          "timeColumn": "arrival_date",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Line_Chart",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "cacheTimeout": null,
      "cards": {
        "cardPadding": null,
        "cardRound": null
      },
      "color": {
        "cardColor": "#b4ff00",
        "colorScale": "sqrt",
        "colorScheme": "interpolateOranges",
        "exponent": 0.5,
        "mode": "spectrum"
      },
      "dataFormat": "timeseries",
      "datasource": "${DS_POSTGRESQL}",
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "heatmap": {},
      "hideZeroBuckets": false,
      "highlightCards": true,
      "id": 8,
      "legend": {
        "show": false
      },
      "links": [],
      "options": {},
      "pluginVersion": "6.6.0",
      "reverseYBuckets": false,
      "targets": [
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(arrival_date,$__interval),\n  min(customers) AS \"customers\",\n  avg(prospect_customers) AS \"prospect_customers\"\nFROM \"Customer_Data\"\nWHERE\n  $__timeFilter(arrival_date)\nGROUP BY 1\nORDER BY 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "min"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "customers"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "avg"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "\"Customer_Data\"",
          "timeColumn": "arrival_date",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Heat map",
      "tooltip": {
        "show": true,
        "showHistogram": false
      },
      "type": "heatmap",
      "xAxis": {
        "show": true
      },
      "xBucketNumber": null,
      "xBucketSize": null,
      "yAxis": {
        "decimals": null,
        "format": "short",
        "logBase": 1,
        "max": null,
        "min": null,
        "show": true,
        "splitFactor": null
      },
      "yBucketBound": "auto",
      "yBucketNumber": null,
      "yBucketSize": null
    },
    {
      "datasource": "${DS_POSTGRESQL}",
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 8
      },
      "id": 10,
      "options": {
        "displayMode": "lcd",
        "fieldOptions": {
          "calcs": [
            "mean"
          ],
          "defaults": {
            "mappings": [],
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {
                  "color": "green",
                  "value": null
                },
                {
                  "color": "#6ED0E0",
                  "value": 99.6875
                }
              ]
            }
          },
          "overrides": [],
          "values": false
        },
        "orientation": "vertical",
        "showUnfilled": true
      },
      "pluginVersion": "6.6.0",
      "targets": [
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(arrival_date,$__interval),\n  percentile_cont(0.95) WITHIN GROUP (ORDER BY customers) AS \"customers\",\n  percentile_cont(0.95) WITHIN GROUP (ORDER BY prospect_customers) AS \"prospect_customers\"\nFROM \"Customer_Data\"\nWHERE\n  $__timeFilter(arrival_date)\nGROUP BY 1\nORDER BY 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "percentile_cont",
                  "0.95"
                ],
                "type": "percentile"
              },
              {
                "params": [
                  "customers"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "percentile_cont",
                  "0.95"
                ],
                "type": "percentile"
              },
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "\"Customer_Data\"",
          "timeColumn": "arrival_date",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Bar_Gauge_Agrregate_Percentile(Continuous)",
      "type": "bargauge"
    },
    {
      "datasource": "${DS_POSTGRESQL}",
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 8
      },
      "id": 2,
      "options": {
        "colorMode": "value",
        "fieldOptions": {
          "calcs": [
            "mean"
          ],
          "defaults": {
            "mappings": [],
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {
                  "color": "green",
                  "value": null
                },
                {
                  "color": "red",
                  "value": 80
                }
              ]
            }
          },
          "overrides": [],
          "values": false
        },
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto"
      },
      "pluginVersion": "6.6.0",
      "targets": [
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(arrival_date,$__interval),\n  percentile_cont(0.95) WITHIN GROUP (ORDER BY customers) AS \"customers\",\n  percentile_cont(0.95) WITHIN GROUP (ORDER BY prospect_customers) AS \"prospect_customers\"\nFROM \"Customer_Data\"\nWHERE\n  $__timeFilter(arrival_date)\nGROUP BY 1\nORDER BY 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "percentile_cont",
                  "0.95"
                ],
                "type": "percentile"
              },
              {
                "params": [
                  "customers"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "percentile_cont",
                  "0.95"
                ],
                "type": "percentile"
              },
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "\"Customer_Data\"",
          "timeColumn": "arrival_date",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Stat_Aggregate_Percentile(Discrete)",
      "type": "stat"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_POSTGRESQL}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 16
      },
      "hiddenSeries": false,
      "id": 14,
      "legend": {
        "avg": true,
        "current": true,
        "max": true,
        "min": true,
        "show": true,
        "total": true,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": true,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "format": "time_series",
          "group": [],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  arrival_date AS \"time\",\n  customers - lag(customers) OVER (ORDER BY arrival_date) AS \"customers\",\n  (CASE WHEN prospect_customers >= lag(prospect_customers) OVER (ORDER BY arrival_date) THEN prospect_customers - lag(prospect_customers) OVER (ORDER BY arrival_date) WHEN lag(prospect_customers) OVER (ORDER BY arrival_date) IS NULL THEN NULL ELSE prospect_customers END) AS \"prospect_customers\"\nFROM \"Customer_Data\"\nWHERE\n  $__timeFilter(arrival_date)\nORDER BY 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "delta"
                ],
                "type": "window"
              },
              {
                "params": [
                  "customers"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "increase"
                ],
                "type": "window"
              },
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "\"Customer_Data\"",
          "timeColumn": "arrival_date",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Line_Chart_with_Dots",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "columns": [],
      "datasource": "${DS_POSTGRESQL}",
      "fontSize": "100%",
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 16
      },
      "id": 12,
      "options": {},
      "pageSize": null,
      "pluginVersion": "6.6.0",
      "showHeader": true,
      "sort": {
        "col": 0,
        "desc": true
      },
      "styles": [
        {
          "alias": "Time",
          "align": "auto",
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "pattern": "Time",
          "type": "date"
        },
        {
          "alias": "",
          "align": "right",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "decimals": 2,
          "pattern": "/.*/",
          "thresholds": [],
          "type": "number",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(arrival_date,$__interval),\n  (CASE WHEN percentile_disc(0.95) WITHIN GROUP (ORDER BY customers) >= lag(percentile_disc(0.95) WITHIN GROUP (ORDER BY customers)) OVER (ORDER BY $__timeGroup(arrival_date,$__interval)) THEN percentile_disc(0.95) WITHIN GROUP (ORDER BY customers) - lag(percentile_disc(0.95) WITHIN GROUP (ORDER BY customers)) OVER (ORDER BY $__timeGroup(arrival_date,$__interval)) WHEN lag(percentile_disc(0.95) WITHIN GROUP (ORDER BY customers)) OVER (ORDER BY $__timeGroup(arrival_date,$__interval)) IS NULL THEN NULL ELSE percentile_disc(0.95) WITHIN GROUP (ORDER BY customers) END) AS \"customers\",\n  avg(percentile_disc(0.95) WITHIN GROUP (ORDER BY prospect_customers)) OVER (ORDER BY $__timeGroup(arrival_date,$__interval) ROWS 5 PRECEDING) AS \"prospect_customers\"\nFROM \"Customer_Data\"\nWHERE\n  $__timeFilter(arrival_date)\nGROUP BY 1\nORDER BY 1",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "percentile_disc",
                  "0.95"
                ],
                "type": "percentile"
              },
              {
                "params": [
                  "increase"
                ],
                "type": "window"
              },
              {
                "params": [
                  "customers"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "column"
              },
              {
                "params": [
                  "percentile_disc",
                  "0.95"
                ],
                "type": "percentile"
              },
              {
                "params": [
                  "avg",
                  "5"
                ],
                "type": "moving_window"
              },
              {
                "params": [
                  "prospect_customers"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "\"Customer_Data\"",
          "timeColumn": "arrival_date",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Table",
      "transform": "timeseries_to_columns",
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 22,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "2019-12-31T18:30:00.000Z",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Javed_Assignment",
  "uid": "DwkJh48Wk",
  "version": 6,
  "description": "Customers_Details"
}