-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(telemetry): Add scheduled and force changes telemetry metrics (#…
- Loading branch information
Showing
8 changed files
with
149 additions
and
29 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2021 ChainSafe Systems (ON) | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
package telemetry | ||
|
||
import ( | ||
"encoding/json" | ||
"time" | ||
) | ||
|
||
type afgApplyingForcedAuthoritySetChange AfgApplyingForcedAuthoritySetChange | ||
|
||
var _ json.Marshaler = (*AfgApplyingForcedAuthoritySetChange)(nil) | ||
|
||
// AfgApplyingForcedAuthoritySetChange is a telemetry message of type `afg.applying_forced_authority_set_change` | ||
// which is meant to be sent when a forced change is applied | ||
type AfgApplyingForcedAuthoritySetChange struct { | ||
Block string `json:"block"` | ||
} | ||
|
||
// NewAfgApplyingForcedAuthoritySetChange creates a new AfgAuthoritySetTM struct. | ||
func NewAfgApplyingForcedAuthoritySetChange(block string) *AfgApplyingForcedAuthoritySetChange { | ||
return &AfgApplyingForcedAuthoritySetChange{ | ||
Block: block, | ||
} | ||
} | ||
|
||
func (afg AfgApplyingForcedAuthoritySetChange) MarshalJSON() ([]byte, error) { | ||
telemetryData := struct { | ||
afgApplyingForcedAuthoritySetChange | ||
MessageType string `json:"msg"` | ||
Timestamp time.Time `json:"ts"` | ||
}{ | ||
afgApplyingForcedAuthoritySetChange: afgApplyingForcedAuthoritySetChange(afg), | ||
MessageType: afgApplyingForcedAuthoritySetChangeMsg, | ||
Timestamp: time.Now(), | ||
} | ||
|
||
return json.Marshal(telemetryData) | ||
} |
Oops, something went wrong.