UNPKG

aws-cdk

Version:

AWS CDK Toolkit CLI, the command line tool for CDK apps

78 lines (77 loc) • 2.79 kB
import type { IIoHost } from '../../io-host'; import type { TelemetrySchema } from '../schema'; import type { ITelemetrySink } from './sink-interface'; /** * Reports a successful hand-off, NOT a successful delivery. */ export declare const DISPATCHED_TRACE = "Telemetry dispatched"; /** * Properties for the subprocess telemetry sink. */ export interface SubprocessTelemetrySinkProps { /** * The external endpoint to hit */ readonly endpoint: string; /** * Where messages are going to be sent */ readonly ioHost: IIoHost; /** * Proxy the sender should route through, as configured by `--proxy` or the `proxy` setting. * * @default - resolved from the environment by the sender, as `proxy-agent` does for the rest of the CLI */ readonly proxyUrl?: string; /** * Absolute path to the CA bundle to trust, as configured by `--ca-bundle-path` or `AWS_CA_BUNDLE`. * * @default - only the system trust store */ readonly caBundlePath?: string; /** * How to locate the bundled sender entry point. * * Injectable so a test can exercise the missing-sender path without reaching into this object's * privates; returning undefined is what "not on disk" looks like. * * @default - looked up relative to this package's root */ readonly resolveSender?: () => string | undefined; } /** * A telemetry sink that delivers events from a detached child process. * * Events are written to a temporary file and handed to a child that outlives us, so the CLI can exit * immediately instead of waiting on the network. Nothing here ever learns whether delivery succeeded. * * Deliberately does not check connectivity first: that check would itself be a network call on the * exit path, which is what this sink exists to avoid. */ export declare class SubprocessTelemetrySink implements ITelemetrySink { private events; private endpoint; private ioHelper; private senderPath?; private proxyUrl?; private caBundlePath?; constructor(props: SubprocessTelemetrySinkProps); /** * Add an event to the collection. */ emit(event: TelemetrySchema): Promise<void>; /** * Hand whatever has accumulated to a detached sender. * * Clears the batch either way: delivery is one-shot, the process that would retry has usually * exited, and retaining the events would just re-report the failure and regrow the batch every 30s. * This is the single place delivery failures are handled; `dispatch` reports them by throwing. */ flush(): Promise<void>; /** * Hand the batch to a detached sender process. * * Throws if the batch could not be handed over. */ private dispatch; }