-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add metrics for peer count by shard and by origin
- Loading branch information
1 parent
e14f337
commit 4e937fa
Showing
8 changed files
with
255 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
CREATE TABLE IF NOT EXISTS peerCountByShard ( | ||
id SERIAL PRIMARY KEY, | ||
recordId INTEGER NOT NULL, | ||
count INTEGER NOT NULL, | ||
shard INTEGER NOT NULL, | ||
timestamp INTEGER NOT NULL, | ||
CONSTRAINT peerCountByShard_unique UNIQUE (recordId, count, shard, timestamp) | ||
); | ||
|
||
ALTER TABLE peerCountByShard ADD CONSTRAINT fk_peerCountByShard_telemetryRecord | ||
FOREIGN KEY (recordId) REFERENCES telemetryRecord(id); | ||
|
||
CREATE TABLE IF NOT EXISTS peerCountByOrigin ( | ||
id SERIAL PRIMARY KEY, | ||
recordId INTEGER NOT NULL, | ||
count INTEGER NOT NULL, | ||
origin INTEGER NOT NULL, | ||
timestamp INTEGER NOT NULL, | ||
CONSTRAINT peerCountByOrigin_unique UNIQUE (recordId, count, origin, timestamp) | ||
); | ||
|
||
ALTER TABLE peerCountByOrigin ADD CONSTRAINT fk_peerCountByOrigin_telemetryRecord | ||
FOREIGN KEY (recordId) REFERENCES telemetryRecord(id); | ||
|
||
CREATE TABLE IF NOT EXISTS origin_types ( | ||
id INTEGER PRIMARY KEY, | ||
name TEXT NOT NULL | ||
); | ||
|
||
INSERT INTO origin_types (id, name) | ||
SELECT v.id, v.name | ||
FROM (VALUES | ||
(0, 'Unknown'), | ||
(1, 'Discv5'), | ||
(2, 'Static'), | ||
(3, 'PeerExchange'), | ||
(4, 'DNSDiscovery'), | ||
(5, 'Rendezvous'), | ||
(6, 'PeerManager') | ||
) AS v(id, name) | ||
WHERE NOT EXISTS ( | ||
SELECT 1 FROM origin_types WHERE id = v.id | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters