forked from ChainSafe/gossamer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(telemetry): send telemetry messages when GRANDPA receieves commi…
…t or vote messages (ChainSafe#2015) * telemetry when GRANDPA receieve commit or vote messages Send `afg.received_commit` when grandpa receives a commit message. Send `afg.received_precommit` or `afg.received_prevote` when grandpa receives a vote message Closes ChainSafe#1840 Closes ChainSafe#1839 Closes ChainSafe#1838
- Loading branch information
1 parent
c17b53a
commit 7bf40e1
Showing
7 changed files
with
141 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright 2021 ChainSafe Systems (ON) | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
package telemetry | ||
|
||
import "github.com/ChainSafe/gossamer/lib/common" | ||
|
||
// AfG ("Al's Finality Gadget") is synonymous with GRANDPA. | ||
|
||
type afgReceivedTM struct { | ||
TargetHash common.Hash `json:"target_hash"` | ||
TargetNumber string `json:"target_number"` | ||
Voter string `json:"voter"` | ||
} | ||
|
||
// afgReceivedPrecommitTM holds `afg.received_precommit` telemetry message which is | ||
// supposed to be sent when grandpa client receives a precommit. | ||
type afgReceivedPrecommitTM afgReceivedTM | ||
|
||
// NewAfgReceivedPrecommitTM gets a new afgReceivedPrecommitTM struct. | ||
func NewAfgReceivedPrecommitTM(targetHash common.Hash, targetNumber, voter string) Message { | ||
return &afgReceivedPrecommitTM{ | ||
TargetHash: targetHash, | ||
TargetNumber: targetNumber, | ||
Voter: voter, | ||
} | ||
} | ||
|
||
func (afgReceivedPrecommitTM) messageType() string { | ||
return afgReceivedPrecommitMsg | ||
} | ||
|
||
// afgReceivedPrevoteTM holds `afg.received_prevote` telemetry message which is | ||
// supposed to be sent when grandpa client receives a prevote. | ||
type afgReceivedPrevoteTM afgReceivedTM | ||
|
||
// NewAfgReceivedPrevoteTM gets a new afgReceivedPrevoteTM struct. | ||
func NewAfgReceivedPrevoteTM(targetHash common.Hash, targetNumber, voter string) Message { | ||
return &afgReceivedPrevoteTM{ | ||
TargetHash: targetHash, | ||
TargetNumber: targetNumber, | ||
Voter: voter, | ||
} | ||
} | ||
|
||
func (afgReceivedPrevoteTM) messageType() string { | ||
return afgReceivedPrevoteMsg | ||
} | ||
|
||
// afgReceivedCommitTM holds `afg.received_commit` telemetry message which is | ||
// supposed to be sent when grandpa client receives a commit. | ||
type afgReceivedCommitTM struct { | ||
TargetHash common.Hash `json:"target_hash"` | ||
TargetNumber string `json:"target_number"` | ||
ContainsPrecommitsSignedBy []string `json:"contains_precommits_signed_by"` | ||
} | ||
|
||
// NewAfgReceivedCommitTM gets a new afgReceivedCommitTM struct. | ||
func NewAfgReceivedCommitTM(targetHash common.Hash, targetNumber string, containsPrecommitsSignedBy []string) Message { | ||
return &afgReceivedCommitTM{ | ||
TargetHash: targetHash, | ||
TargetNumber: targetNumber, | ||
ContainsPrecommitsSignedBy: containsPrecommitsSignedBy, | ||
} | ||
} | ||
|
||
func (afgReceivedCommitTM) messageType() string { | ||
return afgReceivedCommitMsg | ||
} |
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
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