- Documentation
- Reference manual
- Packages
- SWI-Prolog HTTP support
- The HTTP server libraries
- Creating an HTTP reply
- library(http/http_dispatch): Dispatch requests in the HTTP server
- library(http/http_dirindex): HTTP directory listings
- library(http/http_files): Serve plain files from a hierarchy
- library(http/http_session): HTTP Session management
- library(http/http_cors): Enable CORS: Cross-Origin Resource Sharing
- library(http/http_authenticate): Authenticate HTTP connections using 401 headers
- library(http/http_digest): HTTP Digest authentication
- library(http/http_dyn_workers): Dynamically schedule HTTP workers.
- Custom Error Pages
- library(http/http_openid): OpenID consumer and server library
- Get parameters from HTML forms
- Request format
- Running the server
- The wrapper library
- library(http/http_host): Obtain public server location
- library(http/http_log): HTTP Logging module
- library(http/http_server_health): HTTP Server health statistics
- Debugging HTTP servers
- library(http/http_header): Handling HTTP headers
- The library(http/html_write) library
- library(http/js_write): Utilities for including JavaScript
- library(http/http_path): Abstract specification of HTTP server locations
- library(http/html_head): Automatic inclusion of CSS and scripts links
- library(http/http_pwp): Serve PWP pages through the HTTP server
- The HTTP server libraries
- SWI-Prolog HTTP support
3.18 library(http/http_server_health): HTTP Server health statistics
This module defines an HTTP handler for /health
. The
handler returns a JSON document with elementary health statistics on the
running instance. The location can be changed using http_handler/3.
Keys may be added using additional clauses for health/2
or hidden using hide/1.
This library defines an HTTP handler and defines two multifile predicates (health/2 and hide/1) to control the information presented.
- server_health(+Request)
- HTTP handler that replies with the overall health of the server. Returns
a JSON object from all solutions of health/2.
Processes an optional parameter
fields
to specify the fields that should be returned. The fields content is "," or white space delimited. - [nondet,multifile]health(-Key, -Value)
- Multifile extensible. True when Key/Value can be
reported as a health statistics. Keys may be added by adding clauses to
this multifile predicate. Keys may be filtered using hide/1.
Predefined
Key values are:
- up
- Defined to be
true
. - epoch
- Starting time of the server in seconds after Jan 1, 1970 UTC.
- cpu_time
- Total process CPU usage in seconds.
- threads
- Number of active threads
- workers
- Number of HTTP worker threads.
- requests
- Number of HTTP requests processed.
- bytes_sent
- Number of bytes send in reply to HTTP requests.
- open_files
- Number of open file streams. This includes physical files as well as
sockets (except for Windows). On Linux we count the file handles in
/proc/self/fd
. Otherwise we use stream_property/2 with thefile_no(Fd)
property. - loadavg
- An array holding the load average over the last [1,5,15] minutes. This
key is only supported on Linux machines. It is based on
/proc/loadavg
- heap
- When compiled with TCMalloc, this provides two properties:
inuse
:
Bytes- Total amount of in-use memory in bytes
size
:
Bytes- Same as
inuse
, but including the TCMalloc overhead and (thus) memory that has been freed and is not (yet) reused.
Key is the name of the JSON key. Must be an atom Value is the Prolog representation for a JSON (dict) value. - [nondet,multifile]hide(?Key)
- Multifile hook. If true for a specific Key, hide this statistics from the output. This may be used to hide keys that are considered a security risk.