pip_services3_rpc.services.StatusRestService module

pip_services3_rpc.services.StatusRestService

Status rest service implementation

copyright

Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.

license

MIT, see LICENSE for more details.

class pip_services3_rpc.services.StatusRestService.StatusRestService

Bases: pip_services3_rpc.services.RestService.RestService

Service that returns microservice status information via HTTP/REST protocol. The service responds on /status route (can be changed) with a JSON object:

{
    - "id":            unique container id (usually hostname)
    - "name":          container name (from ContextInfo)
    - "description":   container description (from ContextInfo)
    - "start_time":    time when container was started
    - "current_time":  current time in UTC
    - "uptime":        duration since container start time in milliseconds
    - "properties":    additional container properties (from ContextInfo)
    - "components":    descriptors of components registered in the container
}
### Configuration parameters ###
  • base_route: base route for remote URI

  • dependencies:
    • endpoint: override for HTTP Endpoint dependency

    • controller: override for Controller dependency

  • connection(s):
    • discovery_key: (optional) a key to retrieve the connection from IDiscovery

    • protocol: connection protocol: http or https

    • host: host name or IP address

    • port: port number

    • uri: resource URI or connection string with all parameters in it

### References ###
  • *:logger:*:*:1.0 (optional) ILogger components to pass log messages

  • *:counters:*:*:1.0 (optional) ICounters components to pass collected measurements

  • *:discovery:*:*:1.0 (optional) IDiscovery services to resolve connection

  • *:endpoint:http:*:1.0 (optional) HttpEndpoint reference

Example:

service = StatusService()
service.configure(ConfigParams.from_tuples("connection.protocol", "http",
                                           "connection.host", "localhost",
                                           "connection.port", 8080))
service.open("123")
# ...
configure(config: pip_services3_commons.config.ConfigParams.ConfigParams)

Configures component by passing configuration parameters.

Parameters

config – configuration parameters to be set.

register()

Registers all service routes in HTTP endpoint.

set_references(references: pip_services3_commons.refer.IReferences.IReferences)

Sets references to dependent components.

Parameters

references – references to locate the component dependencies.

status() str