Skip to main content

Prometheus

Basics

We offer access to a Prometheus endpoint under https://<tenant>-api.codebgp.com/metrics. To access, you first need to get the corresponding credentials from Code BGP. For a full documentation of the Prometheus API please check this page.

To retrieve the timeseries of a metric use the following command (in this example we use codebgp_filtered_data_sources_per_prefix_total):

curl -s  -u 'username:password' --data-urlencode "query=codebgp_filtered_data_sources_per_prefix_total" --data-urlencode "start=t1"  --data-urlencode "end=t2" --data-urlencode "step=2m"    https://<tenant>-api.codebgp.com/metrics/api/v1/query_range

The above command returns a query range, but you can request more types (visit API page).

Supported Metrics

Configured Metrics

These metrics are related to the configuration of the user (data sources, prefixes and ASNs). Besides setting the corresponding prometheus metric, they also update the filtered metrics (when needed) with the updated configuration, so that they can filter properly.

Metric NameDescriptionLabels
configured_asns_totalThe total number of configured ASNs-
configured_prefixes_totalThe total number of configured prefixes-
configured_data_services_totalThe total number of configured data services-

Unfiltered Metrics

These metrics are related to the raw data found in the database, regardless of the current configuration.

Metric NameDescriptionLabels
unfiltered_asns_totalThe total number of ASNs-
unfiltered_prefixes_totalThe total number of prefixesip_version
unfiltered_data_sources_totalThe total number of data sourceshost peer_ip peer_asn data_service city country continent
unfiltered_peerings_totalThe total number of peerings-
unfiltered_routes_totalThe total number of routesip_version rpki_status network origin_as neighbor_as

Unfiltered Metrics-Aggregates

Unfiltered metrics that are computed as aggregates between two or more objects (e.g., asns per prefix).

Metric NameDescriptionLabels
unfiltered_asns_per_prefix_totalThe total number of ASNs that have "seen" each prefixnetwork
unfiltered_data_sources_per_asn_totalThe total number of data sources that have "seen" each ASNautonomous_system data_service rrc peer_ip peer_asn city continent country
unfiltered_prefixes_per_asn_totalThe total number of prefixes announced by each ASNautonomous_system

Filtered Metrics

These metrics are filtered, according to the current configuration (mainly configured ASNs and prefixes).

  • Filtered prefixes: [configured prefixes] U [prefixes announced by the configured ASNs & filter_on_asn is origin] U [prefixes where at least one conf ASN is present anywhere in the as-path of any respective route & filter_on_asn is any]
  • Filtered ASNs: [configured ASNs] U [ASNs that have announced configured prefixes]
Metric NameDescriptionLabels
filtered_asns_totalThe total number of active configured ASNs (like unfiltered_asns_total but only for the configured ASNs)-
filtered_prefixes_totalThe total number of filtered prefixes (explained above)ip_version
filtered_peerings_totalThe total number of peerings where the peer on each side of the peer pair is a configured ASNside autonomous_system
filtered_rpki_roas_totalThe total number of RPKI ROAs for the configured prefixes and configured ASNsautonomous_system network max_length ip_version
filtered_routes_totalThe total number of routes of filtered prefixes (explained above)ip_version rpki_status network origin_as neighbor_as

Filtered Metrics-Aggregates

Filtered metrics that are computed as aggregates between two or more objects (e.g., ASNs per prefix).

Metric NameDescriptionLabels
filtered_prefixes_per_configured_asn_totalThe total number of prefixes, that are associated with each configured ASN (announced by or found in the AS path)ip_version autonomous_system
filtered_prefixes_per_asn_totalThe total number of prefixes associated with each filtered ASNip_version autonomous_system
filtered_data_sources_per_prefix_totalThe total number of data sources per filtered prefixnetwork ip_version data_service city continent country
filtered_data_sources_per_asn_totalThe total number of data sources for each configured ASNautonomous_system data_service city continent country
filtered_asns_per_prefix_totalThe total number of ASNs per filtered prefixip_version network
filtered_announced_prefixes_per_configured_asn_totalThe total number of prefixes announced by each configured ASNip_version autonomous_system
filtered_prefixes_per_peering_totalThe total number of prefixes announced over each adjacent peeringautonomous_system_local autonomous_system_neighbor