Skip to content

[Synthetics] Add API Journey monitor type - #270874

Merged
shahzad31 merged 18 commits into
elastic:mainfrom
shahzad31:multi-step-mode
Sep 14, 2026
Merged

shahzad31 merged 18 commits into
elastic:mainfrom
shahzad31:multi-step-mode

Conversation

@shahzad31

@shahzad31 shahzad31 commented May 23, 2026 •

Copy link
Copy Markdown
Contributor

✨ Summary

Adds API Journey monitors to Synthetics: Playwright APIRequestContext journeys (apiJourney(...)) that run multi-step HTTP checks without launching a browser.

🚀 Rollout

  • Private locations: supported by default.

  • Elastic-managed locations: disabled by default. Enable them explicitly in kibana.yml:

    xpack.uptime.enableApiJourneyPublicLocations: true

The setting is enforced consistently for the create/edit form, bulk location changes, direct monitor APIs, Test now, monitor inspection, and project-monitor pushes. The browser UI receives the setting so public locations are selectable only when it is enabled.

📦 What’s included

  • API monitor types, defaults, validation, and the Create/Edit API Journey form.
  • Fleet support for the synthetics/api input and api.network stream.
  • Management, overview, details, error, test-run, filtering, and badge support for step-based API journeys.
  • Private-location policy formatting, API script encoding, project monitor normalization, and global parameter interpolation.
Related
DSL elastic/synthetics#997
Heartbeat input elastic/beats#50802

🖼️ Screenshot

Create monitor type picker

🧪 Test plan

@github-actions github-actions Bot added the author:actionable-obs PRs authored by the actionable obs team label May 23, 2026
@shahzad31 shahzad31 added backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:actionable-obs - DEPRECATED DEPRECATED labels May 23, 2026
shahzad31 added a commit to elastic/integrations that referenced this pull request Aug 20, 2026
…streams (#19178)

* [Synthetics] Add `synthetics/api` input + `api` / `api.network` data streams

Adds the Fleet integration package side of API Journey monitors so private
locations can deliver `monitor.type: api` policies to Heartbeat. Companion
to elastic/synthetics#997 (agent), elastic/beats#50802 (Heartbeat input),
and elastic/kibana#270874 (UI / SO / project monitor).

WHY: elastic/kibana#270874 has a TODO in `format_synthetics_policy.ts`
explicitly waiting on this package — `inputs.find(input.type ===
'synthetics/api')` resolves to undefined until a `synthetics >= 1.7.0`
package is installed, so private-location API monitors return
`hasInput: false` and surface a "package needs upgrade" warning.
That PR also explicitly says the new input must be designed fresh, NOT
forked from `synthetics/browser`, because the var schema differs.

WHAT:

* manifest.yml: bump 1.6.1 -> 1.7.0 and add `synthetics/api` input.

* New data stream `api` (dataset `api`) — journey/step events for API
  monitors. ILM 30d hot / 365d delete (matches browser). Vars are the
  API-correct subset of browser:
    - drops `screenshots`, `throttling.config`, `synthetics_args` because
      `(*SourceJob).extraArgs` in elastic/beats#50802 strips
      `--sandbox`, `--screenshots`, `--throttling`/`--no-throttling` for
      `monitor.type: api`.
    - keeps `playwright_options` and `ignore_https_errors` (both supported
      by Playwright's APIRequestContext).
    - default `type: api`.
  Fields mirror browser, with `monitor.type: api`, a new
  `synthetics.journey.type` keyword (emitted by `synthexec/synthtypes.go`
  in elastic/beats#50802 and `JSONReporter` in elastic/synthetics#997),
  and the Chromium-only `browser.experience` / `browser.relative_trace`
  groups removed.

* New data stream `api_network` (dataset `api.network`) — the dataset
  `synthexec/enrich.go` in elastic/beats#50802 routes API-journey
  `journey/network_info` events to. ILM 1d hot / 14d delete (matches
  browser_network). Fields mirror browser_network (TLS / server / resolve
  groups already covered by ECS) with the same `journey.type` addition.
  No stream-level vars — inherits from the parent `synthetics/api` input,
  same model as `browser_network`.

Validated locally with `elastic-package format` and
`elastic-package check` (lint + build green).

Co-authored-by: Cursor <cursoragent@cursor.com>

* [Synthetics] Align api/api.network mappings with existing streams

Add kibanaUrl, map observer.geo.name as keyword, drop leftover docker TODOs, and point the 1.9.0 changelog at this PR.

* [Synthetics] Map API network server.* and http.response.status

Index server.ip/port and the agent-emitted status code on api.network so Discover/KQL work under dynamic: false.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
@shahzad31 shahzad31 changed the title [Synthetics] Add API Journey monitor type !! [Synthetics] Add API Journey monitor type Aug 20, 2026
@shahzad31
shahzad31 marked this pull request as ready for review September 8, 2026 07:08
@shahzad31
shahzad31 requested review from a team as code owners September 8, 2026 07:08
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown
Contributor

Pinging @elastic/actionable-obs-team (Team:actionable-obs)

@kibanamachine kibanamachine added the reviewer:scout Agentic PR Scout test review label Sep 8, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid, well-tested addition of the API Journey monitor type. The private-location enforcement (feature-flagged) is applied consistently across the create/edit, bulk-location, direct API, run-once, inspect, and project-monitor paths, and the browser-vs-API branching (screenshots, throttling, timeout, step semantics) is handled carefully with good inline rationale.

I flagged two spots where API is treated as multi-step in most of a component but not consistently, both producing user-visible glitches in the "Test now" / test-runs UI. Neither is blocking.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.anthropic.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.anthropic.com"

See Network Configuration for more information.

Generated by Claude Reviewer for #270874 · claude · opus · 358 AIC · ⌖ 50.3 AIC · ⊞ 5.5K

Comments that could not be inline-anchored

x-pack/solutions/observability/plugins/synthetics/public/apps/synthetics/components/test_now_mode/manual_test_run_mode/manual_test_run_mode.tsx:45

For API journeys this renders BrowserTestRunResult without passing isApiMonitor, so it defaults to false and showScreenshots stays true. The step list then renders an empty Screenshot column for API monitors in the "Test now" (manual test run) flow — the exact empty-column case this PR deliberately suppresses everywhere else (e.g. test_now_mode.tsx passes isApiMonitor={isApiMonitor}, and last_test_run/test_run_details/test_run_steps all thread showScreenshots). Pass the fl…

x-pack/solutions/observability/plugins/synthetics/public/apps/synthetics/components/monitor_details/monitor_summary/test_runs_table.tsx:109

API monitors are now treated as multi-step throughout this table (detail link, no IP column, no inline expander via isMultiStepMonitor), but the row-click handler below in getRowProps was not updated:

onClick: (evt: MouseEvent) =&gt; {
  if (item.monitor.type !== MONITOR_TYPES.BROWSER) {
    toggleDetails(item, expandedRows, setExpandedRows);
  } else {
    history.push(getTestRunDetailRelativeLink(...));
  }
}

Since it keys off !== BROWSER, clicking an API test-run row falls into …

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One correctness issue found: the new API project-monitor normalizer drops the maintenanceWindows prop, which makes API project monitors that reference maintenance windows fail normalization. Details in the inline comment.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.anthropic.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.anthropic.com"

See Network Configuration for more information.

Generated by Claude Reviewer for #270874 · claude · opus · 429.1 AIC · ⌖ 50.8 AIC · ⊞ 5.5K

@shahzad31
shahzad31 force-pushed the multi-step-mode branch 2 times, most recently from c9a16ab to 1c525c1 Compare September 8, 2026 10:29
@shahzad31
shahzad31 requested a review from a team as a code owner September 8, 2026 10:29

@lucaslopezf lucaslopezf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One concrete issue found: the API project-monitor normalizer drops maintenanceWindows, which breaks pushing any API monitor that references a maintenance window. Details inline. The rest of the API Journey plumbing (location enforcement across create/edit/inspect/run-once/bulk/project paths, Fleet api.network stream + base64 encoding, timeout/screenshot handling, and UI wiring) looks consistent and well-tested.

Generated by Claude Reviewer for #270874 · claude · opus · 302.4 AIC · ⌖ 50.1 AIC · ⊞ 5.5K

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the API Journey monitor type addition. The private-location gating is enforced consistently across all server validation entry points and the client, and the screenshot-omission logic is wired thoughtfully through the step-rendering components. One concrete gap noted inline: the manual-test-run path doesn't forward isApiMonitor to BrowserTestRunResult, leaving an empty Screenshot column for API journeys.

Generated by Claude Reviewer for #270874 · claude · opus · 265.5 AIC · ⌖ 49.8 AIC · ⊞ 5.5K

Comments that could not be inline-anchored

x-pack/solutions/observability/plugins/synthetics/public/apps/synthetics/components/test_now_mode/manual_test_run_mode/manual_test_run_mode.tsx:45

API monitors are routed to BrowserTestRunResult here but isApiMonitor is never forwarded, so it defaults to false and the inner BrowserStepsList renders the Screenshot column (showScreenshots={!isApiMonitor} → true) with empty placeholders for API journeys. Every other caller (test_now_mode.tsx, test_run_details.tsx, step_detail_page.tsx, last_test_run.tsx) suppresses screenshots for API monitors; this manual-test-run path is the one that was missed.

         …

</details>

…rney off Serverless

Public-location support for API Journey monitors was never actually
supported end-to-end, so remove it entirely rather than ship a flag
that does nothing useful yet:

- Delete the `xpack.uptime.enableApiJourneyPublicLocations` config
  (schema, exposeToBrowser, public plugin plumbing, kibanaService).
- `monitorTypeRequiresPrivateLocations` is now unconditional for API
  Journey monitors (no more opt-out flag threaded through validation,
  the monitor-type picker, and the bulk-locations flyout).

API Journey also isn't ready for Serverless yet (planned after the
9.6.0 stack release), so:

- Hide the "API Journey" option from the monitor-type picker when
  `kibanaService.isServerless` is true.
- Reject `type: api` server-side on Serverless for both the regular
  create API (`validateMonitor`) and the project monitors API
  (`validateProjectMonitor`), each behind a `TODO` marking this as
  temporary.
Thread isServerless into run_once/inspect routes and skip the gate for
unchanged existing project-monitor re-pushes, so the restriction added in
the previous commit can't be bypassed through those code paths. Also fix
the edit-page type selector hiding an already-existing API monitor, and
dedupe the gate's inline check into a shared helper.
The Serverless restriction on API Journey project monitors (added in a
previous commit) broke two existing Scout specs that assumed pushing an
`type: api` project monitor always succeeds, including on
serverless-observability_complete. Split each into a stateful case
(unchanged) and a dedicated Serverless case asserting the push is now
rejected with the expected error.
…ype filter

Live-tested against a genuine local Serverless Kibana + Elasticsearch
deployment: the edit page never renders the monitor-type picker at all
(EDIT_MONITOR_STEPS omits MONITOR_TYPE_STEP for every type; it shows a
static read-only label instead). The earlier "keep API visible when
already selected" special-case was addressing a scenario that can't
occur, so revert to the simple filter verified working correctly live.
… actually exercise GET

Per CI review feedback: the test only asserted pushProjectMonitors's
response, never called the get/paging endpoint it's meant to cover, and
duplicated the stricter assertion already in create_monitor_project.spec.ts.
Now it pushes a single rejected monitor and asserts the get endpoint
returns nothing for it, which is what this suite is actually for.
… inert screenshots/throttling

APIAdvancedFieldsCodec/APIFieldsCodec were straight aliases of Browser's,
forcing DEFAULT_API_ADVANCED_FIELDS to declare SCREENSHOTS/THROTTLING_CONFIG
with no-op values (OFF/NO_THROTTLING) even though neither applies to API
journeys (no browser, no CDP) and the UI never surfaces them. Give API its
own t.interface omitting both fields entirely instead.

MonitorFieldsCodec is unaffected: API was never folded into that
intersection (every field it needs is already a subset of Browser's), so
this only touches code that references APIFields/APIAdvancedFields
directly. SyntheticsMonitorCodec already listed APIFieldsCodec as an
explicit union member (not merged away like in the intersection above)
specifically so this split could land as a non-breaking change.

Also updates the zod "twin" schema (common/runtime_types/zod/monitor_types.ts)
and its compile-time parity check (zod/type_parity.ts) to match, and fixes
the one test that asserted the old OFF/NO_THROTTLING defaults.
… schema

Caught by CI: this test's toStrictEqual assertion on a pushed api-type
project monitor still expected screenshots/throttling, which API's own
codec (APIAdvancedFieldsCodec) no longer carries. Drop both from the
expected object to match.
API journeys share synthexec with browser and can outlive the 2-minute lightweight cleanup window.
…0874

# Conflicts:
#	x-pack/solutions/observability/plugins/synthetics/server/routes/monitor_cruds/monitor_validation.ts
@kibanamachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
shared-plugins 12.1MB 12.1MB +7.3KB
synthetics 18.0KB 17.9KB -82.0B
total +7.2KB
Unknown metric groups

total optimizer output size

id before after diff
all 63.9MB 63.9MB +7.2KB

History

@shahzad31
shahzad31 merged commit ed18eb5 into elastic:main Sep 14, 2026
41 checks passed
@shahzad31
shahzad31 deleted the multi-step-mode branch September 14, 2026 17:34
erikcurrin-elastic pushed a commit to erikcurrin-elastic/kibana that referenced this pull request Sep 14, 2026
## ✨ Summary

Adds **API Journey** monitors to Synthetics: Playwright
`APIRequestContext` journeys (`apiJourney(...)`) that run multi-step
HTTP checks without launching a browser.

## 🚀 Rollout

- **Private locations:** supported by default.
- **Elastic-managed locations:** disabled by default. Enable them
explicitly in `kibana.yml`:

  ```yaml
  xpack.uptime.enableApiJourneyPublicLocations: true
  ```

The setting is enforced consistently for the create/edit form, bulk
location changes, direct monitor APIs, Test now, monitor inspection, and
project-monitor pushes. The browser UI receives the setting so public
locations are selectable only when it is enabled.

## 📦 What’s included

- API monitor types, defaults, validation, and the Create/Edit **API
Journey** form.
- Fleet support for the `synthetics/api` input and `api.network` stream.
- Management, overview, details, error, test-run, filtering, and badge
support for step-based API journeys.
- Private-location policy formatting, API script encoding, project
monitor normalization, and global parameter interpolation.

| Related | |
| --- | --- |
| DSL |
[elastic/synthetics#997](elastic/synthetics#997)
|
| Heartbeat input |
[elastic/beats#50802](elastic/beats#50802) |

## 🖼️ Screenshot

![Create monitor type
picker](https://raw.githubusercontent.com/shahzad31/kibana/screenshots/screenshots/270874/create-type-picker.png)

## 🧪 Test plan

- [x] Jest: monitor validation (private default and public-flag cases),
location-support utility, bulk location flyout, and bulk update API.
- [x] `node scripts/type_check --project
x-pack/solutions/observability/plugins/synthetics/tsconfig.json`
- [x] ESLint and i18n validation.
- [x] `node scripts/check.js --scope=branch`
- [ ] Manual: private location with a Heartbeat build containing
elastic/beats#50802.
- [ ] Manual: Elastic-managed location with
`xpack.uptime.enableApiJourneyPublicLocations: true` and an agent
containing elastic/synthetics#997.
ppisljar pushed a commit to ppisljar/kibana that referenced this pull request Sep 21, 2026
## ✨ Summary

Adds **API Journey** monitors to Synthetics: Playwright
`APIRequestContext` journeys (`apiJourney(...)`) that run multi-step
HTTP checks without launching a browser.

## 🚀 Rollout

- **Private locations:** supported by default.
- **Elastic-managed locations:** disabled by default. Enable them
explicitly in `kibana.yml`:

  ```yaml
  xpack.uptime.enableApiJourneyPublicLocations: true
  ```

The setting is enforced consistently for the create/edit form, bulk
location changes, direct monitor APIs, Test now, monitor inspection, and
project-monitor pushes. The browser UI receives the setting so public
locations are selectable only when it is enabled.

## 📦 What’s included

- API monitor types, defaults, validation, and the Create/Edit **API
Journey** form.
- Fleet support for the `synthetics/api` input and `api.network` stream.
- Management, overview, details, error, test-run, filtering, and badge
support for step-based API journeys.
- Private-location policy formatting, API script encoding, project
monitor normalization, and global parameter interpolation.

| Related | |
| --- | --- |
| DSL |
[elastic/synthetics#997](elastic/synthetics#997)
|
| Heartbeat input |
[elastic/beats#50802](elastic/beats#50802) |

## 🖼️ Screenshot

![Create monitor type
picker](https://raw.githubusercontent.com/shahzad31/kibana/screenshots/screenshots/270874/create-type-picker.png)

## 🧪 Test plan

- [x] Jest: monitor validation (private default and public-flag cases),
location-support utility, bulk location flyout, and bulk update API.
- [x] `node scripts/type_check --project
x-pack/solutions/observability/plugins/synthetics/tsconfig.json`
- [x] ESLint and i18n validation.
- [x] `node scripts/check.js --scope=branch`
- [ ] Manual: private location with a Heartbeat build containing
elastic/beats#50802.
- [ ] Manual: Elastic-managed location with
`xpack.uptime.enableApiJourneyPublicLocations: true` and an agent
containing elastic/synthetics#997.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:actionable-obs PRs authored by the actionable obs team backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes reviewer:scout Agentic PR Scout test review Team:actionable-obs - DEPRECATED DEPRECATED v9.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants