
Fastly StatsTrigger
CertifiedTrigger when a Fastly field metric crosses a threshold
Fastly StatsTrigger
Trigger when a Fastly field metric crosses a threshold
Polls /stats/service/{serviceId}/field/{field} on the configured interval, sums all
numeric values of the chosen field across data points in the window, and fires an
execution when the observed value matches the threshold according to the comparator.
Useful for alerting on error spikes (e.g. status_5xx > 100), hit-ratio drops
(e.g. hit_ratio < 0.8), or bandwidth surges.
type: io.kestra.plugin.fastly.stats.StatsTriggerExamples
Alert when 5xx errors exceed 50 in the past hour
id: fastly_error_alert
namespace: company.ops
triggers:
- id: high_error_rate
type: io.kestra.plugin.fastly.stats.StatsTrigger
apiToken: "{{ secret('FASTLY_API_TOKEN') }}"
serviceId: "{{ secret('FASTLY_SERVICE_ID') }}"
field: "status_5xx"
threshold: 50
comparator: GREATER_THAN
window: "PT1H"
interval: PT5M
tasks:
- id: alert
type: io.kestra.plugin.core.log.Log
message: "5xx spike detected: {{ trigger.value }} errors (threshold: {{ trigger.threshold }})"
Properties
apiToken *Requiredstring
Fastly API token
Your Fastly API token. The token must have global: read scope to access stats endpoints.
field *Requiredstring
Field name
Fastly stats field to aggregate and compare, e.g. status_5xx, errors, hit_ratio, bandwidth.
serviceId *Requiredstring
Service ID
The Fastly service to monitor.
threshold *Requirednumberstring
Threshold value
The numeric value to compare the observed field sum against.
allowConcurrent Non-dynamicboolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
baseUrl string
https://api.fastly.comFastly API base URL
Base URL for the Fastly API. Override this only for testing.
by string
minuteAggregation granularity
Time bucket size for the data points fetched from Fastly. One of minute, hour, or day.
Defaults to minute. Note that the Fastly API returns at most 200 data points per request;
a large window combined with fine granularity (e.g. a 4-hour window with minute buckets)
will exceed this cap and truncate the observed window. Choose by to stay within 200 points.
comparator string
GREATER_THANGREATER_THANGREATER_THAN_OR_EQUALLESS_THANLESS_THAN_OR_EQUALEQUALComparator
Comparison operator applied between the observed value and threshold.
Available values: GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL, EQUAL.
Defaults to GREATER_THAN.
interval Non-dynamicstring
PT1MdurationInterval between polling.
The interval between 2 different polls of schedule, this can avoid to overload the remote system with too many calls. For most of the triggers that depend on external systems, a minimal interval must be at least PT30S. See ISO_8601 Durations for more information of available interval values.
options Non-dynamic
HTTP client options
Optional advanced HTTP settings such as timeouts or proxy configuration.
io.kestra.core.http.client.configurations.HttpConfiguration
falseIf true, allow a failed response code (response code >= 400)
List of response code allowed for this request
The authentication to use.
io.kestra.core.http.client.configurations.BasicAuthConfiguration
The password for HTTP basic authentication.
The username for HTTP basic authentication.
io.kestra.core.http.client.configurations.BearerAuthConfiguration
The token for bearer token authentication.
io.kestra.core.http.client.configurations.DigestAuthConfiguration
The password for HTTP Digest authentication.
The username for HTTP Digest authentication.
UTF-8The default charset for the request.
java.nio.charset.Charset
trueWhether to enable TCP Keep-Alive extended socket options (TCP_KEEPIDLE, TCP_KEEPINTERVAL, TCP_KEEPCOUNT).
Set to false when running on Windows workers, as these extended socket options are not supported by the Windows JDK and will cause connection failures.
trueWhether redirects should be followed automatically.
REQUEST_HEADERSREQUEST_BODYRESPONSE_HEADERSRESPONSE_BODYThe enabled log.
The proxy configuration.
io.kestra.core.http.client.configurations.ProxyConfiguration
The address of the proxy server.
The password for proxy authentication.
The port of the proxy server.
DIRECTDIRECTHTTPSOCKSThe type of proxy to use.
The username for proxy authentication.
The SSL request options
io.kestra.core.http.client.configurations.SslOptions
Whether to disable checking of the remote SSL certificate.
Only applies if no trust store is configured. Note: This makes the SSL connection insecure and should only be used for testing. If you are using a self-signed certificate, set up a trust store instead.
The timeout configuration.
io.kestra.core.http.client.configurations.TimeoutConfiguration
The time allowed to establish a connection to the server before failing.
PT5MThe time allowed for a read connection to remain idle before closing it.
stopAfter Non-dynamicarray
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
when string
trueA condition that determines whether the trigger should run.
A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.
window string
PT1HObservation window
How far back to look for data points. Data points within [now - window, now] are summed.
Outputs
field string
Field name
The Fastly stats field that was monitored.
threshold number
Threshold value
The threshold that was configured and matched.
value number
Observed value
The sum of the monitored field across all data points in the observation window.