import * as Contracts from "../declarations/contracts"; import { TelemetryItem as Envelope } from "../declarations/generated"; import { Context } from "./context"; import Config = require("./shim-config"); /** * Application Insights telemetry client provides interface to track telemetry items, register telemetry initializers and * and manually trigger immediate sending (flushing) */ export declare class TelemetryClient { context: Context; commonProperties: { [key: string]: string; }; config: Config; private _attributeSpanProcessor; private _attributeLogProcessor; private _logApi; private _isInitialized; private _options; private _configWarnings; /** * Constructs a new instance of TelemetryClient * @param setupString the Connection String or Instrumentation Key to use (read from environment variable if not specified) */ constructor(input?: string); initialize(): void; /** * Log information about availability of an application * @param telemetry Object encapsulating tracking options */ trackAvailability(telemetry: Contracts.AvailabilityTelemetry): void; /** * Log a page view * @param telemetry Object encapsulating tracking options */ trackPageView(telemetry: Contracts.PageViewTelemetry): void; /** * Log a trace message * @param telemetry Object encapsulating tracking options */ trackTrace(telemetry: Contracts.TraceTelemetry): void; /** * Log an exception * @param telemetry Object encapsulating tracking options */ trackException(telemetry: Contracts.ExceptionTelemetry): void; /** * Log a user action or other occurrence. * @param telemetry Object encapsulating tracking options */ trackEvent(telemetry: Contracts.EventTelemetry): void; /** * Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators. * To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the * telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals. * @param telemetry Object encapsulating tracking options */ trackMetric(telemetry: Contracts.MetricPointTelemetry & Contracts.MetricTelemetry): void; /** * Log a request. Note that the default client will attempt to collect HTTP requests automatically so only use this for requests * that aren't automatically captured or if you've disabled automatic request collection. * * @param telemetry Object encapsulating tracking options */ trackRequest(telemetry: Contracts.RequestTelemetry): void; /** * Log a dependency. Note that the default client will attempt to collect dependencies automatically so only use this for dependencies * that aren't automatically captured or if you've disabled automatic dependency collection. * * @param telemetry Object encapsulating tracking option * */ trackDependency(telemetry: Contracts.DependencyTelemetry): void; /** * Generic track method for all telemetry types * @param data the telemetry to send * @param telemetryType specify the type of telemetry you are tracking from the list of Contracts.DataTypes */ track(telemetry: Contracts.Telemetry, telemetryType: Contracts.TelemetryType): void; /** * Automatically populate telemetry properties like RoleName when running in Azure * * @param value if true properties will be populated */ setAutoPopulateAzureProperties(): void; /** * Get Authorization handler */ getAuthorizationHandler(config: Config): void; getStatsbeat(): any; setUseDiskRetryCaching(value: boolean, resendInterval?: number, maxBytesOnDisk?: number): void; /** * Adds telemetry processor to the collection. Telemetry processors will be called one by one * before telemetry item is pushed for sending and in the order they were added. * * @param telemetryProcessor function, takes Envelope, and optional context object and returns boolean */ addTelemetryProcessor(telemetryProcessor: (envelope: Envelope, contextObjects?: { [name: string]: any; }) => boolean): void; clearTelemetryProcessors(): void; trackNodeHttpRequestSync(telemetry: Contracts.NodeHttpRequestTelemetry): void; trackNodeHttpRequest(telemetry: Contracts.NodeHttpRequestTelemetry): void; trackNodeHttpDependency(telemetry: Contracts.NodeHttpRequestTelemetry): void; /** * Immediately send all queued telemetry. */ flush(): Promise; /** * Shutdown client */ shutdown(): Promise; pushWarningToLog(warning: string): void; }