1 | import * as Contracts from "../declarations/contracts";
|
2 | import { TelemetryItem as Envelope } from "../declarations/generated";
|
3 | import { Context } from "./context";
|
4 | import Config = require("./shim-config");
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | export declare class TelemetryClient {
|
10 | context: Context;
|
11 | commonProperties: {
|
12 | [key: string]: string;
|
13 | };
|
14 | config: Config;
|
15 | private _attributeSpanProcessor;
|
16 | private _attributeLogProcessor;
|
17 | private _logApi;
|
18 | private _isInitialized;
|
19 | private _options;
|
20 | private _configWarnings;
|
21 | |
22 |
|
23 |
|
24 |
|
25 | constructor(input?: string);
|
26 | initialize(): void;
|
27 | /**
|
28 | * Log information about availability of an application
|
29 | * @param telemetry Object encapsulating tracking options
|
30 | */
|
31 | trackAvailability(telemetry: Contracts.AvailabilityTelemetry): void;
|
32 | /**
|
33 | * Log a page view
|
34 | * @param telemetry Object encapsulating tracking options
|
35 | */
|
36 | trackPageView(telemetry: Contracts.PageViewTelemetry): void;
|
37 | /**
|
38 | * Log a trace message
|
39 | * @param telemetry Object encapsulating tracking options
|
40 | */
|
41 | trackTrace(telemetry: Contracts.TraceTelemetry): void;
|
42 | /**
|
43 | * Log an exception
|
44 | * @param telemetry Object encapsulating tracking options
|
45 | */
|
46 | trackException(telemetry: Contracts.ExceptionTelemetry): void;
|
47 | /**
|
48 | * Log a user action or other occurrence.
|
49 | * @param telemetry Object encapsulating tracking options
|
50 | */
|
51 | trackEvent(telemetry: Contracts.EventTelemetry): void;
|
52 | /**
|
53 | * Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
|
54 | * To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
|
55 | * telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals.
|
56 | * @param telemetry Object encapsulating tracking options
|
57 | */
|
58 | trackMetric(telemetry: Contracts.MetricPointTelemetry & Contracts.MetricTelemetry): void;
|
59 | /**
|
60 | * Log a request. Note that the default client will attempt to collect HTTP requests automatically so only use this for requests
|
61 | * that aren't automatically captured or if you've disabled automatic request collection.
|
62 | *
|
63 | * @param telemetry Object encapsulating tracking options
|
64 | */
|
65 | trackRequest(telemetry: Contracts.RequestTelemetry): void;
|
66 | /**
|
67 | * Log a dependency. Note that the default client will attempt to collect dependencies automatically so only use this for dependencies
|
68 | * that aren't automatically captured or if you've disabled automatic dependency collection.
|
69 | *
|
70 | * @param telemetry Object encapsulating tracking option
|
71 | * */
|
72 | trackDependency(telemetry: Contracts.DependencyTelemetry): void;
|
73 | /**
|
74 | * Generic track method for all telemetry types
|
75 | * @param data the telemetry to send
|
76 | * @param telemetryType specify the type of telemetry you are tracking from the list of Contracts.DataTypes
|
77 | */
|
78 | track(telemetry: Contracts.Telemetry, telemetryType: Contracts.TelemetryType): void;
|
79 | /**
|
80 | * Automatically populate telemetry properties like RoleName when running in Azure
|
81 | *
|
82 | * @param value if true properties will be populated
|
83 | */
|
84 | setAutoPopulateAzureProperties(): void;
|
85 | /**
|
86 | * Get Authorization handler
|
87 | */
|
88 | getAuthorizationHandler(config: Config): void;
|
89 | getStatsbeat(): any;
|
90 | setUseDiskRetryCaching(value: boolean, resendInterval?: number, maxBytesOnDisk?: number): void;
|
91 | /**
|
92 | * Adds telemetry processor to the collection. Telemetry processors will be called one by one
|
93 | * before telemetry item is pushed for sending and in the order they were added.
|
94 | *
|
95 | * @param telemetryProcessor function, takes Envelope, and optional context object and returns boolean
|
96 | */
|
97 | addTelemetryProcessor(telemetryProcessor: (envelope: Envelope, contextObjects?: {
|
98 | [name: string]: any;
|
99 | }) => boolean): void;
|
100 | clearTelemetryProcessors(): void;
|
101 | trackNodeHttpRequestSync(telemetry: Contracts.NodeHttpRequestTelemetry): void;
|
102 | trackNodeHttpRequest(telemetry: Contracts.NodeHttpRequestTelemetry): void;
|
103 | trackNodeHttpDependency(telemetry: Contracts.NodeHttpRequestTelemetry): void;
|
104 | /**
|
105 | * Immediately send all queued telemetry.
|
106 | */
|
107 | flush(): Promise<void>;
|
108 | /**
|
109 | * Shutdown client
|
110 | */
|
111 | shutdown(): Promise<void>;
|
112 | pushWarningToLog(warning: string): void;
|
113 | }
|