rogg

Overview #

bgpgg emits operational metrics through pluggable sinks. The same set of metrics is rendered in three formats:

  • JSON — one self-contained JSON line per metric, for platform-side extraction (GCP log-based metrics, Datadog, Azure, Loki, …).
  • CloudWatch EMF — Embedded Metric Format; CloudWatch Logs extracts the metrics server-side.
  • Prometheus — a pull endpoint scraped over HTTP.

JSON and CloudWatch EMF are push sinks and are mutually exclusive. Prometheus is a separate pull endpoint and can run alongside either. Enable a sink with a telemetry block – see Configuration.

Naming #

Metric names are PascalCase (the CloudWatch convention). Names end in their unit as a full word (Count, Seconds, Milliseconds, Bytes), except cumulative counters which end in Total. Names are a public contract: renames break dashboards.

Every metric carries a RouterId dimension (the local router-id). Other dimensions shape the time series; context fields are logged alongside a metric but are never turned into series.

Output formats #

The examples below all show the same event: a session to 10.0.0.1 reached Established on router 1.1.1.1.

JSON — the metric name, value, unit, timestamp, and router_id are top-level fields; dimensions sit under dim:

{"dim":{"Peer":"10.0.0.1"},"metric":"SessionEstablishedCount","router_id":"1.1.1.1","ts":"2026-07-25T23:00:00.000Z","unit":"Count","value":1}

CloudWatch EMF — the _aws block declares the dimension sets and unit; RouterId is added to every set:

{"Peer":"10.0.0.1","RouterId":"1.1.1.1","SessionEstablishedCount":1,"_aws":{"CloudWatchMetrics":[{"Dimensions":[["Peer","RouterId"]],"Metrics":[{"Name":"SessionEstablishedCount","Unit":"Count"}],"Namespace":"Rogg/Bgpgg"}],"Timestamp":1785024000000}}

Prometheus — names are converted to snake_case with a bgpgg_ prefix (SessionState becomes bgpgg_session_state), and dimensions become snake_case labels. Identity comes from the scraper’s instance/job labels, so there is no router_id label:

# TYPE bgpgg_session_state gauge
bgpgg_session_state{peer="10.0.0.1"} 6

The Prometheus endpoint serves the text format at /metrics. Default port is 9273 (loopback, unauthenticated by convention).

Event metrics #

Emitted once per occurrence, at the event site.

MetricValueUnitDimensionsContext
SessionEstablishedCount1CountPeer
SessionDownCount1CountPeerReason
ConnectRetryCount1CountPeer
TcpConnectionCount1CountPeer, Direction
CollisionDetectedCount1CountPeer
CollisionDialedWinsCount1CountPeer
CollisionAcceptedWinsCount1CountPeer
CollisionCandidateDroppedCount1CountPeer
HoldTimerExpiredCount1CountPeer
NotificationReceivedCount1CountPeer, CodeSubcode
NotificationSentCount1CountPeer, CodeSubcode
BmpConnectionDownCount1CountDestination
SessionConvergenceMillisecondsEstablished → EoR elapsedMillisecondsPeer, AfiSafi
InitialAdvertisementMillisecondsFull-table send elapsedMillisecondsPeer, AfiSafi
RouteRefreshProcessingMillisecondsAdj-rib-out resend elapsedMillisecondsPeer, AfiSafi
ConfigReloadSuccessCount1CountDurationMs
ConfigReloadFailureCount1CountDurationMs

Periodic metrics #

Sampled on the server timer every 60 seconds.

MetricValueUnitDimensions
PeerCountConfigured peer countCount
SessionStateFSM state code (1=Idle, 2=Connect, 3=Active, 4=OpenSent, 5=OpenConfirm, 6=Established)CountPeer
SessionUptimeSecondsSeconds since EstablishedSecondsPeer
LocRibRouteCountLoc-rib route countCountAfiSafi
AdjRibInRouteCountPer-peer route countCountPeer
AdjRibInAfiSafiRouteCountPer-family route countCountPeer, AfiSafi
AdjRibInRouteTotalCountRoutes received across all peersCount
AdjRibOutRouteCountPer-peer route countCountPeer
AdjRibOutAfiSafiRouteCountPer-family route countCountPeer, AfiSafi
AdjRibOutRouteTotalCountRoutes advertised across all peersCount
ProcessMemoryBytesResident set sizeBytes
MessagesReceivedTotalCumulative messages receivedCountPeer, MessageType
MessagesSentTotalCumulative messages sentCountPeer, MessageType

MessageType values: Open, Keepalive, Update, Notification, RouteRefresh (lowercase open, keepalive, … as Prometheus label values).