Skip to content

Commit

Permalink
feat: redesign layout
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
  • Loading branch information
wolf31o2 committed Feb 3, 2024
1 parent bbe06bd commit 059a9ee
Show file tree
Hide file tree
Showing 7 changed files with 1,079 additions and 1,244 deletions.
10 changes: 0 additions & 10 deletions env.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@ func getSlotTipRef(g *localstatequery.GenesisConfigResult) uint64 {
return byronSlots + ((currentTimeSec - byronEndTime) / uint64(g.SlotLength/1000000))
}

// Calculate KES expiration from node metrics
func kesExpiration(
g *localstatequery.GenesisConfigResult,
p *PromMetrics,
) time.Time {
currentTimeSec := uint64(time.Now().Unix() - 1)
expirationTimeSec := currentTimeSec - (uint64(g.SlotLength/1000000) * (getSlotTipRef(g) % uint64(g.SlotsPerKESPeriod))) + (uint64(g.SlotLength/1000000) + uint64(g.SlotsPerKESPeriod)*p.RemainingKesPeriods)
return time.Unix(int64(expirationTimeSec), 0)
}

// Calculate expected interval between blocks
func slotInterval(g *localstatequery.GenesisConfigResult) uint64 {
// g.SlotLength is nanoseconds
Expand Down
4 changes: 4 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Config struct {
type AppConfig struct {
NodeName string `yaml:"nodeName" envconfig:"NODE_NAME"`
Network string `yaml:"network" envconfig:"NETWORK"`
Refresh uint32 `yaml:"refresh" envconfig:"REFRESH"`
Retries uint32 `yaml:"retries" envconfig:"RETRIES"`
}

Expand All @@ -49,6 +50,7 @@ type NodeConfig struct {
type PrometheusConfig struct {
Host string `yaml:"host" envconfig:"PROM_HOST"`
Port uint32 `yaml:"port" envconfig:"PROM_PORT"`
Refresh uint32 `yaml:"refresh" envconfig:"PROM_REFRESH"`
Timeout uint32 `yaml:"timeout" envconfig:"PROM_TIMEOUT"`
}

Expand All @@ -64,6 +66,7 @@ var globalConfig = &Config{
App: AppConfig{
NodeName: "Cardano Node",
Network: "",
Refresh: 1,
Retries: 3,
},
Node: NodeConfig{
Expand All @@ -76,6 +79,7 @@ var globalConfig = &Config{
Prometheus: PrometheusConfig{
Host: "127.0.0.1",
Port: 12798,
Refresh: 3,
Timeout: 3,
},
}
Expand Down
Loading

0 comments on commit 059a9ee

Please sign in to comment.