feat: add os platform and version in log report (#1053)

This commit is contained in:
tanzhenxin
2025-11-18 13:43:17 +08:00
committed by GitHub
parent 0eeffc6875
commit 5bc309b3dc
3 changed files with 50 additions and 1 deletions

View File

@@ -6,6 +6,7 @@
import { Buffer } from 'buffer';
import * as https from 'https';
import * as os from 'node:os';
import { HttpsProxyAgent } from 'https-proxy-agent';
import type {
@@ -45,6 +46,7 @@ import type {
RumResourceEvent,
RumExceptionEvent,
RumPayload,
RumOS,
} from './event-types.js';
import type { Config } from '../../config/config.js';
import { safeJsonStringify } from '../../utils/safeJsonStringify.js';
@@ -214,9 +216,17 @@ export class QwenLogger {
return this.createRumEvent('exception', type, name, properties);
}
private getOsMetadata(): RumOS {
return {
type: os.platform(),
version: os.release(),
};
}
async createRumPayload(): Promise<RumPayload> {
const authType = this.config?.getAuthType();
const version = this.config?.getCliVersion() || 'unknown';
const osMetadata = this.getOsMetadata();
return {
app: {
@@ -235,6 +245,7 @@ export class QwenLogger {
id: this.sessionId,
name: 'qwen-code-cli',
},
os: osMetadata,
events: this.events.toArray() as RumEvent[],
properties: {