Back to Kibana

@kbn/scout-synthtrace

src/platform/packages/shared/kbn-scout-synthtrace/README.md

9.4.02.7 KB
Original Source

@kbn/scout-synthtrace

Optional Playwright fixtures and helpers that depend on @kbn/synthtrace and @kbn/synthtrace-client.
@kbn/scout stays free of those dependencies so selective Scout runs and module graphs stay smaller.

Full wiring guide (platform, Oblt, global setup, typing): see Scout README — Optional: wiring Synthtrace.

@kbn/scout-oblt, @kbn/scout-search, and @kbn/scout-security do not depend on or re-export this package.

When to use

  • Specs that need worker fixtures apmSynthtraceEsClient, infraSynthtraceEsClient, or logsSynthtraceEsClient.
  • Parallel global.setup.ts callbacks that need those fixtures in scope.
  • One-off client access via getSynthtraceClient (e.g. Discover-style trace ingestion in setup only).

Add @kbn/scout-synthtrace to your module’s tsconfig.json kbn_references (and regenerate Moon if you use it).

Exports

ExportUse
synthtraceFixturemergeTests(scoutTest, synthtraceFixture) (or with Oblt test / spaceTest).
getSynthtraceClientImperative client creation in setup scripts; pass esClient, log, config, optional kbnUrl.
globalSetupHookWithSynthtraceSame worker stack as @kbn/scout globalSetupHook plus synthtrace (for parallel global setup).
SynthtraceFixtureType for ScoutWorkerFixtures & SynthtraceFixture when you .extend merged tests.

Quick examples

Merge into UI test (platform):

ts
import { mergeTests, test as scoutTest } from '@kbn/scout';
import { synthtraceFixture } from '@kbn/scout-synthtrace';

export const test = mergeTests(scoutTest, synthtraceFixture).extend(/* … */);

Global setup only:

ts
import { globalSetupHookWithSynthtrace } from '@kbn/scout-synthtrace';

globalSetupHookWithSynthtrace('Setup', async ({ logsSynthtraceEsClient, log }) => {
  await logsSynthtraceEsClient.clean();
});

Merge with an existing global hook (e.g. Oblt):

ts
import { mergeTests, globalSetupHook as obltGlobalSetupHook } from '@kbn/scout-oblt';
import { synthtraceFixture } from '@kbn/scout-synthtrace';

const globalSetupHook = mergeTests(obltGlobalSetupHook, synthtraceFixture);

Types

SynthtraceFixture describes the worker fixture keys (apmSynthtraceEsClient, etc.). Use it when typing helpers or extend<..., ScoutWorkerFixtures & SynthtraceFixture>.