PDN APIs
PDN Node APIs
Generic Download
Description: Downloads a file by the specified path from PDN.
Since: 1.0.1
Security: Artifactory credentials, with read permissions on the path
Usage: GET /artifactory/example-repo-local/example-directory/example-file.zip
curl -u admin:password -X GET http://{pdn-node-host}:8089/artifactory/example-repo-local/example-directory/example-file.zip -o ./example-file.zip
Response status codes:
200 - Successful download of the file
404 - The file does not exist on the Artifactory connected to the PDN
Ping
Description: Tests the connection with the PDN Node.
Since: 1.0.1
Security: No authentication is required
Usage: GET /api/v1/ping
curl -X GET http://{pdn-node-host}:8089/api/v1/ping
Response status codes:
200 - The node is available
5xx - The node is unavailable
PDN Server APIs
The following REST APIs are used for the PDN Server.
Ping
Description: Tests the connection with the PDN Server.
Since: 1.0.1
Security: No authentication is required
Usage: GET /api/v1/system/ping
$ curl -X GET "http://{pdn-server-host}:8082/pdnserver/api/v1/system/ping"
Response status codes:
200 - The server is available
404, 5xx - The server is unavailable
Liveness
Description: Tests the PDN Server's liveness.
Since: 1.0.1
Security: No authentication is required
Usage: GET /api/v1/system/liveness
curl -X GET "http://{pdn-server-host}:8082/pdnserver/api/v1/system/liveness"
Response status codes:
200 - The server is alive
404, 5xx - The server is not alive
Readiness
Description: Tests the PDN Server's readiness.
Since: 1.0.1
Security: No authentication is required
Usage: GET /api/v1/system/readiness
curl -X GET "http://{pdn-server-host}:8082/pdnserver/api/v1/system/readiness"
Response status codes:
200 - The server is ready to accept traffic
404, 5xx - The server is not ready to accept traffic
Clear Cache
Description: Cleans files from all the PDN Servers and PDN Nodes cache by NodeID, GroupId - without a status.
Since: 1.1.3
Security: No authentication is required
Usage: GET /api/v1/file/cache/:filepath with 2 query params group and node
PDN Metrics
PDN supports Open Metrics, a Cloud Native Computing Foundation sandbox project.
Credentials for Accessing Open Metrics
An admin user can create a scoped access token using system:metrics:r
and use that token as the credentials for getting the service metrics. The admin can create a read-only access token to get metrics, which then enables anyone with the read-only token to read metrics. To learn more, see Access Token Structure.
Enabling PDN Open Metrics
To enable metrics for the PDN Server, make the following configuration changes to the PDN Server system.yaml
.
pdnserver: metrics: enabled: true interval: 5 exclude: - prefix_1 - prefix_2
Next, to enable metrics in the PDN Node, make the following configuration changes to the PDN Node system.yaml
.
pdnNode: metrics: enabled: true interval: 5 exclude: - prefix_1 - prefix_2 basicAuthUsername: <username> basicAuthPassword: <password>
PDN Server Metrics
Description: Gets the metrics for the PDN Server.
Since: 1.0.1
Security: Requires a valid Scoped Token, which contains the Scope “system:metrics:r
”.
Usage: GET /api/v1/metrics
Authorization: N/A
Content-Type: application/x-www-form-urlencoded
Example: Here is an example of the PDN Server metrics; a full list can be obtained by accessing the endpoint.
# NAME go_memstats_heap_alloc_bytes # TYPE Gauge # HELP Process go heap allocated bytes # # NAME app_get_block_duration_secs # TYPE Histogram # HELP Time to retrieve a cache-block from Artifactory, in seconds
PDN Node Metrics
Description: Gets the metrics for the PDN Node.
Since: 1.0.1
Security: Basic authorization (credentials are retrieved from the system.yaml
).
Usage: GET /api/v1/metrics
Authorization: N/A
Content-Type: application/x-www-form-urlencoded
Example: Here is an example of the PDN Node metrics; a full list can be obtained by accessing the endpoint.
# NAME app_files_served # TYPE Gauge # HELP Total number of files served by the download service # # NAME app_download_speed # TYPE Histogram # HELP Download speed of each file, in MB/s