* Reads telemetry from the process.
(
cdp: Cdp.Api,
run: IRunData<T>,
)
| 530 | * Reads telemetry from the process. |
| 531 | */ |
| 532 | protected async gatherTelemetryFromCdp( |
| 533 | cdp: Cdp.Api, |
| 534 | run: IRunData<T>, |
| 535 | ): Promise<IProcessTelemetry | undefined> { |
| 536 | for (let retries = 0; retries < 8; retries++) { |
| 537 | const telemetry = await cdp.Runtime.evaluate({ |
| 538 | contextId: 1, |
| 539 | returnByValue: true, |
| 540 | // note: for some bizarre reason, if launched with --inspect-brk, the |
| 541 | // process.pid in extension host debugging is initially undefined. |
| 542 | expression: |
| 543 | `typeof process === 'undefined' || process.pid === undefined ? 'process not defined' : ({ processId: process.pid, nodeVersion: process.version, architecture: process.arch })` |
| 544 | + getSourceSuffix(), |
| 545 | }); |
| 546 | |
| 547 | if (!this.program) { |
| 548 | return; // shut down |
| 549 | } |
| 550 | |
| 551 | if (!telemetry || !telemetry.result || !telemetry.result.value) { |
| 552 | this.logger.error(LogTag.RuntimeTarget, 'Undefined result getting telemetry'); |
| 553 | return; |
| 554 | } |
| 555 | |
| 556 | if (typeof telemetry.result.value !== 'object') { |
| 557 | this.logger.info(LogTag.RuntimeTarget, 'Process not yet defined, will retry'); |
| 558 | await delay(50 * 2 ** retries); |
| 559 | continue; |
| 560 | } |
| 561 | |
| 562 | const result = telemetry.result.value as IProcessTelemetry; |
| 563 | run.context.telemetryReporter.report('nodeRuntime', { |
| 564 | version: result.nodeVersion, |
| 565 | arch: result.architecture, |
| 566 | }); |
| 567 | this.program.gotTelemetery(result); |
| 568 | |
| 569 | return result; |
| 570 | } |
| 571 | |
| 572 | return undefined; |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | function readEnvFile(file: string): { [key: string]: string } { |
nothing calls this directly
no test coverage detected