fettle v1.0.0 Fettle.Config View Source
Processes configuration for healthchecks into internal structures.
Configuration can be specified either by application configuration under the
:fettle key, or by supplying via a module, function or inline argument
to Fettle.Supervisor.start_link/1.
config :fettle,
system_code: :my_app, # NB mandatory
name: "My Application",
description: "My Application provides...",
panic_guide_url: "https://stackoverflow.com",
initial_delay_ms: 1_000,
period_ms: 30_000,
timeout_ms: 2_000,
checks: [ ... ]
The minimum configuration requires the system_code key:
| Key | Description | Required or Defaults |
|---|---|---|
system_code | System code for report | Required |
schema | Module for report generation | Fettle.Schema.FTHealthCheckV1 |
name | Human-readable name of system | defaults to system_code |
description | Human-readable description of system | defaults to system_code |
initial_delay_ms | Number of milliseconds to wait before running first check | 0 |
period_ms | Number of milliseconds to wait between runs of the same check | 30_000 |
timeout_ms | Number of milliseconds to wait before timing-out a running check | 5000 |
panic_guide_url | URL of documentation for check | 1 2 |
business_impact | Which business function is affected? | 1 |
technical_summary | Technical description for Ops | 1 |
checks | An array of pre-configured health-check config | Optional, see Fettle.add/3 3 |
- Specifies default value for checks. Required only if not specified for every check.
panic_guide_urlcan form the base-url for checks which specify a relativepanic_guide_url.checksis an array, but each element can be specified as either a map, or aKeywordlist (or any otherEnumerablethat yields key-value pairs).
Link to this section Summary
Types
Tuple which specifies a check (derived from app config)
Top-level configuration for global settings and check defaults (derived from app config)
Functions
Convert a single health check specification from config into a Fettle.Spec spec, with module and args
default missing, nil or empty keys to matching values in keyword list
ensure required keys are not missing, null, or empty strings
append path parts to top-level config panic_guide_url if relative path is given in checker
Parses configuration into %Fettle.Config{}
Link to this section Types
spec_and_mod() :: {Fettle.Spec.t(), module(), init_args :: any()}
Tuple which specifies a check (derived from app config)
Top-level configuration for global settings and check defaults (derived from app config)
Link to this section Functions
check_from_config(check :: map() | list(), config :: Fettle.Config.t()) :: spec_and_mod()
Convert a single health check specification from config into a Fettle.Spec spec, with module and args.
Each check is specified as a collection of key-value pairs:
| Key | Type | Description | Default/Required |
|---|---|---|---|
name | String | Name of check | required |
id | String | Short id of check | Defaults to name |
description | String | Longer description of check | Defaults to name |
panic_guide_url | String | URL of documentation for check | Defaults to config |
business_impact | String | Which business function is affected? | Defaults to config |
technical_summary | String | Technical description for Ops | Defaults to config |
severity | 1-3 | Severity level: 1 high, 3 low | Defaults to 1 |
initial_delay_ms | integer | Number of milliseconds to wait before running first check | Defaults to config |
period_ms | integer | Number of milliseconds to wait between runs of the check | Defaults to config |
timeout_ms | integer | Number of milliseconds to wait before timing-out check | Defaults to config |
checker | atom | Fettle.Checker module | Required |
args | any | passed as argument for Fettle.Checker module | defaults to [] |
Some fields of the check can be omitted, and the default value from the top-level config will be used
instead; this applies to all fields except name, full_name, id and severity; if id is omitted, name
will be used, if full_name is omitted, name will be used; severity defaults to 1.
panic_guide_url has special behavior, in that if a path starting with # or / is given, then
this is appended to the panic_guide_url in the top-level configuration properties.
config :health,
system_code: "service-a",
schema: Fettle.Schema.FTHealthCheckV1,
panic_guide_url: "http://co.com/docs/service/healthchecks",
technical_summary: "We'll spend all week repairing the damage.",
checks: [
%{
name: "service-b", # also provides id and full_name if those undefined
panic_guide_url: "#service-b", # appended to top-level url
# technical_summary will come from top-level
business_impact: "No sales",
period_ms: 10_000, # override default for this check only
checker: MyHealth.Spec, # implementation module name
args: [url: "https://service-b.co.com/__gtg"] # for `Fettle.Checker.check/1`
},
%{
...
}
]
default missing, nil or empty keys to matching values in keyword list
ensure required keys are not missing, null, or empty strings
append path parts to top-level config panic_guide_url if relative path is given in checker.
to_app_config(map() | list()) :: Fettle.Config.t()
Parses configuration into %Fettle.Config{}