feat: add usage statistics logging for Qwen integration

This commit is contained in:
tanzhenxin
2025-08-11 22:13:56 +08:00
parent 96a9b683b2
commit c96852dc56
8 changed files with 608 additions and 22 deletions

View File

@@ -9,11 +9,12 @@
*/
import { describe, it, expect } from 'vitest';
import { ClearcutLogger } from './clearcut-logger/clearcut-logger.js';
import { QwenLogger } from './qwen-logger/qwen-logger.js';
import { RumEvent } from './qwen-logger/event-types.js';
import { Config } from '../config/config.js';
describe('Circular Reference Integration Test', () => {
it('should handle HttpsProxyAgent-like circular references in clearcut logging', () => {
it('should handle HttpsProxyAgent-like circular references in qwen logging', () => {
// Create a mock config with proxy
const mockConfig = {
getTelemetryEnabled: () => true,
@@ -44,16 +45,18 @@ describe('Circular Reference Integration Test', () => {
proxyAgentLike.sockets['cloudcode-pa.googleapis.com:443'] = [socketLike];
// Create an event that would contain this circular structure
const problematicEvent = {
const problematicEvent: RumEvent = {
timestamp: Date.now(),
event_type: 'exception',
error: new Error('Network error'),
function_args: {
filePath: '/test/file.txt',
httpAgent: proxyAgentLike, // This would cause the circular reference
},
};
} as RumEvent;
// Test that ClearcutLogger can handle this
const logger = ClearcutLogger.getInstance(mockConfig);
// Test that QwenLogger can handle this
const logger = QwenLogger.getInstance(mockConfig);
expect(() => {
logger?.enqueueLogEvent(problematicEvent);