(options: EventSinkContextOptions)
| 97 | } |
| 98 | |
| 99 | function buildContext(options: EventSinkContextOptions): TelemetryContext { |
| 100 | const env = options.env ?? process.env; |
| 101 | const context: TelemetryContext = { |
| 102 | app_name: options.appName, |
| 103 | version: options.version, |
| 104 | runtime: 'node', |
| 105 | platform: platform(), |
| 106 | arch: arch(), |
| 107 | node_version: process.versions.node, |
| 108 | os_version: release(), |
| 109 | ci: env['CI'] !== undefined, |
| 110 | locale: options.locale ?? env['LANG'] ?? '', |
| 111 | terminal: options.terminal ?? env['TERM_PROGRAM'] ?? '', |
| 112 | ui_mode: options.uiMode ?? 'shell', |
| 113 | }; |
| 114 | setPrimitive(context, 'model', options.model); |
| 115 | setPrimitive(context, 'build_sha', options.buildSha); |
| 116 | return context; |
| 117 | } |
| 118 | |
| 119 | function setPrimitive( |
| 120 | target: TelemetryContext, |
no test coverage detected