(all-nominal? statuses)
Inputs: [statuses :- ServicesStatus] Returns: schema/Bool
Inputs: [statuses :- ServicesStatus] Returns: schema/Bool
(call-status-fn-for-service service-name service level timeout)
(call-status-fn-for-service service-name
service
level
timeout
service-status-version)
Inputs: ([service-name :- schema/Str service :- [ServiceInfo] level :- ServiceStatusDetailLevel timeout :- WholeSeconds] [service-name :- schema/Str service :- [ServiceInfo] level :- ServiceStatusDetailLevel timeout :- WholeSeconds service-status-version :- (schema/maybe schema/Int)]) Returns: ServiceStatus
Construct a map with the service's version, the version of the service's status, the detail level, and the results of calling the status function corresponding to the status version specified (or the most recent version if not). If the response from the callback function does not include an :state key, or returns a value other than true or false, return :unknown for :state.
Inputs: ([service-name :- schema/Str service :- [ServiceInfo] level :- ServiceStatusDetailLevel timeout :- WholeSeconds] [service-name :- schema/Str service :- [ServiceInfo] level :- ServiceStatusDetailLevel timeout :- WholeSeconds service-status-version :- (schema/maybe schema/Int)]) Returns: ServiceStatus Construct a map with the service's version, the version of the service's status, the detail level, and the results of calling the status function corresponding to the status version specified (or the most recent version if not). If the response from the callback function does not include an :state key, or returns a value other than true or false, return :unknown for :state.
(call-status-fns status-fns level timeout)
Inputs: [status-fns :- ServicesInfo level :- ServiceStatusDetailLevel timeout :- WholeSeconds] Returns: ServicesStatus
Call the latest status function for each service in the service context, and return a map of service to service status.
Inputs: [status-fns :- ServicesInfo level :- ServiceStatusDetailLevel timeout :- WholeSeconds] Returns: ServicesStatus Call the latest status function for each service in the service context, and return a map of service to service status.
(check-timeout level)
Inputs: [level :- ServiceStatusDetailLevel] Returns: WholeSeconds
Given a status level keyword, returns an integral number of seconds to use as a timeout when calling a status function.
Inputs: [level :- ServiceStatusDetailLevel] Returns: WholeSeconds Given a status level keyword, returns an integral number of seconds to use as a timeout when calling a status function.
(compare-levels f level1 level2)
Converts the two status levels to integers using level->int and then invokes f, passing the two integers as arguments. Especially useful for comparing two status levels.
Converts the two status levels to integers using level->int and then invokes f, passing the two integers as arguments. Especially useful for comparing two status levels.
(errors-by-type-middleware t)
Inputs: [t :- ringutils/ResponseType]
Inputs: [t :- ringutils/ResponseType]
(get-artifact-version group-id artifact-id)
Inputs: [group-id artifact-id] Returns: schema/Str
Utility function that services can use to get a value to pass in as their
service-version
when registering a status callback. group-id
and
artifact-id
should match the maven/leiningen identifiers for the project
that the service is defined in.
Inputs: [group-id artifact-id] Returns: schema/Str Utility function that services can use to get a value to pass in as their `service-version` when registering a status callback. `group-id` and `artifact-id` should match the maven/leiningen identifiers for the project that the service is defined in.
(get-jvm-metrics cpu-snapshot)
Inputs: [cpu-snapshot :- cpu/CpuUsageSnapshot] Returns: JvmMetricsV1
Inputs: [cpu-snapshot :- cpu/CpuUsageSnapshot] Returns: JvmMetricsV1
(get-proxy-route-info status-proxy-config)
Inputs: [status-proxy-config :- StatusProxyConfig]
Validates the status-proxy-config and returns a map with parameters to be used with add-proxy-route: proxy-target: target host, port, and path proxy-options: SSL options for the proxy target
Inputs: [status-proxy-config :- StatusProxyConfig] Validates the status-proxy-config and returns a map with parameters to be used with add-proxy-route: proxy-target: target host, port, and path proxy-options: SSL options for the proxy target
(get-service-status-version params)
Given a params map from a request, get out the service status version and check whether it is valid. If not, throw an error.
Given a params map from a request, get out the service status version and check whether it is valid. If not, throw an error.
(get-status-detail-level params)
Given a params map from a request, get out the status level and check whether it is valid. If not, throw an error. If no status level was in the params, then default to 'info'.
Given a params map from a request, get out the status level and check whether it is valid. If not, throw an error. If no status level was in the params, then default to 'info'.
(get-status-fn services-info-atom service-name service-status-version)
Inputs: [services-info-atom service-name :- schema/Str service-status-version :- (schema/maybe schema/Int)] Returns: StatusFn
Retrieve the status-fn for a service by name and optionally by service-status version. If service-status-version is nil the status fn for the most recent status version used.
Inputs: [services-info-atom service-name :- schema/Str service-status-version :- (schema/maybe schema/Int)] Returns: StatusFn Retrieve the status-fn for a service by name and optionally by service-status version. If service-status-version is nil the status fn for the most recent status version used.
(get-timeout params)
Given a params map from a request, attempt to find the timeout parameter and parse it as an integer, returning the numeric value. If no timeout parameter is found, return nil. If the parameter isn't parseable as an integer, throw an exception.
Given a params map from a request, attempt to find the timeout parameter and parse it as an integer, returning the numeric value. If no timeout parameter is found, return nil. If the parameter isn't parseable as an integer, throw an exception.
(guarded-status-fn-call service-name status-fn level timeout)
Inputs: [service-name :- schema/Str status-fn :- StatusFn level :- ServiceStatusDetailLevel timeout :- WholeSeconds] Returns: StatusCallbackResponse
Given a status check function, a status detail level, and a timeout in (integral) seconds, this function calls the status function and handles three types of errors:
In each error case, :state is set to :unknown and :status is set to a string describing the error.
Inputs: [service-name :- schema/Str status-fn :- StatusFn level :- ServiceStatusDetailLevel timeout :- WholeSeconds] Returns: StatusCallbackResponse Given a status check function, a status detail level, and a timeout in (integral) seconds, this function calls the status function and handles three types of errors: * Status check timed out * Status check threw an Exception * Status check returned a form that doesn't match the StatusCallbackResponse schema In each error case, :state is set to :unknown and :status is set to a string describing the error.
(level->int level)
Returns an integer which represents the given status level. The ordering of levels is :critical < :info < :debug.
Returns an integer which represents the given status level. The ordering of levels is :critical < :info < :debug.
(matching-service-info service-name service service-status-version)
Inputs: [service-name :- schema/Str service :- [ServiceInfo] service-status-version :- (schema/maybe schema/Int)] Returns: ServiceInfo
Find a service info entry matching the service-status-version. If service-status-version is nil the most recent service info is returned.
Inputs: [service-name :- schema/Str service :- [ServiceInfo] service-status-version :- (schema/maybe schema/Int)] Returns: ServiceInfo Find a service info entry matching the service-status-version. If service-status-version is nil the most recent service info is returned.
(nominal? status)
Inputs: [status :- ServiceStatus] Returns: schema/Bool
Inputs: [status :- ServiceStatus] Returns: schema/Bool
(reset-status-context! status-fns-atom)
Inputs: [status-fns-atom :- clojure.lang.Atom]
Remove a key from the :status-fns atom in the service context
Inputs: [status-fns-atom :- clojure.lang.Atom] Remove a key from the :status-fns atom in the service context
(schedule-bg-tasks interspaced log-status config last-cpu-snapshot)
Inputs: [interspaced :- IFn log-status :- IFn config :- StatusServiceConfig last-cpu-snapshot :- (schema/atom cpu/CpuUsageSnapshot)]
Inputs: [interspaced :- IFn log-status :- IFn config :- StatusServiceConfig last-cpu-snapshot :- (schema/atom cpu/CpuUsageSnapshot)]
(service-status-map svc-version status-version status-fn)
Inputs: [svc-version status-version status-fn] Returns: ServiceInfo
Inputs: [svc-version status-version status-fn] Returns: ServiceInfo
(status->code status)
Inputs: [status :- ServiceStatus] Returns: schema/Int
Given a service status, returns an appropriate HTTP status code
Inputs: [status :- ServiceStatus] Returns: schema/Int Given a service status, returns an appropriate HTTP status code
(status-latest-version last-cpu-snapshot level)
Inputs: [last-cpu-snapshot :- (schema/atom cpu/CpuUsageSnapshot) level :- ServiceStatusDetailLevel] Returns: StatusCallbackResponse
This function will return the status data from the latest version of the API
Inputs: [last-cpu-snapshot :- (schema/atom cpu/CpuUsageSnapshot) level :- ServiceStatusDetailLevel] Returns: StatusCallbackResponse This function will return the status data from the latest version of the API
(statuses->code statuses)
Inputs: [statuses :- ServicesStatus] Returns: schema/Int
Given a map of service statuses, returns an appropriate HTTP status code.
Inputs: [statuses :- ServicesStatus] Returns: schema/Int Given a map of service statuses, returns an appropriate HTTP status code.
(summarize-states statuses)
Inputs: [statuses :- ServicesStatus] Returns: State
Given a map of service statuses, return the 'most severe' state present as ranked by :error, :unknown, :stopping, :starting, :running
Inputs: [statuses :- ServicesStatus] Returns: State Given a map of service statuses, return the 'most severe' state present as ranked by :error, :unknown, :stopping, :starting, :running
(update-cpu-usage-metrics last-cpu-snapshot)
Inputs: [last-cpu-snapshot :- (schema/atom cpu/CpuUsageSnapshot)]
Inputs: [last-cpu-snapshot :- (schema/atom cpu/CpuUsageSnapshot)]
(update-status-context status-fns-atom
svc-name
svc-version
status-version
status-fn)
Update the :status-fns atom in the service context.
Update the :status-fns atom in the service context.
(v1-status last-cpu-snapshot level)
Inputs: [last-cpu-snapshot :- (schema/atom cpu/CpuUsageSnapshot) level :- ServiceStatusDetailLevel] Returns: StatusCallbackResponse
Inputs: [last-cpu-snapshot :- (schema/atom cpu/CpuUsageSnapshot) level :- ServiceStatusDetailLevel] Returns: StatusCallbackResponse
(validate-callback-registration status-fns svc-name svc-version status-version)
(validate-config config)
Inputs: [config] Returns: StatusServiceConfig
Inputs: [config] Returns: StatusServiceConfig
(validate-protocol! url)
Throws if the protocol is not http or https
Throws if the protocol is not http or https
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close