UNPKG

1.58 kBTypeScriptView Raw
1import { PortablePath } from '@yarnpkg/fslib';
2import { Configuration } from './Configuration';
3export declare enum MetricName {
4 VERSION = "version",
5 COMMAND_NAME = "commandName",
6 PLUGIN_NAME = "pluginName",
7 INSTALL_COUNT = "installCount",
8 PROJECT_COUNT = "projectCount",
9 WORKSPACE_COUNT = "workspaceCount",
10 DEPENDENCY_COUNT = "dependencyCount",
11 EXTENSION = "packageExtension"
12}
13export declare type RegistryBlock = {
14 values?: {
15 [key in MetricName]?: Array<string>;
16 };
17 hits?: {
18 [key in MetricName]?: {
19 [extra: string]: number;
20 };
21 };
22 enumerators?: {
23 [key in MetricName]?: Array<string>;
24 };
25};
26export declare type RegistryFile = {
27 lastUpdate?: number;
28 blocks?: {
29 [userId: string]: RegistryBlock;
30 };
31};
32export declare class TelemetryManager {
33 private configuration;
34 private values;
35 private hits;
36 private enumerators;
37 isNew: boolean;
38 constructor(configuration: Configuration, accountId: string);
39 reportVersion(value: string): void;
40 reportCommandName(value: string): void;
41 reportPluginName(value: string): void;
42 reportProject(cwd: PortablePath): void;
43 reportInstall(nodeLinker: string): void;
44 reportPackageExtension(value: string): void;
45 reportWorkspaceCount(count: number): void;
46 reportDependencyCount(count: number): void;
47 private reportValue;
48 private reportEnumerator;
49 private reportHit;
50 private getRegistryPath;
51 private sendReport;
52 private applyChanges;
53 private startBuffer;
54}