Skip to content

Commit 8a2f9f9

Browse files
committed
Update the Primery Key for Quay in the Database
1 parent d6eda78 commit 8a2f9f9

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed

Diff for: grafana/dashboard/dashboard.json

+52-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"targets": [
1010
{
1111
"datasource": "MySQL",
12-
"rawSql": "SELECT DATE(datetime) AS date, kind, SUM(count) AS total_count FROM aggregated_logs GROUP BY date, kind ORDER BY date ASC;",
12+
"rawSql": "SELECT DATE(datetime) AS date, SUM(count) AS total_count FROM aggregated_logs GROUP BY date ORDER BY date ASC;",
1313
"format": "time_series"
1414
}
1515
],
@@ -34,7 +34,7 @@
3434
"targets": [
3535
{
3636
"datasource": "MySQL",
37-
"rawSql": "SELECT DATE_FORMAT(datetime, '%Y-%m') AS month, kind, SUM(count) AS total_count FROM aggregated_logsGROUP BY month, kind ORDER BY month ASC;",
37+
"rawSql": "SELECT DATE_FORMAT(datetime, '%Y-%m') AS month, SUM(count) AS total_count FROM aggregated_logs GROUP BY month ORDER BY month ASC;",
3838
"format": "time_series"
3939
}
4040
],
@@ -53,6 +53,56 @@
5353
}
5454
}
5555
},
56+
{
57+
"title": "Quay Pull Events by Day and Kind",
58+
"type": "timeseries",
59+
"targets": [
60+
{
61+
"datasource": "MySQL",
62+
"rawSql": "SELECT DATE(datetime) AS day, kind, SUM(count) AS total_count FROM aggregated_logs GROUP BY day, kind ORDER BY day, kind;",
63+
"format": "time_series"
64+
}
65+
],
66+
"options": {
67+
"tooltip": {
68+
"mode": "all",
69+
"sort": "desc"
70+
}
71+
},
72+
"fieldConfig": {
73+
"defaults": {
74+
"custom": {
75+
"lineWidth": 2,
76+
"fillOpacity": 50
77+
}
78+
}
79+
}
80+
},
81+
{
82+
"title": "Quay Pull Events by Month and Kind",
83+
"type": "timeseries",
84+
"targets": [
85+
{
86+
"datasource": "MySQL",
87+
"rawSql": "SELECT DATE_FORMAT(datetime, '%Y-%m') AS month, kind, SUM(count) AS total_count FROM aggregated_logs GROUP BY month, kind ORDER BY month, kind;",
88+
"format": "time_series"
89+
}
90+
],
91+
"options": {
92+
"tooltip": {
93+
"mode": "all",
94+
"sort": "desc"
95+
}
96+
},
97+
"fieldConfig": {
98+
"defaults": {
99+
"custom": {
100+
"lineWidth": 2,
101+
"fillOpacity": 50
102+
}
103+
}
104+
}
105+
},
56106
{
57107
"title": "DCI Test Runs Over Time",
58108
"type": "timeseries",

Diff for: pkg/database.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func createTables(db *sql.DB) error {
6868
datetime DATETIME NOT NULL,
6969
count INT NOT NULL,
7070
kind VARCHAR(255) NOT NULL,
71-
PRIMARY KEY datetime
71+
PRIMARY KEY (datetime, kind)
7272
);`,
7373
`CREATE TABLE IF NOT EXISTS dci_components (
7474
job_id VARCHAR(36) PRIMARY KEY,

0 commit comments

Comments
 (0)