Skip to main content
Version: 2.0.0

PDP Statistics

Permit.io PDPs report some basic uptime statistics to the API, as well as statistics on policy update message delivery. API docs are available here.

Authentication

You can authenticate to the statistics API with the same API key you use in your PDP or any Environment API Key. This is how to get your API Key.

Getting statistics from a PDP viewpoint

To get PDP statistics for all PDPs connected to your environment, simply issue a GET request to https://pdp-statistics.api.permit.io/v2/stats/{project}/{environment}/pdps

Your request should look something like this:

curl --location \
--request GET 'https://pdp-statistics.api.permit.io/v2/stats/{project}/{environment}/pdps' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR API KEY>'

As with other APIs, the project and environment can be either IDs or keys.

The returned results will look like this:

{
"data": [
{
"id": "3b66379e-0ff0-42c3-b60c-60e5af45025b",
"org_id": "b1c89115-2675-439e-8a27-187461df3b6e",
"project_id": "10a08cfd-475b-444e-bc8e-03f56acb4a3b",
"env_id": "a3c2b50b-b9c5-41be-b3cb-2b3a84041504",
"first_seen_at": "2024-03-24T22:22:59.131906",
"last_seen_at": "2024-03-24T23:17:27.941948",
"active": true,
"data_updates_accepted": 0,
"pdp_version": "0.2.37",
"opa_version": "0.62.1",
"os_name": "Linux",
"os_machine": "aarch64",
"os_release": "5.10.124-linuxkit",
"os_version": "#1 SMP PREEMPT Thu Jun 30 08:18:26 UTC 2022"
},
{
"id": "3e3611ea-8238-4950-9a81-412bb16ca460",
"org_id": "b1c89115-2675-439e-8a27-187461df3b6e",
"project_id": "10a08cfd-475b-444e-bc8e-03f56acb4a3b",
"env_id": "a3c2b50b-b9c5-41be-b3cb-2b3a84041504",
"first_seen_at": "2024-03-24T22:03:04.572160",
"last_seen_at": "2024-03-24T22:22:56.454870",
"active": false,
"data_updates_accepted": 0,
"pdp_version": "0.2.37",
"opa_version": "0.62.1",
"os_name": "Linux",
"os_machine": "aarch64",
"os_release": "5.10.124-linuxkit",
"os_version": "#1 SMP PREEMPT Thu Jun 30 08:18:26 UTC 2022"
}
]
}

To get PDP statistics for a specific PDP, first find the PDP id by looking at your PDP logs:

2024-03-25T05:48:57.717464+0000 | 19691 | horizon.state | INFO  | PDP ID is 62b97e3d-a5f2-417f-a6d6-ac010bb7202a

Then issue a GET request to https://pdp-statistics.api.permit.io/v2/stats/{project}/{environment}/pdps/{pdp_id}

Your request should look something like this:

curl --location \
--request GET 'https://pdp-statistics.api.permit.io/v2/stats/{project}/{environment}/pdps/{pdp_id}' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR API KEY>'

As with other APIs, the project and environment can be either IDs or keys.

The returned results will look like this:

{
"id": "3b66379e-0ff0-42c3-b60c-60e5af45025b",
"org_id": "b1c89115-2675-439e-8a27-187461df3b6e",
"project_id": "10a08cfd-475b-444e-bc8e-03f56acb4a3b",
"env_id": "a3c2b50b-b9c5-41be-b3cb-2b3a84041504",
"first_seen_at": "2024-03-24T22:22:59.131906",
"last_seen_at": "2024-03-24T23:25:30.509943",
"active": true,
"data_updates_accepted": 0,
"pdp_version": "0.2.37",
"opa_version": "0.62.1",
"os_name": "Linux",
"os_machine": "aarch64",
"os_release": "5.10.124-linuxkit",
"os_version": "#1 SMP PREEMPT Thu Jun 30 08:18:26 UTC 2022"
}

Getting statistics on message delivery

To get stats on all updates sent in your environments, issue a get request to this api: https://pdp-statistics.api.permit.io/v2/stats/{project}/{environment}/messages

Your request should look something like this:

curl --location \
--request GET 'https://pdp-statistics.api.permit.io/v2/stats/{project}/{environment}/messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR API KEY>'

As with other APIs, the project and environment can be either IDs or keys.

The returned results will look like this:

{
"data": [
{
"id": "ac52ec15-de8b-4b49-bc20-eebbdc8a79ae",
"topic": "573958d6569b4975b6dccb7c814ed585:data:policy_data/573958d6569b4975b6dccb7c814ed585",
"urls": [],
"sent_count": 2,
"retry_count": 1,
"created_at": "2024-03-25T00:11:16.027910",
"last_sent_at": "2024-03-25T00:11:16.054386",
"next_retry_at": "2024-03-25T00:11:25.984686",
"state": "assumed_ack",
"pdps": {
"acknowledged_by": [
{
"pdp_instance_id": "3b66379e-0ff0-42c3-b60c-60e5af45025b",
"ack_time": "2024-03-25T00:11:17.098168"
}
],
"pending": [
{
"pdp_instance_id": "17b00f8b-9871-43e6-a99a-5285a91548cc",
"last_seen_at": "2024-03-24T20:09:05.856538",
"considered": "dead"
}
]
}
},
...
]
}

Notes:

  • This api supports pagination, see the full api docs for reference.
  • The most recent updates will show first.

Looking only at lost messages (sync issues)

You can filter using the state query param:

curl --location \
--request GET 'https://pdp-statistics.api.permit.io/v2/stats/{project}/{environment}/messages?state=assumed_lost' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR API KEY>'

OpenAPI spec

The OpenAPI configuration spec is available at https://pdp-statistics.api.permit.io/v2/openapi.json