aws-cdk
Version:
AWS CDK Toolkit CLI, the command line tool for CDK apps
51 lines (50 loc) • 1.82 kB
TypeScript
import type { TelemetryBatch } from './post-telemetry';
import type { ProxyAgentDiagnostics } from '../proxy-agent';
/**
* What the parent hands to this process.
*/
export interface TelemetrySenderConfig {
/**
* Absolute URL to POST the telemetry payload to.
*/
readonly endpoint: string;
/**
* The batch of events to deliver.
*/
readonly body: TelemetryBatch;
/**
* Proxy to route through. An empty string means "explicitly no proxy", as `--proxy ''` does.
*
* @default - resolved from the inherited proxy environment variables, as in the parent
*/
readonly proxyUrl?: string;
/**
* Absolute path to a CA bundle to trust. The path, not the contents: a system bundle is ~190KB.
*
* @default - the default Node trust store, plus anything in `NODE_EXTRA_CA_CERTS`
*/
readonly caBundlePath?: string;
/**
* Budget for the delivery attempt, in milliseconds.
*
* @default 10000
*/
readonly timeoutMs?: number;
}
/**
* POST a telemetry payload, routing through a proxy when one applies.
*
* Returns the status code for the caller to judge, and lets failures reject: every outcome is handled
* in one place, in the entry point.
*/
export declare function sendTelemetry(cfg: TelemetrySenderConfig): Promise<number | undefined>;
export declare function isSuccess(statusCode: number | undefined): boolean;
/**
* Diagnostics for the detached child, which has no IoHost.
*/
export declare const senderDiagnostics: ProxyAgentDiagnostics;
/**
* Only visible when the parent was run with `CDK_TELEMETRY_SENDER_DEBUG=1`, which is also what makes
* it pass this process's stderr through. Synchronous because `process.exit` discards buffered writes.
*/
export declare function trace(message: string): void;