Custom Tracking Reporter

Overview

OpenSumi provides built-in tracking report, which provides integrators with some key performance data, including key IDE data indicators and one party's core extensions. Integrators can report the data to their own platform.

Frontend Module Usage

import { IReporterService } from '@opensumi/ide-core-browser';

@Injectable()
class {
  @Autowired(IReporterService)
  reporterService: IReporterService

  async activateExtension() {
    ...
    const timer = reporterService.time(REPORT_NAME.ACTIVE_EXTENSION);
    ...
    timer.timeEnd(extension.extensionId)
  }
}

Back-end Module Usage

import { IReporterService } from '@opensumi/ide-core-node';

@Injectable()
class {
  @Autowired(IReporterService)
  reporterService: IReporterService

  async activateExtension() {
    ...
    reporterService.point(REPORT_NAME.ACTIVE_EXTENSION, extension.extensionId);
  }
}

Extension Usage

import { reporter } from 'sumi';

activate() {
  ...
  const reporterTimer = reporter.time(`ts-load`);
  func();
  reporterTimer.timeEnd(`ts-load`);
}

function deactivate() {
   reporter.dispose();
}

Report

The integrator implements this by replacing the built-in Provider

import {
  PointData,
  PerformanceData,
  IReporter
} from '@opensumi/ide-core-browser';

@Injectable()
class Reporter implements IReporter {
  performance(name: string, data: PerformanceData) {}

  point(name: string, data: PointData) {}
}

injector.addProviders({
  token: IReporter,
  useClass: Reporter
});

Appendix

Inner Frame Tracking records

NameTypemsgNote
activateExtensionperformanceextensionIdextension activation time tracking
loadExtensionMainperformanceextensionIdtime to load the main JS extension
provideCompletionItemsperformancemodel.uri.toString()obtain the completion time tracking
data.extra.extDuration can obtain the duration time in the extension process
channelReconnectpointnullreconnect time tracking
measureperformancephase namethe time to start each phase of life cycle execution, where the msg format mainly includes: 1. each module life cycle duration: ${ModuleConstructName}.(initialize | onStart | onDidStart) 2. length of all module lifecycle: Contributions.(initialize | onStart | start)3.framework state ready duration::Framework.ready 4. length of execution of methods within each class: :${ClassConstructName}.${methodName}
provideHoverperformanceuri extnamecall duration tracking
provideDefinitionperformanceuri extnamecall duration tracking
provideTypeDefinitionperformanceuri extnamecall duration tracking
provideFoldingRangesperformanceuri extnamecall duration tracking
provideDocumentColorsperformanceuri extnamecall duration tracking
provideColorPresentationsperformanceuri extnamecall duration tracking
provideDocumentHighlightsperformanceuri extnamecall duration tracking
provideLinksperformanceuri extnamecall duration tracking
provideReferencesperformanceuri extnamecall duration tracking
provideDocumentSymbolsperformanceuri extnamecall duration tracking
provideImplementationperformanceuri extnamecall duration tracking
provideCodeActionsperformanceuri extnamecall duration tracking
provideRenameEditsperformanceuri extnamecall duration tracking
provideSignatureHelpperformanceuri extnamecall duration tracking
provideCodeLensesperformanceuri extnamecall duration tracking
resolveCodeLenspointnullnumber of calls
provideOnTypeFormattingEditsperformanceuri extnamecall duration tracking
provideSelectionRangesperformanceuri extnamecall duration tracking