Skip to content

03 - Spacetime apm api shared#268992

Open
cauemarcondes wants to merge 45 commits into
elastic:mainfrom
cauemarcondes:spacetime-03-apm-api-shared
Open

03 - Spacetime apm api shared#268992
cauemarcondes wants to merge 45 commits into
elastic:mainfrom
cauemarcondes:spacetime-03-apm-api-shared

Conversation

@cauemarcondes
Copy link
Copy Markdown
Contributor

@cauemarcondes cauemarcondes commented May 12, 2026

Summary

Creates the @kbn/apm-api-shared package (x-pack/platform/packages/shared/kbn-apm-api-shared) and defines all APM route definitions as typed contracts.

This introduces:

  • A defineRoute utility and shared default API types (kueryRt, rangeRt, probabilityRt, etc.)
  • Typed route definitions for all APM API endpoints organized by domain: agent configuration, agent explorer, agent keys, alerts, anomaly detection, assistant functions, correlations, custom dashboards, custom links, data views, debug telemetry, dependencies, diagnostics, environments, errors, fallback to transactions, fleet, infrastructure, latency distribution, metrics, mobile, profiling, service groups, service map, services, source maps, span links, storage explorer, suggestions, time range metadata, traces, and transactions
  • callApi and createCallApmApi client utilities for type-safe API consumption

This is the third PR in a stack:

@cauemarcondes cauemarcondes force-pushed the spacetime-03-apm-api-shared branch 3 times, most recently from b5c54f8 to e94edf6 Compare May 12, 2026 20:12
@cauemarcondes cauemarcondes added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting v9.5.0 labels May 12, 2026
@cauemarcondes cauemarcondes force-pushed the spacetime-03-apm-api-shared branch 3 times, most recently from 87ada6d to 8d12376 Compare May 13, 2026 12:13
@cauemarcondes cauemarcondes force-pushed the spacetime-02-apm-common branch from 4512b55 to 46b7d51 Compare May 14, 2026 18:00
@cauemarcondes cauemarcondes force-pushed the spacetime-03-apm-api-shared branch from f13e396 to 7c59999 Compare May 14, 2026 18:01
@cauemarcondes cauemarcondes force-pushed the spacetime-02-apm-common branch from 46b7d51 to fb27ffa Compare May 19, 2026 17:56
@cauemarcondes cauemarcondes force-pushed the spacetime-03-apm-api-shared branch from 7c59999 to b45fed3 Compare May 19, 2026 18:01
@cauemarcondes cauemarcondes force-pushed the spacetime-02-apm-common branch from fb27ffa to 3288f6e Compare May 19, 2026 18:35
cauemarcondes added a commit that referenced this pull request May 26, 2026
## Summary

Extracts agent configuration definitions from the `apm` plugin into the
`@kbn/apm-common` package
(`x-pack/platform/packages/shared/kbn-apm-common`).

This moves agent configuration types, constants, runtime types
(duration, bytes, boolean, integer, capture body, etc.), setting
definitions (general, Java, mobile, eDOT SDK), and related tests out of
`x-pack/solutions/observability/plugins/apm/common/agent_configuration/`
into the shared platform package. The APM plugin files now re-export
from `@kbn/apm-common` to maintain backwards compatibility.

The package is placed under `x-pack/` since its only consumer is the APM
plugin, which is already in x-pack.

This is the second PR in a stack:
- **PR 1:** [01 - Spacetime apm
types](#268981)
- **PR 2 (this):** Move agent configuration definitions to
`@kbn/apm-common`
- **PR 3:** [03 - Spacetime apm api
shared](#268992)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
smith pushed a commit to smith/kibana that referenced this pull request May 27, 2026
## Summary

Extracts agent configuration definitions from the `apm` plugin into the
`@kbn/apm-common` package
(`x-pack/platform/packages/shared/kbn-apm-common`).

This moves agent configuration types, constants, runtime types
(duration, bytes, boolean, integer, capture body, etc.), setting
definitions (general, Java, mobile, eDOT SDK), and related tests out of
`x-pack/solutions/observability/plugins/apm/common/agent_configuration/`
into the shared platform package. The APM plugin files now re-export
from `@kbn/apm-common` to maintain backwards compatibility.

The package is placed under `x-pack/` since its only consumer is the APM
plugin, which is already in x-pack.

This is the second PR in a stack:
- **PR 1:** [01 - Spacetime apm
types](elastic#268981)
- **PR 2 (this):** Move agent configuration definitions to
`@kbn/apm-common`
- **PR 3:** [03 - Spacetime apm api
shared](elastic#268992)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@cauemarcondes cauemarcondes changed the base branch from spacetime-02-apm-common to main May 27, 2026 18:20
@cauemarcondes cauemarcondes force-pushed the spacetime-03-apm-api-shared branch from b45fed3 to 1de363c Compare May 27, 2026 18:35
@cauemarcondes cauemarcondes marked this pull request as ready for review May 27, 2026 23:16
@kibanamachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #99 / Serverless Common UI - Home Page Sample data in serverless Sample data loads

Metrics [docs]

✅ unchanged

History

@lucaslopezf lucaslopezf self-requested a review May 29, 2026 09:42
Copy link
Copy Markdown
Contributor

@lucaslopezf lucaslopezf left a comment

Choose a reason for hiding this comment

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

LGTM! Just a few comments to take into account just in case, but I'll compare every file with the original in part 04.
Note for other reviewer: you might think some options, security-related metadata, etc, are missing, but they're addressed in part 04. For example source_maps/route.ts#L61-L75. I’m saying this because at first I left comments referring to these points, but when I saw part 04, I realized they were already addressed there

params: t.type({
body: t.type({
name: t.string,
privileges: t.array(t.union([t.literal('event:write'), t.literal('config_agent:read')])),
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.

Should we use this file?


export const fieldValueStatsTransactionsRoute = defineRoute<FieldValueStatsTransactionsResponse>()({
endpoint: 'GET /internal/apm/correlations/field_value_stats/transactions',
params: t.type({
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.

Why these params are different to the original?

endpoint: 'GET /internal/apm/service-map',
params: t.type({
query: t.intersection([
t.partial({
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.

We are losing this field

service_name: t.string,
service_version: t.string,
bundle_filepath: t.string,
sourcemap: t.union([t.string, t.any]).pipe(jsonRt).pipe(sourceMapRt),
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.

This is different from the original just take in account for the next PR

@@ -0,0 +1,86 @@
/*
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants