/** * Context tag keys, mirroring `client.context.keys` from the SDK so callers can * keep using the familiar `tags[keys.userId]` idiom. */ export declare const contextTagKeys: { readonly userId: "ai.user.id"; readonly cloudRoleInstance: "ai.cloud.roleInstance"; }; /** Arguments for {@link AppInsightsClient.trackEvent}. */ export interface TrackEventArgs { name: string; properties?: Record; measurements?: Record; } /** Arguments for {@link AppInsightsClient.trackException}. */ export interface TrackExceptionArgs { exception: Error; properties?: Record; measurements?: Record; } /** * Parse an Application Insights connection string into the instrumentation key * and resolved ingestion `/v2.1/track` URL. * * The connection string is semicolon-delimited `key=value` pairs with * case-insensitive keys, e.g. * `InstrumentationKey=;IngestionEndpoint=https://.in.applicationinsights.azure.com/`. * * Plain GUIDs (legacy instrumentation keys with no `=`) are also accepted. * * @returns the iKey and track URL, or `null` if no instrumentation key is present. */ export declare function parseConnectionString(connectionString: string): { iKey: string; trackUrl: string; } | null; /** * A minimal, dependency-free Application Insights client. * * Construct with an instrumentation key or connection string, optionally set * {@link AppInsightsClient.context} tags, then buffer telemetry via * {@link AppInsightsClient.trackEvent}/{@link AppInsightsClient.trackException} * and deliver it with {@link AppInsightsClient.flush}. * * If the connection string has no instrumentation key, the client becomes an * inert no-op (every method silently does nothing) — it never throws into * calling code. */ export declare class AppInsightsClient { /** * SDK-compatible config bag. Retained so callers can read * `config.connectionString`; the SDK's auto-collection toggles are obsolete * here (this client only does manual tracking) and are intentionally absent. */ readonly config: { connectionString: string; }; /** SDK-compatible context: per-envelope tags plus the canonical key names. */ readonly context: { tags: Record; keys: typeof contextTagKeys; }; private readonly iKey; private readonly trackUrl; private readonly timeoutMs; private buffer; constructor(connectionString: string, options?: { timeoutMs?: number; }); /** Buffer an event envelope. Delivered on the next {@link flush}. */ trackEvent(args: TrackEventArgs): void; /** Buffer an exception envelope. Delivered on the next {@link flush}. */ trackException(args: TrackExceptionArgs): void; /** * POST all buffered envelopes to the ingestion endpoint in one request and * clear the buffer. Best-effort: any network/HTTP error is swallowed (the * buffer is still cleared) so telemetry never affects the caller. */ flush(): Promise; /** Build a Breeze envelope, stamping the current context tags and time. */ private envelope; }