
Metaplane
CertifiedRun and read data-observability monitors from Metaplane.
Metaplane
Run and read data-observability monitors from Metaplane.
tasks
How to use the Metaplane plugin
Metaplane is a data-observability tool that runs SQL-based anomaly-detection monitors against your warehouse tables. This plugin lets a Kestra flow trigger a monitor run, read its latest result, list the monitors in a workspace, and react when a monitor's status changes — see the Metaplane API reference for the underlying HTTP API.
Authentication
Every task and the trigger require an apiToken: an API token generated at
app.metaplane.dev/account/manage-tokens. Store it
as a Kestra secret and reference it with
{{ secret('METAPLANE_API_TOKEN') }}, or set it once via
plugin defaults so it doesn't need to be
repeated on every task.
baseUrl is optional and defaults to https://dev.api.metaplane.dev, the API host documented at
docs.metaplane.dev/reference (not app.metaplane.dev, which is
the web app). Override it if Metaplane changes or adds hosts for your account.
Tasks
Run— enqueues one or more monitors (monitorIds) to run immediately viaPOST /v1/monitors/run. The API only confirms the run was enqueued; it does not return a run ID or wait for completion.monitorIdsmust contain at least one ID or the task fails fast before calling the API.Get— reads the latest status of a single monitor (monitorId) viaGET /v2/monitors/status/{monitorId}. This is a pure read: it never fails or halts the flow because of an anomaly, it only reportsstatus, the worst status across all of the monitor's group-by series (PASS,IN_TRAINING,NOT_ENOUGH_DATA,FAILED_TO_PREDICT,INVALID_INPUT,ERROR,FAIL, orUNKNOWNfor any value not recognized yet), orERRORif the underlying query itself failed, plus the per-series breakdown (series). Gate a pipeline on the result with a downstreamio.kestra.plugin.core.execution.Failtask conditioned onoutputs.<taskId>.status, or use theGatetask below to fail the flow directly. Fails with a clear error if the monitor has never been run (the API returns HTTP 404 in that case). SinceRunonly enqueues a monitor and does not wait for completion, insert a wait (e.g.io.kestra.plugin.core.flow.Pause) betweenRunandGetin the same flow, or read the status once you know a run has finished elsewhere (e.g. it runs on its own schedule) — see theMonitorResultTriggersection below to react to a run as soon as it completes instead, orGateto poll for it synchronously in the same task.List— lists the monitors defined for a given Metaplane connection (connectionId) viaGET /v1/monitors/connection/{connectionId}, optionally filtered withincludeDisabledandfetchGroups, with the standardfetchTypesemantics (FETCH,FETCH_ONE,STORE,NONE). The exact response shape isn't confirmed by Metaplane's official docs, so it accepts either a bare JSON array or an object wrapping the array under amonitorskey, and fails with a clear error on any other shape.Gate— synchronous quality gate for one or more monitors (monitorIds). WhenrunFirstis true, enqueues them (likeRun) and polls each one (pollInterval, defaultPT10S) until its status is fresh — its timestamp is at or after the momentGatestarted — ortimeout(defaultPT10M) elapses, in which case it fails naming the still-pending monitor(s). WhenrunFirstis false, each monitor's current status is read once; settingmaxAgethen flags a result older than that age as stale and escalates its effective status toFAILfor the gate, even though the reportedstatusin the output stays truthful.failStrategydecides how several monitors combine into a single pass/fail decision:FAIL_FAST(stop polling as soon as one monitor's effective status is infailOn, leaving monitors never reached with only theirmonitorIdpopulated in the output),FAIL_IF_ANY(default),FAIL_IF_ALL, orNONE(never fails, still reports).failOn(defaultFAIL,ERROR) lists which statuses count as failing. SetperGroupto evaluate grouped monitors group by group: each group's latest evaluation timestamp is read fromPOST /v1/monitors/evaluation-history/{id}(one call per group), stale "ghost" groups (older thanmaxAge, or predating the task start whenrunFirst) are dropped so a dead group cannot fail the gate on its own, a failing group-by query isERROR, and an all-ghost monitor is treated as failing.maxAgeis required whenperGroupis true andrunFirstis false. Outputspassed,failedMonitorIds, and a per-monitormonitorslist with each monitor'sstatus,checkedAt,staleflag,seriesbreakdown, and (inperGroupmode) a per-groupgroupsbreakdown with each group'sstatus,evaluatedAt, andghostflag.
Triggers
MonitorResultTrigger— polls a single monitor's status atinterval(defaultPT5M) and fires an execution only when the status changes from the last-seen value, so an unchanged status never re-fires the trigger every interval. The first evaluation only establishes the baseline status and does not fire. OutputsmonitorId,status, andcheckedAt. LikeGet, it fails with a clear error if the monitor has never been run.