Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Commit

Permalink
Log new values for latency, capacity and load
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Dec 21, 2021
1 parent 44b4fc6 commit c6d3e8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions captain/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ func maintainPublicStatus(ctx context.Context, task *modules.Task) error {
default:
load = 0
}
if loadAvg >= 0.8 {
log.Warningf("spn/captain: publishing 15m system load average of %.2f as %d", loadAvg, load)
}

// Run maintenance with the new data.
changed, err := publicIdentity.MaintainStatus(lanes, load, false)
Expand Down
10 changes: 9 additions & 1 deletion docks/crane_meta.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package docks

import "time"
import (
"time"

"github.com/safing/portbase/log"
)

const (
LaneLatencyTTL = 1 * time.Hour
Expand All @@ -14,6 +18,8 @@ func (crane *Crane) SetLaneLatency(latency time.Duration) {

crane.laneLatency = latency
crane.laneLatencyExpires = time.Now().Add(LaneLatencyTTL)

log.Infof("docks: %s lane latency set to %s", crane, latency)
}

// GetLaneLatency returns the lane latency.
Expand Down Expand Up @@ -41,6 +47,8 @@ func (crane *Crane) SetLaneCapacity(capacity int) {

crane.laneCapacity = capacity
crane.laneCapacityExpires = time.Now().Add(LaneCapacityTTL)

log.Infof("docks: %s lane capacity set to %.2f mbit/s", crane, float64(capacity)/1000000)
}

// GetLaneCapacity returns the lane capacity.
Expand Down

0 comments on commit c6d3e8c

Please sign in to comment.