summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/collector.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/collector.go b/server/collector.go
index 72f820c0..92ec8fba 100644
--- a/server/collector.go
+++ b/server/collector.go
@@ -116,10 +116,14 @@ func path2data(path *table.Path) (map[string]interface{}, map[string]string) {
tags := map[string]string{
"PeerAddress": path.GetSource().Address.String(),
"PeerAS": fmt.Sprintf("%v", path.GetSource().AS),
- "NextHop": path.GetNexthop().String(),
- "OriginAS": fmt.Sprintf("%v", path.GetSourceAs()),
"Timestamp": path.GetTimestamp().String(),
}
+ if nexthop := path.GetNexthop(); len(nexthop) > 0 {
+ fields["NextHop"] = nexthop.String()
+ }
+ if originAS := path.GetSourceAs(); originAS != 0 {
+ fields["OriginAS"] = fmt.Sprintf("%v", originAS)
+ }
if err := bgp.FlatUpdate(tags, path.GetNlri().Flat()); err != nil {
log.Error(err)