UrlProbe

Probe a single URL and log the JSON results

Constructor

new UrlProbe(opts)

Build a UrlProbe

Parameters:
NameTypeDescription
optsUrlProbeOptions
Properties
NameTypeDescription
urlURL

REQUIRED: URL to probe

stateLogStateLog

REQUIRED: probe result log

jsonFilterobject

state normalization properties (undefined)

typeString

client type (heartbeat)

Classes

UrlProbe

Methods

(async) probe(date)

Probe the URL once and log the result for the given timestamp in the StateLog of the probe.

Parameters:
NameTypeDescription
dateDate

logging date (vs. result date)

(async, static) fetch(url, opts)

fetch with timeout

Parameters:
NameTypeDescription
urlURL

as for fetch()

optsfetchOptions

as for fetch()

Properties
NameTypeDescription
timeoutmilliseconds

required timeout (1000)

(static) normalizeState(state, properties) → {serializable}

Normalize given state for storage. Normalization can remove unwanted properties. Normalization can also trim property values.

Parameters:
NameTypeDescription
stateserializable

raw state to be normalized

propertiesStateLogProperties

normalization parameters.

Returns:

normalized object as defined by:

  • If properties.xyz is true, that property is included in normalized state.
  • If properties.xyz is a string, the string is converted to a regular expression and the state value of that property is stripped of anything that does not match that regular expression.
  • If properties.xyz is anything else, an Error is thrown.
  • If properties is null, the entire state is left as is.
Type: 
serializable