Files
qwen-code/packages/core/src/telemetry/index.ts
2025-10-23 09:27:04 +08:00

100 lines
2.4 KiB
TypeScript

/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
export enum TelemetryTarget {
GCP = 'gcp',
LOCAL = 'local',
QWEN = 'qwen',
}
const DEFAULT_TELEMETRY_TARGET = TelemetryTarget.LOCAL;
const DEFAULT_OTLP_ENDPOINT = 'http://localhost:4317';
export { DEFAULT_TELEMETRY_TARGET, DEFAULT_OTLP_ENDPOINT };
export {
initializeTelemetry,
shutdownTelemetry,
isTelemetrySdkInitialized,
} from './sdk.js';
export {
resolveTelemetrySettings,
parseBooleanEnvFlag,
parseTelemetryTargetValue,
} from './config.js';
export {
logCliConfiguration,
logUserPrompt,
logToolCall,
logApiRequest,
logApiError,
logApiCancel,
logApiResponse,
logFlashFallback,
logSlashCommand,
logConversationFinishedEvent,
logKittySequenceOverflow,
logChatCompression,
logToolOutputTruncated,
logExtensionEnable,
logExtensionInstallEvent,
logExtensionUninstall,
logRipgrepFallback,
logNextSpeakerCheck,
} from './loggers.js';
export type { SlashCommandEvent, ChatCompressionEvent } from './types.js';
export {
SlashCommandStatus,
EndSessionEvent,
UserPromptEvent,
ApiRequestEvent,
ApiErrorEvent,
ApiResponseEvent,
ApiCancelEvent,
FlashFallbackEvent,
StartSessionEvent,
ToolCallEvent,
ConversationFinishedEvent,
KittySequenceOverflowEvent,
ToolOutputTruncatedEvent,
RipgrepFallbackEvent,
NextSpeakerCheckEvent,
} from './types.js';
export { makeSlashCommandEvent, makeChatCompressionEvent } from './types.js';
export type { TelemetryEvent } from './types.js';
export { SpanStatusCode, ValueType } from '@opentelemetry/api';
export { SemanticAttributes } from '@opentelemetry/semantic-conventions';
export * from './uiTelemetry.js';
export {
// Core metrics functions
recordToolCallMetrics,
recordTokenUsageMetrics,
recordApiResponseMetrics,
recordApiErrorMetrics,
recordFileOperationMetric,
recordInvalidChunk,
recordContentRetry,
recordContentRetryFailure,
// Performance monitoring functions
recordStartupPerformance,
recordMemoryUsage,
recordCpuUsage,
recordToolQueueDepth,
recordToolExecutionBreakdown,
recordTokenEfficiency,
recordApiRequestBreakdown,
recordPerformanceScore,
recordPerformanceRegression,
recordBaselineComparison,
isPerformanceMonitoringActive,
// Performance monitoring types
PerformanceMetricType,
MemoryMetricType,
ToolExecutionPhase,
ApiRequestPhase,
FileOperation,
} from './metrics.js';
export { QwenLogger } from './qwen-logger/qwen-logger.js';