Files
czlonkowski--n8n-mcp/scripts/test-error-message-tracking.ts
wehub-resource-sync 409e92d6ae
Build and Push Docker Images / Build Docker Image (push) Has been cancelled
Build and Push Docker Images / Build Railway Docker Image (push) Has been cancelled
Build and Publish n8n Docker Image / test-image (push) Has been cancelled
Dependency Compatibility Check / Fresh Install Dependency Check (push) Has been cancelled
Build and Publish n8n Docker Image / build-and-push (push) Has been cancelled
Build and Publish n8n Docker Image / create-release (push) Has been cancelled
Automated Release / Detect Version Change (push) Has been cancelled
Automated Release / Generate Release Notes (push) Has been cancelled
Automated Release / Create GitHub Release (push) Has been cancelled
Automated Release / Package MCPB Bundle (push) Has been cancelled
Automated Release / Build and Verify (push) Has been cancelled
Automated Release / Publish to NPM (push) Has been cancelled
Automated Release / Build and Push Docker Images (push) Has been cancelled
Automated Release / Update Documentation (push) Has been cancelled
Automated Release / Notify Release Completion (push) Has been cancelled
Secret Scan / secretlint (push) Has been cancelled
Test Suite / test (push) Has been cancelled
Test Suite / cjs-runtime (push) Has been cancelled
Test Suite / publish-results (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:41:06 +08:00

59 lines
1.8 KiB
TypeScript

/**
* Test script to verify error message tracking is working
*/
import { telemetry } from '../src/telemetry';
async function testErrorTracking() {
console.log('=== Testing Error Message Tracking ===\n');
// Track session first
console.log('1. Starting session...');
telemetry.trackSessionStart();
// Track an error WITH a message
console.log('\n2. Tracking error WITH message:');
const testErrorMessage = 'This is a test error message with sensitive data: password=secret123 and test@example.com';
telemetry.trackError(
'TypeError',
'tool_execution',
'test_tool',
testErrorMessage
);
console.log(` Original message: "${testErrorMessage}"`);
// Track an error WITHOUT a message
console.log('\n3. Tracking error WITHOUT message:');
telemetry.trackError(
'Error',
'tool_execution',
'test_tool2'
);
// Check the event queue
const metrics = telemetry.getMetrics();
console.log('\n4. Telemetry metrics:');
console.log(' Status:', metrics.status);
console.log(' Events queued:', metrics.tracking.eventsQueued);
// Get raw event queue to inspect
const eventTracker = (telemetry as any).eventTracker;
const queue = eventTracker.getEventQueue();
console.log('\n5. Event queue contents:');
queue.forEach((event, i) => {
console.log(`\n Event ${i + 1}:`);
console.log(` - Type: ${event.event}`);
console.log(` - Properties:`, JSON.stringify(event.properties, null, 6));
});
// Flush to database
console.log('\n6. Flushing to database...');
await telemetry.flush();
console.log('\n7. Done! Check Supabase for error events with "error" field.');
console.log(' Query: SELECT * FROM telemetry_events WHERE event = \'error_occurred\' ORDER BY created_at DESC LIMIT 5;');
}
testErrorTracking().catch(console.error);