diff --git a/applicationinsights/applicationinsights.d.ts b/applicationinsights/applicationinsights.d.ts index 6b80adc2ac..12dffdd81c 100644 --- a/applicationinsights/applicationinsights.d.ts +++ b/applicationinsights/applicationinsights.d.ts @@ -4,21 +4,25 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped interface AutoCollectConsole { + constructor(client: Client): AutoCollectConsole; enable(isEnabled: boolean): void; isInitialized(): boolean; } interface AutoCollectExceptions { + constructor(client:Client): AutoCollectExceptions; isInitialized(): boolean; enable(isEnabled:boolean): void; } interface AutoCollectPerformance { + constructor(client: Client): AutoCollectPerformance; enable(isEnabled: boolean): void; isInitialized(): boolean; } interface AutoCollectRequests { + constructor(client: Client): AutoCollectRequests; enable(isEnabled: boolean): void; isInitialized(): boolean; } @@ -85,14 +89,17 @@ declare module ContractsModule { sampleRate: string; internalSdkVersion: string; internalAgentVersion: string; + constructor(): ContextTagKeys; } interface Domain { ver: number; properties: any; + constructor(): Domain; } interface Data { baseType: string; baseData: TDomain; + constructor(): Data; } interface Envelope { ver: number; @@ -112,18 +119,21 @@ declare module ContractsModule { [key: string]: string; }; data: Data; + constructor(): Envelope; } interface EventData extends ContractsModule.Domain { ver: number; name: string; properties: any; measurements: any; + constructor(): EventData; } interface MessageData extends ContractsModule.Domain { ver: number; message: string; severityLevel: ContractsModule.SeverityLevel; properties: any; + constructor(): MessageData; } interface ExceptionData extends ContractsModule.Domain { ver: number; @@ -134,6 +144,7 @@ declare module ContractsModule { crashThreadId: number; properties: any; measurements: any; + constructor(): ExceptionData; } interface StackFrame { level: number; @@ -141,6 +152,7 @@ declare module ContractsModule { assembly: string; fileName: string; line: number; + constructor(): StackFrame; } interface ExceptionDetails { id: number; @@ -150,6 +162,7 @@ declare module ContractsModule { hasFullStack: boolean; stack: string; parsedStack: StackFrame[]; + constructor(): ExceptionDetails; } interface DataPoint { name: string; @@ -159,11 +172,13 @@ declare module ContractsModule { min: number; max: number; stdDev: number; + constructor(): DataPoint; } interface MetricData extends ContractsModule.Domain { ver: number; metrics: DataPoint[]; properties: any; + constructor(): MetricData; } interface PageViewData extends ContractsModule.EventData { ver: number; @@ -172,6 +187,7 @@ declare module ContractsModule { duration: string; properties: any; measurements: any; + constructor(): PageViewData; } interface PageViewPerfData extends ContractsModule.PageViewData { ver: number; @@ -185,6 +201,7 @@ declare module ContractsModule { domProcessing: string; properties: any; measurements: any; + constructor(): PageViewPerfData; } interface RemoteDependencyData extends ContractsModule.Domain { ver: number; @@ -202,6 +219,7 @@ declare module ContractsModule { commandName: string; dependencyTypeName: string; properties: any; + constructor(): RemoteDependencyData; } interface AjaxCallData extends ContractsModule.PageViewData { ver: number; @@ -218,6 +236,7 @@ declare module ContractsModule { success: boolean; properties: any; measurements: any; + constructor(): AjaxCallData; } interface RequestData extends ContractsModule.Domain { ver: number; @@ -231,10 +250,12 @@ declare module ContractsModule { url: string; properties: any; measurements: any; + constructor(): RequestData; } interface SessionStateData extends ContractsModule.Domain { ver: number; state: ContractsModule.SessionState; + constructor(): SessionStateData; } interface PerformanceCounterData extends ContractsModule.Domain { ver: number; @@ -248,6 +269,7 @@ declare module ContractsModule { stdDev: number; value: number; properties: any; + constructor(): PerformanceCounterData; } } @@ -309,10 +331,14 @@ interface Client { * 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 name A string that identifies the metric. - * @param value The value of the metric + * @param name A string that identifies the metric. + * @param value The value of the metric + * @param count the number of samples used to get this value + * @param min the min sample for this set + * @param max the max sample for this set + * @param stdDev the standard deviation of the set */ - trackMetric(name: string, value: number): void; + trackMetric(name: string, value: number, count?:number, min?: number, max?: number, stdDev?: number): void; trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: { [key: string]: string; }): void; @@ -381,10 +407,16 @@ declare class ApplicationInsights { private static _performance; private static _requests; private static _isStarted; + /** + * Initializes a client with the given instrumentation key, if this is not specified, the value will be + * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY + * @returns {ApplicationInsights/Client} a new client + */ + static getClient(instrumentationKey?: string): Client; /** * Initializes the default client of the client and sets the default configuration * @param instrumentationKey the instrumentation key to use. Optional, if this is not specified, the value will be - * read from the environment variable APPINSIGHTS_INSTRUMENTATION_KEY + * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY * @returns {ApplicationInsights} this interface */ static setup(instrumentationKey?: string): typeof ApplicationInsights;