microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0.1.2

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/typings/applicationinsights/applicationinsights.d.ts

468lines · modecode

1// Type definitions for Application Insights v0.15.8
2// Project: https://github.com/Microsoft/ApplicationInsights-node.js
3// Definitions by: Scott Southwood <https://github.com/scsouthw/>
4// Definitions: https://github.com/borisyankov/DefinitelyTyped
5
6interface AutoCollectConsole {
7 constructor(client: Client): AutoCollectConsole;
8 enable(isEnabled: boolean): void;
9 isInitialized(): boolean;
10}
11
12interface AutoCollectExceptions {
13 constructor(client:Client): AutoCollectExceptions;
14 isInitialized(): boolean;
15 enable(isEnabled:boolean): void;
16}
17
18interface AutoCollectPerformance {
19 constructor(client: Client): AutoCollectPerformance;
20 enable(isEnabled: boolean): void;
21 isInitialized(): boolean;
22}
23
24interface AutoCollectRequests {
25 constructor(client: Client): AutoCollectRequests;
26 enable(isEnabled: boolean): void;
27 isInitialized(): boolean;
28}
29
30
31declare module ContractsModule {
32 enum DataPointType {
33 Measurement = 0,
34 Aggregation = 1,
35 }
36 enum DependencyKind {
37 SQL = 0,
38 Http = 1,
39 Other = 2,
40 }
41 enum DependencySourceType {
42 Undefined = 0,
43 Aic = 1,
44 Apmc = 2,
45 }
46 enum SessionState {
47 Start = 0,
48 End = 1,
49 }
50 enum SeverityLevel {
51 Verbose = 0,
52 Information = 1,
53 Warning = 2,
54 Error = 3,
55 Critical = 4,
56 }
57 interface ContextTagKeys {
58 applicationVersion: string;
59 applicationBuild: string;
60 deviceId: string;
61 deviceIp: string;
62 deviceLanguage: string;
63 deviceLocale: string;
64 deviceModel: string;
65 deviceNetwork: string;
66 deviceOEMName: string;
67 deviceOS: string;
68 deviceOSVersion: string;
69 deviceRoleInstance: string;
70 deviceRoleName: string;
71 deviceScreenResolution: string;
72 deviceType: string;
73 deviceMachineName: string;
74 locationIp: string;
75 operationId: string;
76 operationName: string;
77 operationParentId: string;
78 operationRootId: string;
79 operationSyntheticSource: string;
80 operationIsSynthetic: string;
81 sessionId: string;
82 sessionIsFirst: string;
83 sessionIsNew: string;
84 userAccountAcquisitionDate: string;
85 userAccountId: string;
86 userAgent: string;
87 userId: string;
88 userStoreRegion: string;
89 sampleRate: string;
90 internalSdkVersion: string;
91 internalAgentVersion: string;
92 constructor(): ContextTagKeys;
93 }
94 interface Domain {
95 ver: number;
96 properties: any;
97 constructor(): Domain;
98 }
99 interface Data<TDomain extends ContractsModule.Domain> {
100 baseType: string;
101 baseData: TDomain;
102 constructor(): Data<TDomain>;
103 }
104 interface Envelope {
105 ver: number;
106 name: string;
107 time: string;
108 sampleRate: number;
109 seq: string;
110 iKey: string;
111 flags: number;
112 deviceId: string;
113 os: string;
114 osVer: string;
115 appId: string;
116 appVer: string;
117 userId: string;
118 tags: {
119 [key: string]: string;
120 };
121 data: Data<Domain>;
122 constructor(): Envelope;
123 }
124 interface EventData extends ContractsModule.Domain {
125 ver: number;
126 name: string;
127 properties: any;
128 measurements: any;
129 constructor(): EventData;
130 }
131 interface MessageData extends ContractsModule.Domain {
132 ver: number;
133 message: string;
134 severityLevel: ContractsModule.SeverityLevel;
135 properties: any;
136 constructor(): MessageData;
137 }
138 interface ExceptionData extends ContractsModule.Domain {
139 ver: number;
140 handledAt: string;
141 exceptions: ExceptionDetails[];
142 severityLevel: ContractsModule.SeverityLevel;
143 problemId: string;
144 crashThreadId: number;
145 properties: any;
146 measurements: any;
147 constructor(): ExceptionData;
148 }
149 interface StackFrame {
150 level: number;
151 method: string;
152 assembly: string;
153 fileName: string;
154 line: number;
155 constructor(): StackFrame;
156 }
157 interface ExceptionDetails {
158 id: number;
159 outerId: number;
160 typeName: string;
161 message: string;
162 hasFullStack: boolean;
163 stack: string;
164 parsedStack: StackFrame[];
165 constructor(): ExceptionDetails;
166 }
167 interface DataPoint {
168 name: string;
169 kind: ContractsModule.DataPointType;
170 value: number;
171 count: number;
172 min: number;
173 max: number;
174 stdDev: number;
175 constructor(): DataPoint;
176 }
177 interface MetricData extends ContractsModule.Domain {
178 ver: number;
179 metrics: DataPoint[];
180 properties: any;
181 constructor(): MetricData;
182 }
183 interface PageViewData extends ContractsModule.EventData {
184 ver: number;
185 url: string;
186 name: string;
187 duration: string;
188 properties: any;
189 measurements: any;
190 constructor(): PageViewData;
191 }
192 interface PageViewPerfData extends ContractsModule.PageViewData {
193 ver: number;
194 url: string;
195 perfTotal: string;
196 name: string;
197 duration: string;
198 networkConnect: string;
199 sentRequest: string;
200 receivedResponse: string;
201 domProcessing: string;
202 properties: any;
203 measurements: any;
204 constructor(): PageViewPerfData;
205 }
206 interface RemoteDependencyData extends ContractsModule.Domain {
207 ver: number;
208 name: string;
209 kind: ContractsModule.DataPointType;
210 value: number;
211 count: number;
212 min: number;
213 max: number;
214 stdDev: number;
215 dependencyKind: ContractsModule.DependencyKind;
216 success: boolean;
217 async: boolean;
218 dependencySource: ContractsModule.DependencySourceType;
219 commandName: string;
220 dependencyTypeName: string;
221 properties: any;
222 constructor(): RemoteDependencyData;
223 }
224 interface AjaxCallData extends ContractsModule.PageViewData {
225 ver: number;
226 url: string;
227 ajaxUrl: string;
228 name: string;
229 duration: string;
230 requestSize: number;
231 responseSize: number;
232 timeToFirstByte: string;
233 timeToLastByte: string;
234 callbackDuration: string;
235 responseCode: string;
236 success: boolean;
237 properties: any;
238 measurements: any;
239 constructor(): AjaxCallData;
240 }
241 interface RequestData extends ContractsModule.Domain {
242 ver: number;
243 id: string;
244 name: string;
245 startTime: string;
246 duration: string;
247 responseCode: string;
248 success: boolean;
249 httpMethod: string;
250 url: string;
251 properties: any;
252 measurements: any;
253 constructor(): RequestData;
254 }
255 interface SessionStateData extends ContractsModule.Domain {
256 ver: number;
257 state: ContractsModule.SessionState;
258 constructor(): SessionStateData;
259 }
260 interface PerformanceCounterData extends ContractsModule.Domain {
261 ver: number;
262 categoryName: string;
263 counterName: string;
264 instanceName: string;
265 kind: DataPointType;
266 count: number;
267 min: number;
268 max: number;
269 stdDev: number;
270 value: number;
271 properties: any;
272 constructor(): PerformanceCounterData;
273 }
274}
275
276
277interface Channel {
278 constructor(isDisabled: () => boolean, getBatchSize: () => number, getBatchIntervalMs: () => number, sender: Sender): Channel;
279 /**
280 * Add a telemetry item to the send buffer
281 */
282 send(envelope: ContractsModule.Envelope): void;
283 handleCrash(envelope: ContractsModule.Envelope): void;
284 /**
285 * Immediately send buffered data
286 */
287 triggerSend(isNodeCrashing?: boolean): void;
288}
289
290interface Client {
291 config: Config;
292 context: Context;
293 commonProperties: {
294 [key: string]: string;
295 };
296 channel: Channel;
297 /**
298 * Constructs a new client of the client
299 * @param iKey the instrumentation key to use (read from environment variable if not specified)
300 */
301 constructor(iKey?: string): Client;
302 /**
303 * Log a user action or other occurrence.
304 * @param name A string to identify this event in the portal.
305 * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
306 * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
307 */
308 trackEvent(name: string, properties?: {
309 [key: string]: string;
310 }, measurements?: {
311 [key: string]: number;
312 }): void;
313 /**
314 * Log a trace message
315 * @param message A string to identify this event in the portal.
316 * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
317 */
318 trackTrace(message: string, severityLevel?: ContractsModule.SeverityLevel, properties?: {
319 [key: string]: string;
320 }): void;
321 /**
322 * Log an exception you have caught.
323 * @param exception An Error from a catch clause, or the string error message.
324 * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
325 * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
326 */
327 trackException(exception: Error, properties?: {
328 [key: string]: string;
329 }): void;
330 /**
331 * Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
332 * To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
333 * telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals.
334 * @param name A string that identifies the metric.
335 * @param value The value of the metric
336 * @param count the number of samples used to get this value
337 * @param min the min sample for this set
338 * @param max the max sample for this set
339 * @param stdDev the standard deviation of the set
340 */
341 trackMetric(name: string, value: number, count?:number, min?: number, max?: number, stdDev?: number): void;
342 trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: {
343 [key: string]: string;
344 }): void;
345 /**
346 * Log information about a dependency of your app. Typically used to track the time database calls or outgoing http requests take from your server.
347 * @param name The name of the dependency (i.e. "myDatabse")
348 * @param commandname The name of the command executed on the dependency
349 * @param elapsedTimeMs The amount of time in ms that the dependency took to return the result
350 * @param success True if the dependency succeeded, false otherwise
351 * @param dependencyTypeName The type of the dependency (i.e. "SQL" "HTTP"). Defaults to empty.
352 * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
353 * @param dependencyKind ContractsModule.DependencyKind of this dependency. Defaults to Other.
354 * @param async True if the dependency was executed asynchronously, false otherwise. Defaults to false
355 * @param dependencySource ContractsModule.DependencySourceType of this dependency. Defaults to Undefined.
356 */
357 trackDependency(name: string, commandName: string, elapsedTimeMs: number, success: boolean, dependencyTypeName?: string, properties?: {}, dependencyKind?: any, async?: boolean, dependencySource?: number): void;
358 /**
359 * Immediately send all queued telemetry.
360 */
361 sendPendingData(callback?: (response: string) => void): void;
362 getEnvelope(data: ContractsModule.Data<ContractsModule.Domain>, tagOverrides?: {
363 [key: string]: string;
364 }): ContractsModule.Envelope;
365 /**
366 * Generic track method for all telemetry types
367 * @param data the telemetry to send
368 * @param tagOverrides the context tags to use for this telemetry which overwrite default context values
369 */
370 track(data: ContractsModule.Data<ContractsModule.Domain>, tagOverrides?: {
371 [key: string]: string;
372 }): void;
373}
374
375interface Config {
376 instrumentationKey: string;
377 sessionRenewalMs: number;
378 sessionExpirationMs: number;
379 endpointUrl: string;
380 maxBatchSize: number;
381 maxBatchIntervalMs: number;
382 disableAppInsights: boolean;
383 constructor(instrumentationKey?: string): Config;
384}
385
386interface Context {
387 keys: ContractsModule.ContextTagKeys;
388 tags: {
389 [key: string]: string;
390 };
391 constructor(packageJsonPath?: string): Context;
392}
393
394interface Sender {
395 constructor(getUrl: () => string, onSuccess?: (response: string) => void, onError?: (error: Error) => void): Sender;
396 send(payload: any/* Buffer */): void;
397 saveOnCrash(payload: string): void;
398 /**
399 * enable caching events locally on error
400 */
401 enableCacheOnError(): void;
402 /**
403 * disable caching events locally on error
404 */
405 disableCacheOnError(): void;
406}
407
408/**
409 * The singleton meta interface for the default client of the client. This interface is used to setup/start and configure
410 * the auto-collection behavior of the application insights module.
411 */
412interface ApplicationInsights {
413 client: Client;
414 /**
415 * Initializes a client with the given instrumentation key, if this is not specified, the value will be
416 * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY
417 * @returns {ApplicationInsights/Client} a new client
418 */
419 getClient(instrumentationKey?: string): Client;
420 /**
421 * Initializes the default client of the client and sets the default configuration
422 * @param instrumentationKey the instrumentation key to use. Optional, if this is not specified, the value will be
423 * read from the environment variable APPINSIGHTS_INSTRUMENTATIONKEY
424 * @returns {ApplicationInsights} this interface
425 */
426 setup(instrumentationKey?: string): ApplicationInsights;
427 /**
428 * Starts automatic collection of telemetry. Prior to calling start no telemetry will be collected
429 * @returns {ApplicationInsights} this interface
430 */
431 start(): ApplicationInsights;
432 /**
433 * Sets the state of console tracking (enabled by default)
434 * @param value if true console activity will be sent to Application Insights
435 * @returns {ApplicationInsights} this interface
436 */
437 setAutoCollectConsole(value: boolean): ApplicationInsights;
438 /**
439 * Sets the state of exception tracking (enabled by default)
440 * @param value if true uncaught exceptions will be sent to Application Insights
441 * @returns {ApplicationInsights} this interface
442 */
443 setAutoCollectExceptions(value: boolean): ApplicationInsights;
444 /**
445 * Sets the state of performance tracking (enabled by default)
446 * @param value if true performance counters will be collected every second and sent to Application Insights
447 * @returns {ApplicationInsights} this interface
448 */
449 setAutoCollectPerformance(value: boolean): ApplicationInsights;
450 /**
451 * Sets the state of request tracking (enabled by default)
452 * @param value if true requests will be sent to Application Insights
453 * @returns {ApplicationInsights} this interface
454 */
455 setAutoCollectRequests(value: boolean): ApplicationInsights;
456 /**
457 * Enables verbose debug logging
458 * @returns {ApplicationInsights} this interface
459 */
460 enableVerboseLogging(): ApplicationInsights;
461
462 setOfflineMode(value: boolean): ApplicationInsights;
463}
464
465declare module "applicationinsights" {
466 const applicationinsights: ApplicationInsights;
467 export = applicationinsights;
468}