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 Name | Description | Labels |
---|---|---|
configured_asns_total | The total number of configured ASNs | - |
configured_prefixes_total | The total number of configured prefixes | - |
configured_data_services_total | The 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 Name | Description | Labels |
---|---|---|
unfiltered_asns_total | The total number of ASNs | - |
unfiltered_prefixes_total | The total number of prefixes | ip_version |
unfiltered_data_sources_total | The total number of data sources | host peer_ip peer_asn data_service city country continent |
unfiltered_peerings_total | The total number of peerings | - |
unfiltered_routes_total | The total number of routes | ip_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 Name | Description | Labels |
---|---|---|
unfiltered_asns_per_prefix_total | The total number of ASNs that have "seen" each prefix | network |
unfiltered_data_sources_per_asn_total | The total number of data sources that have "seen" each ASN | autonomous_system data_service rrc peer_ip peer_asn city continent country |
unfiltered_prefixes_per_asn_total | The total number of prefixes announced by each ASN | autonomous_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
isorigin
] U [prefixes where at least one conf ASN is present anywhere in the as-path of any respective route &filter_on_asn
isany
] - Filtered ASNs: [configured ASNs] U [ASNs that have announced configured prefixes]
Metric Name | Description | Labels |
---|---|---|
filtered_asns_total | The total number of active configured ASNs (like unfiltered_asns_total but only for the configured ASNs) | - |
filtered_prefixes_total | The total number of filtered prefixes (explained above) | ip_version |
filtered_peerings_total | The total number of peerings where the peer on each side of the peer pair is a configured ASN | side autonomous_system |
filtered_rpki_roas_total | The total number of RPKI ROAs for the configured prefixes and configured ASNs | autonomous_system network max_length ip_version |
filtered_routes_total | The 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 Name | Description | Labels |
---|---|---|
filtered_prefixes_per_configured_asn_total | The 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_total | The total number of prefixes associated with each filtered ASN | ip_version autonomous_system |
filtered_data_sources_per_prefix_total | The total number of data sources per filtered prefix | network ip_version data_service city continent country |
filtered_data_sources_per_asn_total | The total number of data sources for each configured ASN | autonomous_system data_service city continent country |
filtered_asns_per_prefix_total | The total number of ASNs per filtered prefix | ip_version network |
filtered_announced_prefixes_per_configured_asn_total | The total number of prefixes announced by each configured ASN | ip_version autonomous_system |
filtered_prefixes_per_peering_total | The total number of prefixes announced over each adjacent peering | autonomous_system_local autonomous_system_neighbor |