Liking cljdoc? Tell your friends :D

puppetlabs.trapperkeeper.services.status.status-core


Alertclj

source

all-nominal?clj

(all-nominal? statuses)

Inputs: [statuses :- ServicesStatus] Returns: schema/Bool

Inputs: [statuses :- ServicesStatus]
Returns: schema/Bool
sourceraw docstring

build-handlerclj

(build-handler path status-fns)
source

build-json-routesclj

(build-json-routes path status-fns)
source

build-plaintext-routesclj

(build-plaintext-routes path status-fns)
source

call-status-fn-for-serviceclj

(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.
sourceraw docstring

call-status-fnsclj

(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.
sourceraw docstring

check-timeoutclj

(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.
sourceraw docstring

compare-levelsclj

(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.
sourceraw docstring

DebugLoggingConfigclj

source

errors-by-type-middlewareclj

(errors-by-type-middleware t)

Inputs: [t :- ringutils/ResponseType]

Inputs: [t :- ringutils/ResponseType]
sourceraw docstring

FileDescriptorUsageV1clj

source

GcStatsV1clj

source

get-artifact-versionclj

(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.
sourceraw docstring

get-jvm-metricsclj

(get-jvm-metrics cpu-snapshot)

Inputs: [cpu-snapshot :- cpu/CpuUsageSnapshot] Returns: JvmMetricsV1

Inputs: [cpu-snapshot :- cpu/CpuUsageSnapshot]
Returns: JvmMetricsV1
sourceraw docstring

get-proxy-route-infoclj

(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
sourceraw docstring

get-service-status-versionclj

(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.
sourceraw docstring

get-status-detail-levelclj

(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'.
sourceraw docstring

get-status-fnclj

(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.
sourceraw docstring

get-timeoutclj

(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.
sourceraw docstring

guarded-status-fn-callclj

(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:

  • 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.

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.
sourceraw docstring

JvmMetricsV1clj

source

level->intclj

(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.
sourceraw docstring

matching-service-infoclj

(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.
sourceraw docstring

MemoryUsageV1clj

source

nominal?clj

(nominal? status)

Inputs: [status :- ServiceStatus] Returns: schema/Bool

Inputs: [status :- ServiceStatus]
Returns: schema/Bool
sourceraw docstring

reset-status-context!clj

(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
sourceraw docstring

schedule-bg-tasksclj

(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)]
sourceraw docstring

service-status-mapclj

(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
sourceraw docstring

ServiceInfoclj

source

ServicesInfoclj

source

ServicesStatusclj

source

ServiceStatusclj

source

ServiceStatusDetailLevelclj

source

Stateclj

source

status->codeclj

(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
sourceraw docstring

status-latest-versionclj

(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
sourceraw docstring

status-service-nameclj

source

status-service-versionclj

source

StatusCallbackResponseclj

source

statuses->codeclj

(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.
sourceraw docstring

StatusFnclj

source

StatusProxyConfigclj

source

StatusServiceConfigclj

source

summarize-statesclj

(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
sourceraw docstring

ThreadingV1clj

source

update-cpu-usage-metricsclj

(update-cpu-usage-metrics last-cpu-snapshot)

Inputs: [last-cpu-snapshot :- (schema/atom cpu/CpuUsageSnapshot)]

Inputs: [last-cpu-snapshot :- (schema/atom cpu/CpuUsageSnapshot)]
sourceraw docstring

update-status-contextclj

(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.
sourceraw docstring

v1-statusclj

(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
sourceraw docstring

validate-callback-registrationclj

(validate-callback-registration status-fns svc-name svc-version status-version)
source

validate-configclj

(validate-config config)

Inputs: [config] Returns: StatusServiceConfig

Inputs: [config]
Returns: StatusServiceConfig
sourceraw docstring

validate-protocol!clj

(validate-protocol! url)

Throws if the protocol is not http or https

Throws if the protocol is not http or https
sourceraw docstring

Versionclj

source

WholeMillisecondsclj

source

WholeSecondsclj

source

with-timeoutcljmacro

(with-timeout description timeout-s default & body)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close