-
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.
Merge pull request #64 from status-im/feat/message-reliability
Add remaining metrics for message reliability
- Loading branch information
Showing
9 changed files
with
325 additions
and
60 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
Large diffs are not rendered by default.
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,34 @@ | ||
CREATE TABLE IF NOT EXISTS dial_error_types ( | ||
id INTEGER PRIMARY KEY, | ||
name TEXT NOT NULL | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS dialFailure ( | ||
id SERIAL PRIMARY KEY, | ||
recordId INTEGER NOT NULL, | ||
errorType INTEGER NOT NULL, | ||
errorMsg TEXT, | ||
protocols TEXT NOT NULL, | ||
timestamp INTEGER NOT NULL, | ||
CONSTRAINT dialFailure_unique UNIQUE (recordId, errorType, protocols, timestamp), | ||
CONSTRAINT fk_dialFailure_errorType FOREIGN KEY (errorType) REFERENCES dial_error_types(id) | ||
); | ||
|
||
ALTER TABLE dialFailure ADD CONSTRAINT fk_dialFailure_telemetryRecord | ||
FOREIGN KEY (recordId) REFERENCES telemetryRecord(id); | ||
|
||
INSERT INTO dial_error_types (id, name) | ||
SELECT v.id, v.name | ||
FROM (VALUES | ||
(0, 'Unknown'), | ||
(1, 'I/O Timeout'), | ||
(2, 'Connection Refused'), | ||
(3, 'Relay Circuit Failed'), | ||
(4, 'Relay No Reservation'), | ||
(5, 'Security Negotiation Failed'), | ||
(6, 'Concurrent Dial Succeeded'), | ||
(7, 'Concurrent Dial Failed') | ||
) AS v(id, name) | ||
WHERE NOT EXISTS ( | ||
SELECT 1 FROM dial_error_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
CREATE TABLE IF NOT EXISTS missingMessages ( | ||
id SERIAL PRIMARY KEY, | ||
messageHash TEXT NOT NULL, | ||
sentAt INTEGER NOT NULL, | ||
contentTopic TEXT NOT NULL, | ||
pubsubTopic TEXT NOT NULL, | ||
recordId INTEGER NOT NULL | ||
); | ||
|
||
ALTER TABLE missingMessages ADD CONSTRAINT fk_missingMessages_telemetryRecord | ||
FOREIGN KEY (recordId) REFERENCES telemetryRecord(id); | ||
|
||
ALTER TABLE missingMessages | ||
ADD CONSTRAINT missingMessages_unique | ||
UNIQUE ( | ||
recordId, | ||
messageHash, | ||
contentTopic | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS missingRelevantMessages ( | ||
id SERIAL PRIMARY KEY, | ||
messageHash TEXT NOT NULL, | ||
sentAt INTEGER NOT NULL, | ||
contentTopic TEXT NOT NULL, | ||
pubsubTopic TEXT NOT NULL, | ||
recordId INTEGER NOT NULL | ||
); | ||
|
||
ALTER TABLE missingRelevantMessages ADD CONSTRAINT fk_missingRelevantMessages_telemetryRecord | ||
FOREIGN KEY (recordId) REFERENCES telemetryRecord(id); | ||
|
||
ALTER TABLE missingRelevantMessages | ||
ADD CONSTRAINT missingRelevantMessages_unique | ||
UNIQUE ( | ||
recordId, | ||
messageHash, | ||
contentTopic | ||
); |
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,10 @@ | ||
CREATE TABLE IF NOT EXISTS messageDeliveryConfirmed ( | ||
id SERIAL PRIMARY KEY, | ||
recordId INTEGER NOT NULL, | ||
messageHash TEXT NOT NULL, | ||
timestamp INTEGER NOT NULL, | ||
CONSTRAINT messageDeliveryConfirmed_unique UNIQUE (recordId, messageHash, timestamp) | ||
); | ||
|
||
ALTER TABLE messageDeliveryConfirmed ADD CONSTRAINT fk_messageDeliveryConfirmed_telemetryRecord | ||
FOREIGN KEY (recordId) REFERENCES telemetryRecord(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/status-im/telemetry/pkg/types" | ||
) | ||
|
||
type DialFailure struct { | ||
GenericMetric[types.DialFailure] | ||
} | ||
|
||
var ( | ||
DialFailureProcessor = &DialFailure{} | ||
) |
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,23 @@ | ||
package metrics | ||
|
||
import ( | ||
"github.com/status-im/telemetry/pkg/types" | ||
) | ||
|
||
type MissingMessage struct { | ||
GenericMetric[types.MissingMessage] | ||
} | ||
|
||
type MissingRelevantMessage struct { | ||
GenericMetric[types.MissingRelevantMessage] | ||
} | ||
|
||
type MessageDeliveryConfirmed struct { | ||
GenericMetric[types.MessageDeliveryConfirmed] | ||
} | ||
|
||
var ( | ||
MissingMessageProcessor = &MissingMessage{} | ||
MissingRelevantMessageProcessor = &MissingRelevantMessage{} | ||
MessageDeliveryConfirmedProcessor = &MessageDeliveryConfirmed{} | ||
) |
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