Grafana Analysis
An analysis of the Grafana repository over the last 10 yrs.
{
  "__inputs": [
    {
      "name": "DS_CLICKHOUSE-GRAFANA-GIT",
      "label": "clickhouse-grafana-git",
      "description": "ClickHouse Instance",
      "type": "datasource",
      "pluginId": "grafana-clickhouse-datasource",
      "pluginName": "ClickHouse"
    },
    {
      "name": "VAR_CLICKHOUSE_ADHOC_QUERY",
      "type": "constant",
      "label": "clickhouse_adhoc_query",
      "value": "default",
      "description": ""
    }
  ],
  "__elements": {
    "wlFBSgTVz": {
      "name": "Code change activity",
      "uid": "wlFBSgTVz",
      "kind": 1,
      "model": {
        "type": "heatmap",
        "title": "Code change activity",
        "datasource": {
          "type": "grafana-clickhouse-datasource",
          "uid": "HmCnXAhVk"
        },
        "pluginVersion": "9.3.2-67a213dc85",
        "libraryPanel": {
          "name": "Code change activity",
          "uid": ""
        },
        "description": "",
        "fieldConfig": {
          "defaults": {
            "custom": {
              "hideFrom": {
                "legend": false,
                "tooltip": false,
                "viz": false
              },
              "scaleDistribution": {
                "type": "linear"
              }
            }
          },
          "overrides": []
        },
        "options": {
          "calculate": false,
          "cellGap": 1,
          "color": {
            "exponent": 0.5,
            "fill": "dark-orange",
            "max": 1000,
            "mode": "scheme",
            "reverse": false,
            "scale": "exponential",
            "scheme": "RdBu",
            "steps": 64
          },
          "exemplars": {
            "color": "rgba(255,0,255,0.7)"
          },
          "filterValues": {
            "le": 1e-9
          },
          "legend": {
            "show": true,
            "showLegend": true
          },
          "rowsFrame": {
            "layout": "auto"
          },
          "tooltip": {
            "show": true,
            "yHistogram": false
          },
          "yAxis": {
            "axisPlacement": "left",
            "reverse": false
          }
        },
        "targets": [
          {
            "datasource": {
              "type": "grafana-clickhouse-datasource",
              "uid": "HmCnXAhVk"
            },
            "format": 1,
            "meta": {
              "builderOptions": {
                "fields": [],
                "limit": 100,
                "mode": "list"
              }
            },
            "queryType": "sql",
            "rawSql": "SELECT time, sum(lines_added) as `Lines Added`, sum(lines_deleted)  as `Lines Deleted` FROM commits WHERE $__timeFilter(time) GROUP BY $__timeInterval(time) as time ORDER BY time ASC",
            "refId": "A"
          }
        ]
      }
    },
    "SW9EIRT4k": {
      "name": "ClickHouse and Grafana ",
      "uid": "SW9EIRT4k",
      "kind": 1,
      "model": {
        "type": "timeseries",
        "title": "ClickHouse and Grafana ",
        "datasource": {
          "type": "grafana-clickhouse-datasource",
          "uid": "HmCnXAhVk"
        },
        "description": "",
        "fieldConfig": {
          "defaults": {
            "color": {
              "mode": "palette-classic"
            },
            "custom": {
              "axisCenteredZero": false,
              "axisColorMode": "text",
              "axisLabel": "",
              "axisPlacement": "auto",
              "barAlignment": 0,
              "drawStyle": "line",
              "fillOpacity": 42,
              "gradientMode": "hue",
              "hideFrom": {
                "legend": false,
                "tooltip": false,
                "viz": false
              },
              "lineInterpolation": "linear",
              "lineWidth": 1,
              "pointSize": 8,
              "scaleDistribution": {
                "type": "linear"
              },
              "showPoints": "auto",
              "spanNulls": false,
              "stacking": {
                "group": "A",
                "mode": "normal"
              },
              "thresholdsStyle": {
                "mode": "off"
              }
            },
            "mappings": [],
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {
                  "color": "green",
                  "value": null
                }
              ]
            }
          },
          "overrides": []
        },
        "options": {
          "legend": {
            "calcs": [],
            "displayMode": "list",
            "placement": "bottom",
            "showLegend": true
          },
          "tooltip": {
            "mode": "single",
            "sort": "none"
          }
        },
        "targets": [
          {
            "datasource": {
              "type": "grafana-clickhouse-datasource",
              "uid": "HmCnXAhVk"
            },
            "format": 0,
            "meta": {
              "builderOptions": {
                "fields": [],
                "limit": 100,
                "mode": "list"
              }
            },
            "queryType": "sql",
            "rawSql": "WITH top_values AS (SELECT repo_name from github_events  WHERE $__timeFilter(created_at) and repo_name NOT IN ('ClickHouse/ClickHouse', 'grafana/grafana', 'yandex/ClickHouse') GROUP BY repo_name ORDER BY count() DESC LIMIT 30)\nSELECT toStartOfWeek(created_at) as time, if (repo_name in top_values, repo_name, 'other'), count() as c\n           FROM github_events\n           WHERE ((body ILIKE '%ClickHouse%') OR (title ILIKE '%ClickHouse%')) AND ((body ILIKE '%Grafana%') OR (title ILIKE '%Grafana%')) AND $__timeFilter(created_at)\n           GROUP BY repo_name, time ORDER BY time ASC",
            "refId": "A"
          }
        ]
      }
    },
    "MtePIgT4k": {
      "name": "Common contributors",
      "uid": "MtePIgT4k",
      "kind": 1,
      "model": {
        "type": "barchart",
        "title": "Common contributors",
        "datasource": {
          "type": "grafana-clickhouse-datasource",
          "uid": "HmCnXAhVk"
        },
        "libraryPanel": {
          "name": "Common contributors",
          "uid": ""
        },
        "description": "",
        "fieldConfig": {
          "defaults": {
            "color": {
              "mode": "palette-classic"
            },
            "custom": {
              "axisCenteredZero": false,
              "axisColorMode": "text",
              "axisLabel": "",
              "axisPlacement": "auto",
              "fillOpacity": 80,
              "gradientMode": "none",
              "hideFrom": {
                "legend": false,
                "tooltip": false,
                "viz": false
              },
              "lineWidth": 1,
              "scaleDistribution": {
                "type": "linear"
              },
              "thresholdsStyle": {
                "mode": "off"
              }
            },
            "mappings": [],
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {
                  "color": "green",
                  "value": null
                },
                {
                  "color": "red",
                  "value": 80
                }
              ]
            },
            "unit": "short"
          },
          "overrides": [
            {
              "matcher": {
                "id": "byName",
                "options": "grafana_prs"
              },
              "properties": [
                {
                  "id": "color",
                  "value": {
                    "fixedColor": "semi-dark-red",
                    "mode": "fixed"
                  }
                }
              ]
            }
          ]
        },
        "options": {
          "barRadius": 0,
          "barWidth": 0.97,
          "groupWidth": 0.7,
          "legend": {
            "calcs": [],
            "displayMode": "list",
            "placement": "right",
            "showLegend": true
          },
          "orientation": "horizontal",
          "showValue": "never",
          "stacking": "normal",
          "tooltip": {
            "mode": "single",
            "sort": "none"
          },
          "xField": "actor_login",
          "xTickLabelRotation": 0,
          "xTickLabelSpacing": 0
        },
        "targets": [
          {
            "datasource": {
              "type": "grafana-clickhouse-datasource",
              "uid": "HmCnXAhVk"
            },
            "format": 1,
            "meta": {
              "builderOptions": {
                "fields": [],
                "limit": 100,
                "mode": "list"
              }
            },
            "queryType": "sql",
            "rawSql": "SELECT * FROM (\nSELECT actor_login, count() as grafana_prs\n    FROM github_events\n    WHERE (event_type = 'PullRequestEvent') AND (repo_name IN ('grafana/grafana')) AND actor_login != 'dependabot[bot]' AND $__timeFilter(created_at) GROUP BY actor_login   \n) as grafana\nINNER JOIN (\n    SELECT actor_login, count() as clickhouse_prs\n    FROM github_events\n    WHERE (event_type = 'PullRequestEvent') AND (repo_name IN ( 'yandex/ClickHouse', 'ClickHouse/ClickHouse')) AND $__timeFilter(created_at) GROUP BY actor_login\n) as clickhouse USING actor_login LIMIT 20",
            "refId": "A"
          }
        ]
      }
    }
  },
  "__requires": [
    {
      "type": "panel",
      "id": "barchart",
      "name": "Bar chart",
      "version": ""
    },
    {
      "type": "panel",
      "id": "bargauge",
      "name": "Bar gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.3.6"
    },
    {
      "type": "datasource",
      "id": "grafana-clickhouse-datasource",
      "name": "ClickHouse",
      "version": "2.0.1"
    },
    {
      "type": "panel",
      "id": "heatmap",
      "name": "Heatmap",
      "version": ""
    },
    {
      "type": "panel",
      "id": "magnesium-wordcloud-panel",
      "name": "Word cloud",
      "version": "1.2.4"
    },
    {
      "type": "panel",
      "id": "marcusolsson-treemap-panel",
      "name": "Treemap",
      "version": "2.0.0"
    },
    {
      "type": "panel",
      "id": "piechart",
      "name": "Pie chart",
      "version": ""
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 37,
      "panels": [],
      "title": "Commit Analysis",
      "type": "row"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 1
      },
      "id": 6,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value_and_name"
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "builderOptions": {
            "database": "grafana_git",
            "fields": [],
            "limit": 100,
            "metrics": [
              {
                "aggregation": "count",
                "alias": "Total",
                "field": "Total"
              }
            ],
            "mode": "aggregate",
            "table": "commits"
          },
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "database": "grafana_git",
              "fields": [],
              "limit": 100,
              "metrics": [
                {
                  "aggregation": "count",
                  "alias": "Total",
                  "field": "Total"
                }
              ],
              "mode": "aggregate",
              "table": "commits"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT count() ` ` FROM commits WHERE $__timeFilter(time) LIMIT 100",
          "refId": "Commits"
        },
        {
          "builderOptions": {
            "database": "",
            "fields": [],
            "filters": [
              {
                "condition": "AND",
                "filterType": "custom",
                "key": "event_type",
                "operator": "=",
                "type": "string",
                "value": [
                  "WatchEvent"
                ]
              },
              {
                "condition": "AND",
                "filterType": "custom",
                "key": "repo_name",
                "operator": "LIKE",
                "type": "string",
                "value": [
                  "grafana/grafana"
                ]
              }
            ],
            "groupBy": [
              "toYear(created_at) as year"
            ],
            "limit": 100,
            "metrics": [
              {
                "aggregation": "count",
                "alias": "stars",
                "field": "AS"
              }
            ],
            "mode": "trend",
            "orderBy": [
              {
                "name": "year"
              }
            ],
            "table": "github_events",
            "timeField": "created_at",
            "timeFieldType": "DateTime"
          },
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "hide": false,
          "meta": {
            "builderOptions": {
              "database": "",
              "fields": [],
              "filters": [
                {
                  "condition": "AND",
                  "filterType": "custom",
                  "key": "event_type",
                  "operator": "=",
                  "type": "string",
                  "value": [
                    "WatchEvent"
                  ]
                },
                {
                  "condition": "AND",
                  "filterType": "custom",
                  "key": "repo_name",
                  "operator": "LIKE",
                  "type": "string",
                  "value": [
                    "grafana/grafana"
                  ]
                }
              ],
              "groupBy": [
                "toYear(created_at) as year"
              ],
              "limit": 100,
              "metrics": [
                {
                  "aggregation": "count",
                  "alias": "stars",
                  "field": "AS"
                }
              ],
              "mode": "trend",
              "orderBy": [
                {
                  "name": "year"
                }
              ],
              "table": "github_events",
              "timeField": "created_at",
              "timeFieldType": "DateTime"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT sum(count()) OVER (ORDER BY year ASC) AS ` ` FROM github_events WHERE event_type = 'WatchEvent' AND repo_name LIKE 'grafana/grafana' AND $__timeFilter(created_at) GROUP BY toMonth(created_at) as year ORDER BY year",
          "refId": "Stars"
        },
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "hide": false,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT sum(count()) OVER (ORDER BY year ASC) AS ` ` FROM github_events WHERE event_type = 'PullRequestEvent' AND repo_name LIKE 'grafana/grafana' AND $__timeFilter(created_at) GROUP BY toMonth(created_at) as year ORDER BY year",
          "refId": "PRs"
        },
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "hide": false,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT sum(count()) OVER (ORDER BY month ASC) AS ` ` FROM github_events WHERE event_type = 'IssuesEvent' AND repo_name = 'grafana/grafana' AND $__timeFilter(created_at) GROUP BY toMonth(created_at) as month ORDER BY month",
          "refId": "Issues"
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 2,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "commits"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "light-blue",
                  "mode": "fixed"
                }
              },
              {
                "id": "custom.lineWidth",
                "value": 1
              },
              {
                "id": "custom.drawStyle",
                "value": "bars"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "moving average"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "semi-dark-red",
                  "mode": "fixed"
                }
              },
              {
                "id": "custom.lineInterpolation",
                "value": "smooth"
              },
              {
                "id": "custom.lineWidth",
                "value": 2
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 1
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.3.2-67a213dc85",
      "targets": [
        {
          "builderOptions": {
            "database": "default",
            "fields": [],
            "filters": [],
            "groupBy": [],
            "limit": 10000,
            "metrics": [
              {
                "aggregation": "count",
                "alias": "commits",
                "field": "*"
              }
            ],
            "mode": "trend",
            "orderBy": [],
            "table": "commits",
            "timeField": "time",
            "timeFieldType": "DateTime"
          },
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "database": "default",
              "fields": [],
              "filters": [],
              "groupBy": [],
              "limit": 10000,
              "metrics": [
                {
                  "aggregation": "count",
                  "alias": "commits",
                  "field": "*"
                }
              ],
              "mode": "trend",
              "orderBy": [],
              "table": "commits",
              "timeField": "time",
              "timeFieldType": "DateTime"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT time, commits, avg(commits) OVER (ORDER BY time ASC Rows BETWEEN 20 PRECEDING AND CURRENT ROW) AS `moving average` FROM (\n\nSELECT toDateTime(toStartOfWeek(time)) as time,  count(*) commits FROM default.commits WHERE $__timeFilter(time) GROUP BY time ORDER BY time ASC LIMIT 10000\n)",
          "refId": "A"
        }
      ],
      "title": "Commits over Time",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 11,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 2,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "total lines"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "light-blue",
                  "mode": "fixed"
                }
              },
              {
                "id": "unit",
                "value": "short"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 9
      },
      "id": 8,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT  add - delete as `total lines`, time FROM (SELECT $__timeInterval(time) as time, sum(sum(lines_added)) OVER (ORDER BY time ASC) AS add, sum(sum(lines_deleted)) OVER (ORDER BY time ASC) AS delete FROM file_changes WHERE $__timeFilter(time) AND file_extension IN ('go', 'ts', 'js', 'html') GROUP BY time ORDER BY time)",
          "refId": "A"
        }
      ],
      "title": "Lines of code",
      "type": "timeseries"
    },
    {
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 9
      },
      "id": 24,
      "libraryPanel": {
        "uid": "wlFBSgTVz",
        "name": "Code change activity"
      }
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-YlRd"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 12,
        "w": 12,
        "x": 0,
        "y": 18
      },
      "id": 20,
      "maxDataPoints": 100,
      "options": {
        "groupByField": "delete_author",
        "sizeField": "c",
        "textField": "add_author",
        "tiling": "treemapSquarify"
      },
      "pluginVersion": "9.3.2-67a213dc85",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT\n    prev_author || '(a)' as add_author,\n    author  || '(d)' as delete_author,\n    count() AS c\nFROM line_changes\nWHERE $__timeFilter(time) AND (sign = -1) AND (file_extension IN ('go', 'ts')) AND (line_type NOT IN ('Punct', 'Empty')) AND (author != prev_author) AND (prev_author != '')\nGROUP BY\n    prev_author,\n    author\nORDER BY c DESC\nLIMIT 1 BY prev_author\nLIMIT 100\n",
          "refId": "A"
        }
      ],
      "title": "Who rewrites whose code",
      "type": "marcusolsson-treemap-panel"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "scaleDistribution": {
              "type": "linear"
            }
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 12,
        "w": 12,
        "x": 12,
        "y": 18
      },
      "id": 4,
      "options": {
        "calculate": false,
        "cellGap": 0,
        "color": {
          "exponent": 0.5,
          "fill": "dark-orange",
          "max": 10,
          "mode": "scheme",
          "reverse": false,
          "scale": "exponential",
          "scheme": "RdYlGn",
          "steps": 64
        },
        "exemplars": {
          "color": "rgba(255,0,255,0.7)"
        },
        "filterValues": {
          "le": 1e-9
        },
        "legend": {
          "show": false
        },
        "rowsFrame": {
          "layout": "auto"
        },
        "tooltip": {
          "show": true,
          "yHistogram": false
        },
        "yAxis": {
          "axisPlacement": "left",
          "reverse": false
        }
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 0,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT $__timeInterval(time) as time, author, count(*) as ` ` FROM commits WHERE $__timeFilter(time) AND author IN (\n    SELECT author\n    FROM commits WHERE author NOT LIKE '%renovate[bot]%' AND $__timeFilter(time)\n    GROUP BY author\n    ORDER BY count() DESC\n    LIMIT 15\n) GROUP BY author, time ORDER BY time, author ASC, time DESC LIMIT 10000",
          "refId": "A"
        }
      ],
      "title": "Top committers over time",
      "type": "heatmap"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-GrYlRd"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "url"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "targetBlank": true,
                    "title": "${__value.url} ",
                    "url": "${__data.fields.url}"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "comments"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "basic"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "authors"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "basic"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 0,
        "y": 30
      },
      "id": 12,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT\n    concat('https://github.com/', any(repo_name), '/commit/', commit_id) AS url,\n    count() AS comments,\n    uniq(actor_login) AS authors\nFROM github_events\nWHERE (event_type = 'CommitCommentEvent') AND notEmpty(commit_id) AND repo_name = 'grafana/grafana' AND $__timeFilter(created_at)\nGROUP BY\n    commit_id\nORDER BY count() DESC\nLIMIT 50",
          "refId": "A"
        }
      ],
      "title": "Hottest commits ",
      "type": "table"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "commit"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "targetBlank": true,
                    "title": "${__value.raw}",
                    "url": "https://github.com/grafana/grafana/commit/${__value.raw}"
                  }
                ]
              },
              {
                "id": "custom.displayMode",
                "value": "color-text"
              },
              {
                "id": "custom.width",
                "value": 87
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "author"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 144
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "time"
            },
            "properties": [
              {
                "id": "custom.width",
                "value": 154
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 12,
        "y": 30
      },
      "id": 39,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "new lines"
          }
        ]
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT  time, hash as commit, author, message, lines_added - lines_deleted as `new lines` FROM commits WHERE $__timeFilter(time) ORDER BY time DESC LIMIT 1000",
          "refId": "A"
        }
      ],
      "title": "Commits",
      "type": "table"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 40
      },
      "id": 41,
      "panels": [],
      "title": "Code Analysis",
      "type": "row"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-YlRd"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 12,
        "x": 0,
        "y": 41
      },
      "id": 31,
      "options": {
        "colorByField": "num_authors",
        "labelFields": [],
        "sizeField": "num_authors",
        "textField": "path",
        "tiling": "treemapSquarify"
      },
      "pluginVersion": "9.3.2-67a213dc85",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "WITH current_files AS\n    (\n        SELECT path\n        FROM\n        (\n            SELECT\n                old_path AS path,\n                max(time) AS last_time,\n                2 AS change_type\n            FROM file_changes\n            WHERE file_extension IN ('ts', 'js', 'go', 'html') \n            GROUP BY old_path\n            UNION ALL\n            SELECT\n                path,\n                max(time) AS last_time,\n                argMax(change_type, time) AS change_type\n            FROM file_changes\n            WHERE file_extension IN ('ts', 'js', 'go', 'html') \n            GROUP BY path\n        )\n        GROUP BY path\n        HAVING (argMax(change_type, last_time) != 2)\n        ORDER BY path ASC\n    )\nSELECT\n    path,\n    uniq(author) AS num_authors\nFROM file_changes\nWHERE path IN (current_files) AND $__timeFilter(time)\nGROUP BY path\nORDER BY num_authors DESC\nLIMIT 15",
          "refId": "A"
        }
      ],
      "title": "Files most number of authors",
      "type": "marcusolsson-treemap-panel"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "scaleDistribution": {
              "type": "linear"
            }
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 12,
        "x": 12,
        "y": 41
      },
      "id": 28,
      "maxDataPoints": 100,
      "options": {
        "calculate": false,
        "cellGap": 1,
        "color": {
          "exponent": 0.5,
          "fill": "dark-orange",
          "max": 1000,
          "mode": "scheme",
          "reverse": false,
          "scale": "exponential",
          "scheme": "RdYlGn",
          "steps": 64
        },
        "exemplars": {
          "color": "rgba(255,0,255,0.7)"
        },
        "filterValues": {
          "le": 1e-9
        },
        "legend": {
          "show": false
        },
        "rowsFrame": {
          "layout": "auto"
        },
        "tooltip": {
          "show": true,
          "yHistogram": false
        },
        "yAxis": {
          "axisPlacement": "left",
          "reverse": false
        }
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 0,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "WITH current_files AS\n    (\n        SELECT path\n        FROM\n        (\n            SELECT\n                old_path AS path,\n                max(time) AS last_time,\n                2 AS change_type\n            FROM file_changes\n            GROUP BY old_path\n            UNION ALL\n            SELECT\n                path,\n                max(time) AS last_time,\n                argMax(change_type, time) AS change_type\n            FROM file_changes\n            GROUP BY path\n        )\n        GROUP BY path\n        HAVING argMax(change_type, last_time) != 2\n        ORDER BY path ASC\n    ),\nmost_changes AS (\nSELECT\n    path\nFROM file_changes\nWHERE path IN (current_files) AND $__timeFilter(time)\nGROUP BY path\nORDER BY count() DESC\nLIMIT 20\n) SELECT $__timeInterval(time) as time, path, sum(lines_added) + sum(lines_deleted) as ` ` FROM file_changes  WHERE path IN most_changes AND path != 'yarn.lock' GROUP BY time, path ORDER BY time ASC",
          "refId": "A"
        }
      ],
      "title": "Files longest history",
      "transformations": [],
      "type": "heatmap"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-GrYlRd"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "d"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 12,
        "x": 0,
        "y": 52
      },
      "id": 26,
      "options": {
        "displayMode": "lcd",
        "minVizHeight": 10,
        "minVizWidth": 0,
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [],
          "fields": "",
          "values": true
        },
        "showUnfilled": true
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "WITH\n    changes AS\n    (\n        SELECT\n            path,\n            author,\n            commit_hash,\n            max_time,\n            type,\n            num_added,\n            num_deleted,\n            sum(num_added - num_deleted) OVER (PARTITION BY path ORDER BY max_time ASC) AS current_size,\n            if(current_size > 0, num_added / current_size, 0) AS percent_add,\n            if(current_size > 0, num_deleted / current_size, 0) AS percent_delete\n        FROM\n        (\n            SELECT\n                path,\n                any(author) AS author,\n                max(time) AS max_time,\n                commit_hash,\n                any(file_lines_added) AS num_added,\n                any(file_lines_deleted) AS num_deleted,\n                any(file_change_type) AS type\n            FROM line_changes\n            WHERE (file_change_type IN ('Add', 'Modify')) AND (file_extension IN ('ts', 'js', 'go', 'html')) AND $__timeFilter(time)\n            GROUP BY\n                path,\n                commit_hash\n            ORDER BY\n                path ASC,\n                max_time ASC\n        )\n    ),\n    rewrites AS\n    (\n        SELECT\n            *,\n            any(max_time) OVER (PARTITION BY path ORDER BY max_time ASC ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS previous_rewrite,\n            dateDiff('day', previous_rewrite, max_time) AS rewrite_days,\n            any(author) OVER (PARTITION BY path ORDER BY max_time ASC ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS prev_author\n        FROM changes\n        WHERE (type = 'Modify') AND (percent_add >= 0.5) AND (percent_delete >= 0.5) AND (current_size > 50)\n    )\nSELECT\n    prev_author,\n    avg(rewrite_days) AS ` `\nFROM rewrites\nGROUP BY prev_author\nHAVING uniq(path) > 10\nORDER BY ` ` DESC\nLIMIT 10",
          "refId": "A"
        }
      ],
      "title": "Sticky code - Average code age",
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-YlRd"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "fillOpacity": 61,
            "gradientMode": "opacity",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineWidth": 1,
            "scaleDistribution": {
              "type": "linear"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "d"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 11,
        "w": 12,
        "x": 12,
        "y": 52
      },
      "id": 30,
      "options": {
        "barRadius": 0,
        "barWidth": 0.98,
        "colorByField": "avg_code_age",
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "right",
          "showLegend": false
        },
        "orientation": "auto",
        "showValue": "never",
        "stacking": "none",
        "text": {},
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        },
        "xField": "path",
        "xTickLabelRotation": 15,
        "xTickLabelSpacing": 0
      },
      "pluginVersion": "9.3.2-67a213dc85",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "WITH\n    current_files AS\n    (\n        SELECT path\n        FROM\n        (\n            SELECT\n                old_path AS path,\n                max(time) AS last_time,\n                2 AS change_type\n            FROM file_changes\n            GROUP BY old_path\n            UNION ALL\n            SELECT\n                path,\n                max(time) AS last_time,\n                argMax(change_type, time) AS change_type\n            FROM file_changes\n            GROUP BY path\n        )\n        GROUP BY path\n        HAVING (argMax(change_type, last_time) != 2)\n        ORDER BY path ASC\n    ),\n    lines_removed AS\n    (\n        SELECT\n            added_code.path AS path,\n            added_code.line,\n            added_code.time AS added_day,\n            dateDiff('day', added_code.time, removed_code.time) AS days_present\n        FROM\n        (\n            SELECT\n                path,\n                line,\n                max(time) AS time,\n                any(file_extension) AS file_extension\n            FROM line_changes\n            WHERE (sign = 1) AND (line_type NOT IN ('Punct', 'Empty'))\n            GROUP BY\n                path,\n                line\n        ) AS added_code\n        INNER JOIN\n        (\n            SELECT\n                path,\n                line,\n                max(time) AS time\n            FROM line_changes\n            WHERE (sign = -1) AND (line_type NOT IN ('Punct', 'Empty'))\n            GROUP BY\n                path,\n                line\n        ) AS removed_code USING (path, line)\n        WHERE (removed_code.time > added_code.time) AND (path IN (current_files)) AND (file_extension IN ('go', 'ts', 'html', 'js')) AND $__timeFilter(time)\n    )\nSELECT\n    path,\n    avg(days_present) AS avg_code_age\nFROM lines_removed\nGROUP BY path\nORDER BY avg_code_age DESC\nLIMIT 15",
          "refId": "A"
        }
      ],
      "title": "Files by average code age",
      "type": "barchart"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 63
      },
      "id": 35,
      "panels": [],
      "title": "Repository Analysis",
      "type": "row"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "inspect": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "url"
            },
            "properties": [
              {
                "id": "links",
                "value": [
                  {
                    "targetBlank": true,
                    "title": "${__value.url}",
                    "url": "${__data.fields.url}"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "comments"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "gradient-gauge"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "authors"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "lcd-gauge"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 11,
        "w": 12,
        "x": 0,
        "y": 64
      },
      "id": 10,
      "options": {
        "footer": {
          "fields": "",
          "reducer": [
            "sum"
          ],
          "show": false
        },
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "comments"
          }
        ]
      },
      "pluginVersion": "9.3.6",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT\n    concat('https://github.com/', any(repo_name), '/issues/', toString(number)) AS url,\n    count() AS comments,\n    uniq(actor_login) AS authors\nFROM github_events\nWHERE (event_type = 'IssueCommentEvent') AND (action = 'created') AND (number > 10) AND repo_name LIKE '%grafana/grafana%' AND $__timeFilter(created_at)\nGROUP BY\n    number\nHAVING authors >= 10",
          "refId": "A"
        }
      ],
      "title": "Most popular issues",
      "type": "table"
    },
    {
      "gridPos": {
        "h": 11,
        "w": 12,
        "x": 12,
        "y": 64
      },
      "id": 16,
      "libraryPanel": {
        "uid": "SW9EIRT4k",
        "name": "ClickHouse and Grafana "
      }
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "fillOpacity": 80,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineWidth": 1,
            "scaleDistribution": {
              "type": "linear"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 0,
        "y": 75
      },
      "id": 14,
      "options": {
        "barRadius": 0,
        "barWidth": 0.97,
        "groupWidth": 0.7,
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "right",
          "showLegend": true
        },
        "orientation": "horizontal",
        "showValue": "never",
        "stacking": "percent",
        "tooltip": {
          "mode": "single",
          "sort": "none"
        },
        "xTickLabelRotation": 0,
        "xTickLabelSpacing": 0
      },
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT\n    repo_name,\n    count() AS prs,\n    uniq(actor_login) AS authors\nFROM github_events\nWHERE (event_type = 'PullRequestEvent') AND (action = 'opened') AND (actor_login IN\n(\n    SELECT actor_login\n    FROM github_events\n    WHERE (event_type = 'PullRequestEvent') AND (action = 'opened') AND (repo_name IN ('grafana/grafana'))\n)) AND (repo_name NOT ILIKE '%grafana%') AND $__timeFilter(created_at)\nGROUP BY repo_name\nORDER BY authors DESC\nLIMIT 20",
          "refId": "A"
        }
      ],
      "title": "Affinity by issues and PRs",
      "type": "barchart"
    },
    {
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 12,
        "y": 75
      },
      "id": 18,
      "libraryPanel": {
        "uid": "MtePIgT4k",
        "name": "Common contributors"
      }
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            }
          },
          "mappings": [],
          "max": 10000
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 7,
        "x": 0,
        "y": 85
      },
      "id": 22,
      "options": {
        "displayLabels": [
          "name",
          "value"
        ],
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "pieType": "donut",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.3.2-67a213dc85",
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "SELECT\n    countIf(clickhouse_star < grafana_star) AS `ClickHouse`,\n    countIf(grafana_star < clickhouse_star) AS `Grafana`\nFROM\n(\n    SELECT\n        actor_login,\n        max(created_at) AS grafana_star\n    FROM github_events\n    WHERE (event_type = 'WatchEvent') AND (repo_name IN ('grafana/grafana')) AND (actor_login != 'dependabot[bot]') AND $__timeFilter(created_at)\n    GROUP BY actor_login\n) AS grafana\nINNER JOIN\n(\n    SELECT\n        actor_login,\n        max(created_at) AS clickhouse_star\n    FROM github_events\n    WHERE (event_type = 'WatchEvent') AND (repo_name IN ('yandex/ClickHouse', 'ClickHouse/ClickHouse')) AND $__timeFilter(created_at)\n    GROUP BY actor_login\n) AS clickhouse USING (actor_login)",
          "refId": "A"
        }
      ],
      "title": "Who stars first?",
      "type": "piechart"
    },
    {
      "datasource": {
        "type": "grafana-clickhouse-datasource",
        "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
      },
      "gridPos": {
        "h": 10,
        "w": 17,
        "x": 7,
        "y": 85
      },
      "id": 33,
      "options": {
        "series_index": 0,
        "wordCloudOptions": {
          "deterministic": true,
          "enableTooltip": true,
          "fontFamily": "arial",
          "fontSizes": [
            15,
            80
          ],
          "padding": 1,
          "rotationAngles": [
            0,
            0
          ],
          "rotations": 2,
          "scale": "sqrt",
          "spiral": "archimedean",
          "transitionDuration": 800
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "grafana-clickhouse-datasource",
            "uid": "${DS_CLICKHOUSE-GRAFANA-GIT}"
          },
          "format": 1,
          "meta": {
            "builderOptions": {
              "fields": [],
              "limit": 100,
              "mode": "list"
            }
          },
          "queryType": "sql",
          "rawSql": "WITH stop_words AS\n    (\n        SELECT token\n        FROM stopwords\n    )\nSELECT\n    phrase,\n    count() AS c\nFROM\n(\n    SELECT\n        arrayJoin(shingles) AS shingle,\n        concat(shingle.1, ' ', shingle.2) AS phrase\n    FROM\n    (\n        SELECT\n            tokens,\n            arrayFilter(t -> (NOT ((t.2) IS NULL)), arrayZip(tokens, arrayPushBack(arrayPopFront(tokens), NULL))) AS shingles\n        FROM\n        (\n            SELECT arrayFilter(t -> ((lower(t) NOT IN (stop_words)) AND (length(t) > 2)), alphaTokens(body)) AS tokens \n            FROM github_events WHERE $__timeFilter(created_at) and repo_name = 'grafana/grafana'\n        )\n        WHERE length(tokens) > 0\n    )\n)\nGROUP BY phrase\nORDER BY c DESC\nLIMIT 20",
          "refId": "A"
        }
      ],
      "title": "Common Issue Phrases",
      "type": "magnesium-wordcloud-panel"
    }
  ],
  "refresh": false,
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "description": "",
        "hide": 2,
        "name": "clickhouse_adhoc_query",
        "query": "${VAR_CLICKHOUSE_ADHOC_QUERY}",
        "skipUrlSync": false,
        "type": "constant",
        "current": {
          "value": "${VAR_CLICKHOUSE_ADHOC_QUERY}",
          "text": "${VAR_CLICKHOUSE_ADHOC_QUERY}",
          "selected": false
        },
        "options": [
          {
            "value": "${VAR_CLICKHOUSE_ADHOC_QUERY}",
            "text": "${VAR_CLICKHOUSE_ADHOC_QUERY}",
            "selected": false
          }
        ]
      },
      {
        "datasource": {
          "type": "grafana-clickhouse-datasource",
          "uid": "HmCnXAhVk"
        },
        "filters": [],
        "hide": 0,
        "name": "filter",
        "skipUrlSync": false,
        "type": "adhoc"
      }
    ]
  },
  "time": {
    "from": "now-10y",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Grafana Analysis",
  "uid": "_nqn8AhVz",
  "version": 46,
  "weekStart": "",
  "gnetId": 18065,
  "description": "An analysis of the Grafana repository over the last 10 yrs."
}