Merge pull request #20 from waku-org/feat-admin-api-extension

feat: Added recent extensions to REST API: /admin/v1 ... /stats and .../log-level endpoints.
This commit is contained in:
NagyZoltanPeter 2025-06-16 12:50:41 +02:00 committed by GitHub
commit 56202ba882
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,34 @@
post:
summary: Dynamic set log level on the node
description: Change the log level of a Waku v2 node.
operationId: setLogLevel
tags:
- admin
parameters:
- in: path
name: logLevel
required: true
schema:
type: string
enum:
- "TRACE"
- "DEBUG"
- "INFO"
- "NOTICE"
- "WARN"
- "ERROR"
- "FATAL"
description: New log level to set for the node.
responses:
'200':
description: New log level Successfully applied.
'400':
description: Invalid argument.
content:
text/plain:
type: string
'503':
description: Service unavailable - binary is not compiled with proper flag that enables this feature.
content:
text/plain:
type: string

View File

@ -0,0 +1,14 @@
get:
summary: Get statistics of available peers
description: Retrieve statistics of node's peer database in various grouping.
operationId: getPeerStats
tags:
- admin
responses:
'200':
description: Information about a Waku v2 node.
content:
application/json:
schema:
$ref: "./schemas/apitypes.yaml#/WakuPeerStats"

View File

@ -0,0 +1,44 @@
{
"Sum": {
"Total peers": 12
},
"By Connectedness": {
"Connected": 10,
"NotConnected": 0,
"CannotConnect": 2,
"CanConnect": 0
},
"Relay peers": {
"0": 10,
"1": 10,
"5": 10,
"4": 10,
"6": 10,
"3": 10,
"7": 10,
"2": 10,
"Total relay peers": 8
},
"Mesh peers": {
"0": 4,
"1": 4,
"5": 4,
"4": 4,
"6": 4,
"3": 4,
"7": 4,
"2": 4,
"Total mesh peers": 8
},
"By Protocols": {
"/vac/waku/relay/2.0.0": 12,
"/vac/waku/filter-subscribe/2.0.0-beta1": 12,
"/vac/waku/filter-push/2.0.0-beta1": 6,
"/vac/waku/store-query/3.0.0": 12,
"/vac/waku/store/2.0.0-beta4": 10,
"/vac/waku/lightpush/3.0.0": 12,
"/vac/waku/lightpush/2.0.0-beta1": 10,
"/vac/waku/peer-exchange/2.0.0-alpha1": 0,
"/vac/waku/reconciliation/1.0.0": 0
}
}

View File

@ -35,6 +35,8 @@ paths:
$ref: "./debugapi_info.yaml"
/version:
$ref: "./debugapi_version.yaml"
/admin/v1/log-level/{logLevel}:
$ref: "./adminapi_log_level.yaml"
/admin/v1/peers:
$ref: "./adminapi_peers.yaml"
/admin/v1/peer/{peerId}:
@ -53,6 +55,8 @@ paths:
$ref: "./adminapi_peers_mesh.yaml"
/admin/v1/peers/mesh/on/{shardId}:
$ref: "./adminapi_peers_mesh_on_shard.yaml"
/admin/v1/peers/stats:
$ref: "./adminapi_peers_stats.yaml"
/admin/v1/filter/subscriptions:
$ref: "./adminapi_filter.yaml"
/debug/v1/info:

View File

@ -1,3 +1,25 @@
WakuPeerStats:
type: object
properties:
grouping:
type: object
properties:
name:
title: string
value:
type: array
items:
type: object
properties:
title:
type: string
value:
type: integer
format: int32
examples:
peer_statistics:
$ref: "./adminapi_peers_stats_example.json"
WakuPeer:
type: object
required: