MCPcopy Create free account
hub / github.com/microsoft/typescript-go / StartPerformanceTelemetry

Method StartPerformanceTelemetry

internal/project/session.go:583–604  ·  view source on GitHub ↗

StartPerformanceTelemetry begins periodic collection and sending of performance telemetry. It should be called once after the session is initialized.

()

Source from the content-addressed store, hash-verified

581// StartPerformanceTelemetry begins periodic collection and sending of performance
582// telemetry. It should be called once after the session is initialized.
583func (s *Session) StartPerformanceTelemetry() {
584 if !s.options.TelemetryEnabled {
585 return
586 }
587 ctx, cancel := context.WithCancel(s.backgroundCtx)
588 s.performanceTelemetryCancel = cancel
589 s.backgroundQueue.Enqueue(ctx, func(ctx context.Context) {
590 ticker := time.NewTicker(performanceTelemetryInterval)
591 defer ticker.Stop()
592 for {
593 select {
594 case <-ctx.Done():
595 return
596 case <-ticker.C:
597 if s.client == nil || !s.client.IsActive() {
598 continue
599 }
600 s.sendPerformanceTelemetry(ctx)
601 }
602 }
603 })
604}
605
606func (s *Session) stopPerformanceTelemetry() {
607 if s.performanceTelemetryCancel != nil {

Callers 1

handleInitializedMethod · 0.80

Calls 4

EnqueueMethod · 0.80
StopMethod · 0.80
IsActiveMethod · 0.65

Tested by

no test coverage detected