Repository navigation
[Synthetics] Add API Journey monitor type - #270874
Conversation
…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>
6ffd0f4 to
8ac641e
Compare
d805940 to
f56833b
Compare
|
Pinging @elastic/actionable-obs-team (Team:actionable-obs) |
There was a problem hiding this comment.
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) => {
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 …
310300b to
d40ff0f
Compare
There was a problem hiding this comment.
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
c9a16ab to
1c525c1
Compare
1c525c1 to
69a7a81
Compare
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
b1e7944 to
ff763c1
Compare
… 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
💚 Build Succeeded
Metrics [docs]Page load bundle
History
|
## ✨ 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  ## 🧪 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.
## ✨ 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  ## 🧪 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.
✨ Summary
Adds API Journey monitors to Synthetics: Playwright
APIRequestContextjourneys (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: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
synthetics/apiinput andapi.networkstream.🖼️ Screenshot
🧪 Test plan
node scripts/type_check --project x-pack/solutions/observability/plugins/synthetics/tsconfig.jsonnode scripts/check.js --scope=branchapimonitor type for synthetics API journeys beats#50802.xpack.uptime.enableApiJourneyPublicLocations: trueand an agent containing feat: multi step api runner synthetics#997.