Browse Source

Adds more typings

main
Eric Amodio 1 year ago
parent
commit
c65b6fded3
2 changed files with 22 additions and 3 deletions
  1. +18
    -0
      src/constants.ts
  2. +4
    -3
      src/telemetry/telemetry.ts

+ 18
- 0
src/constants.ts View File

@ -470,3 +470,21 @@ export const enum Schemes {
VslsScc = 'vsls-scc', VslsScc = 'vsls-scc',
Virtual = 'vscode-vfs', Virtual = 'vscode-vfs',
} }
export type TelemetryEvents =
| 'account/validation/failed'
| 'activate'
| 'command'
| 'command/core'
| 'remoteProviders/connected'
| 'remoteProviders/disconnected'
| 'providers/changed'
| 'providers/context'
| 'providers/registrationComplete'
| 'repositories/changed'
| 'repositories/visibility'
| 'repository/opened'
| 'repository/visibility'
| 'subscription'
| 'subscription/changed'
| 'usage/track';

+ 4
- 3
src/telemetry/telemetry.ts View File

@ -3,6 +3,7 @@ import type { Disposable } from 'vscode';
import { version as codeVersion, env } from 'vscode'; import { version as codeVersion, env } from 'vscode';
import { getProxyAgent } from '@env/fetch'; import { getProxyAgent } from '@env/fetch';
import { getPlatform } from '@env/platform'; import { getPlatform } from '@env/platform';
import type { TelemetryEvents } from '../constants';
import type { Container } from '../container'; import type { Container } from '../container';
import { configuration } from '../system/configuration'; import { configuration } from '../system/configuration';
@ -30,7 +31,7 @@ export interface TelemetryProvider extends Disposable {
interface QueuedEvent { interface QueuedEvent {
type: 'sendEvent'; type: 'sendEvent';
name: string;
name: TelemetryEvents;
data?: Record<string, AttributeValue | null | undefined>; data?: Record<string, AttributeValue | null | undefined>;
global: Map<string, AttributeValue>; global: Map<string, AttributeValue>;
startTime: TimeInput; startTime: TimeInput;
@ -129,7 +130,7 @@ export class TelemetryService implements Disposable {
} }
sendEvent( sendEvent(
name: string,
name: TelemetryEvents,
data?: Record<string, AttributeValue | null | undefined>, data?: Record<string, AttributeValue | null | undefined>,
startTime?: TimeInput, startTime?: TimeInput,
endTime?: TimeInput, endTime?: TimeInput,
@ -152,7 +153,7 @@ export class TelemetryService implements Disposable {
} }
startEvent( startEvent(
name: string,
name: TelemetryEvents,
data?: Record<string, AttributeValue | null | undefined>, data?: Record<string, AttributeValue | null | undefined>,
startTime?: TimeInput, startTime?: TimeInput,
): Disposable | undefined { ): Disposable | undefined {

Loading…
Cancel
Save