Session state
pmesh API exposes a set of endpoints that allow you to interact with the current session of the server. Session information includes the current git repository of the server, state of the HTTP server, and the current services.
Project Revision | /repo
Returns information about the current git repository of the server.
The result is an object with the following structure:
Result | Type | Description |
---|---|---|
sys | string | The version control system. |
ref.branch | string | The current branch. |
ref.hash | string | The current commit hash. |
ref.author | string | The author of the current commit. |
ref.message | string | The message of the current commit. |
remote.branch | string | The current branch of the remote. |
remote.hash | string | The current commit hash of the remote. |
remote.author | string | The author of the current commit of the remote. |
remote.message | string | The message of the current commit of the remote. |
url | string | The URL of the repository. |
Revision update | /repo/update
Parameter | Type | Description |
---|---|---|
invalidate | boolean | If true , forces a rebuild of all services. |
Updates the current revision of the server to the latest commit of the remote branch, and restarts all services accordingly.
The result is an object with the following structure:
Result | Type | Description |
---|---|---|
from.branch | string | The previous branch. |
from.hash | string | The previous commit hash. |
from.author | string | The author of the previous commit. |
from.message | string | The message of the previous commit. |
to.branch | string | The new branch. |
to.hash | string | The new commit hash. |
to.author | string | The author of the new commit. |
to.message | string | The message of the new commit. |
Reload | /reload
Parameter | Type | Description |
---|---|---|
invalidate | boolean | If true , forces a rebuild of all services. |
Reads the manifest from the file system and restarts all services accordingly.
Service list | /service
Returns a list of services that are currently running mapped to their unique session IDs.
Service restart | /service/restart/?:svc
Parameter | Type | Description |
---|---|---|
invalidate | boolean | If true , forces a rebuild of all services. |
If a service name is provided, restarts the service with the given name. If no service name is provided, restarts all services.
The result is an object with the following structure:
Result | Type | Description |
---|---|---|
count | number | The number of services restarted. |
Service stop | /service/stop/?:svc
If a service name is provided, stops the service with the given name. If no service name is provided, stops all services.
The result is an object with the following structure:
Result | Type | Description |
---|---|---|
count | number | The number of services stopped. |
Health | /service/health/?:svc
If a service name is provided, returns the health of the service with the given name. If no service name is provided, returns the health of all services as an object with the service names as keys.
The result is an object with the following structure:
Result | Type | Description |
---|---|---|
status | string | The status of the service. |
healthy | number | The number of healthy processes. |
total | number | The total number of processes. |
err | string? | The error message if the service is unhealthy. |
Metrics | /service/metrics/?:svc
If a service name is provided, returns metrics about the service with the given name. If no service name is provided, returns metrics about all services as an object with the service names as keys.
The result is an object with the following structure:
Result | Type | Description |
---|---|---|
id | string | The unique session ID of the service. |
type | string | The type of the service. |
server | object | The server information. |
processes | array | The process information. |
status | string | The status of the service. |
healthy | number | The number of healthy processes. |
total | number | The total number of processes. |
err | string? | The error message if the service is unhealthy. |
Client sessions | /session
Returns information about the current client sessions.
The result is an object with the following structure:
Result | Type | Description |
---|---|---|
num_clients | number | The number of clients. |
sessions[ip].avg_rps | number | The average requests per second. |
sessions[ip].num_reqs | number | The number of requests. |
sessions[ip].first_seen | string | The time the client was first seen. |
sessions[ip].blocked_until | string | The time the client is blocked until. |