Skip to content

Commit

Permalink
feat: add session counter
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Jun 27, 2023
1 parent c35220b commit eee94f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/peeringdb/peeringdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func networkInfo(asn uint32, queryTimeout uint, apiKey string) (*Data, error) {

var pDbResponse Response
if err := json.Unmarshal(body, &pDbResponse); err != nil {
return nil, fmt.Errorf("PeeringDB JSON Unmarshal: %s", err)
return nil, fmt.Errorf("%s PeeringDB JSON Unmarshal: %s", req.URL, err)
}

if len(pDbResponse.Data) < 1 {
Expand Down Expand Up @@ -209,7 +209,7 @@ func NeverViaRouteServers(queryTimeout uint, apiKey string) ([]uint32, error) {

var pDbResponse Response
if err := json.Unmarshal(body, &pDbResponse); err != nil {
return nil, fmt.Errorf("PeeringDB JSON Unmarshal: %s", err)
return nil, fmt.Errorf("%s PeeringDB JSON Unmarshal: %s", req.URL, err)
}

var asns []uint32 // ASNs that are reportedly never reachable via route servers
Expand Down Expand Up @@ -255,7 +255,7 @@ func IXLANs(asn uint32, peeringDbQueryTimeout uint, apiKey string) ([]IxLanData,

var pDbResponse IxLanResponse
if err := json.Unmarshal(body, &pDbResponse); err != nil {
return nil, fmt.Errorf("PeeringDB JSON Unmarshal: %s", err)
return nil, fmt.Errorf("%s PeeringDB JSON Unmarshal: %s", req.URL, err)
}

if len(pDbResponse.Data) < 1 {
Expand Down
10 changes: 9 additions & 1 deletion pkg/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,5 +854,13 @@ func Run(configFilename, lockFile, version string, noConfigure, dryRun, withdraw
}
}

log.Infof("Processed %d peers in %s", len(c.Peers), time.Since(startTime).Round(time.Second))
log.Infof("Processed %d sessions over %d peers in %s", countSessions(c.Peers), len(c.Peers), time.Since(startTime).Round(time.Second))
}

func countSessions(peers map[string]*config.Peer) int {
var count int
for _, p := range peers {
count += len(*p.NeighborIPs)
}
return count
}

0 comments on commit eee94f4

Please sign in to comment.