chore: task management and formatting.
This commit is contained in:
@@ -5028,8 +5028,8 @@
|
||||
{
|
||||
"id": 12,
|
||||
"title": "Telemetry Integration for analyze-task-complexity",
|
||||
"description": "Integrate AI usage telemetry capture and propagation for the analyze-task-complexity functionality.",
|
||||
"details": "\\\nApply telemetry pattern from telemetry.mdc:\n\n1. **Core (`scripts/modules/task-manager/analyze-task-complexity.js`):**\n * Modify AI service call to include `commandName: \\'analyze-complexity\\'` and `outputType`.\n * Receive `{ mainResult, telemetryData }`.\n * Return object including `telemetryData` (perhaps alongside the complexity report data).\n * Handle CLI display via `displayAiUsageSummary` if applicable.\n\n2. **Direct (`mcp-server/src/core/direct-functions/analyze-task-complexity.js`):**\n * Pass `commandName`, `outputType: \\'mcp\\'` to core.\n * Pass `outputFormat: \\'json\\'` if applicable.\n * Receive `{ ..., telemetryData }` from core.\n * Return `{ success: true, data: { ..., telemetryData } }`.\n\n3. **Tool (`mcp-server/src/tools/analyze.js`):**\n * Verify `handleApiResult` correctly passes `data.telemetryData` through.\n",
|
||||
"description": "Integrate AI usage telemetry capture and propagation for the analyze-task-complexity functionality. [Updated: 5/9/2025]",
|
||||
"details": "\\\nApply telemetry pattern from telemetry.mdc:\n\n1. **Core (`scripts/modules/task-manager/analyze-task-complexity.js`):**\n * Modify AI service call to include `commandName: \\'analyze-complexity\\'` and `outputType`.\n * Receive `{ mainResult, telemetryData }`.\n * Return object including `telemetryData` (perhaps alongside the complexity report data).\n * Handle CLI display via `displayAiUsageSummary` if applicable.\n\n2. **Direct (`mcp-server/src/core/direct-functions/analyze-task-complexity.js`):**\n * Pass `commandName`, `outputType: \\'mcp\\'` to core.\n * Pass `outputFormat: \\'json\\'` if applicable.\n * Receive `{ ..., telemetryData }` from core.\n * Return `{ success: true, data: { ..., telemetryData } }`.\n\n3. **Tool (`mcp-server/src/tools/analyze.js`):**\n * Verify `handleApiResult` correctly passes `data.telemetryData` through.\n\n<info added on 2025-05-09T04:02:44.847Z>\n## Implementation Details for Telemetry Integration\n\n### Best Practices for Implementation\n\n1. **Use Structured Telemetry Objects:**\n - Create a standardized `TelemetryEvent` object with fields:\n ```javascript\n {\n commandName: string, // e.g., 'analyze-complexity'\n timestamp: ISO8601 string,\n duration: number, // in milliseconds\n inputTokens: number,\n outputTokens: number,\n model: string, // e.g., 'gpt-4'\n success: boolean,\n errorType?: string, // if applicable\n metadata: object // command-specific context\n }\n ```\n\n2. **Asynchronous Telemetry Processing:**\n - Use non-blocking telemetry submission to avoid impacting performance\n - Implement queue-based processing for reliability during network issues\n\n3. **Error Handling:**\n - Implement robust try/catch blocks around telemetry operations\n - Ensure telemetry failures don't affect core functionality\n - Log telemetry failures locally for debugging\n\n4. **Privacy Considerations:**\n - Never include PII or sensitive data in telemetry\n - Implement data minimization principles\n - Add sanitization functions for metadata fields\n\n5. **Testing Strategy:**\n - Create mock telemetry endpoints for testing\n - Add unit tests verifying correct telemetry data structure\n - Implement integration tests for end-to-end telemetry flow\n\n### Code Implementation Examples\n\n```javascript\n// Example telemetry submission function\nasync function submitTelemetry(telemetryData, endpoint) {\n try {\n // Non-blocking submission\n fetch(endpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(telemetryData)\n }).catch(err => console.error('Telemetry submission failed:', err));\n } catch (error) {\n // Log locally but don't disrupt main flow\n console.error('Telemetry error:', error);\n }\n}\n\n// Example integration in AI service call\nasync function callAiService(params) {\n const startTime = Date.now();\n try {\n const result = await aiService.call({\n ...params,\n commandName: 'analyze-complexity',\n outputType: 'mcp'\n });\n \n // Construct telemetry object\n const telemetryData = {\n commandName: 'analyze-complexity',\n timestamp: new Date().toISOString(),\n duration: Date.now() - startTime,\n inputTokens: result.usage?.prompt_tokens || 0,\n outputTokens: result.usage?.completion_tokens || 0,\n model: result.model || 'unknown',\n success: true,\n metadata: {\n taskId: params.taskId,\n // Add other relevant non-sensitive metadata\n }\n };\n \n return { mainResult: result.data, telemetryData };\n } catch (error) {\n // Error telemetry\n const telemetryData = {\n commandName: 'analyze-complexity',\n timestamp: new Date().toISOString(),\n duration: Date.now() - startTime,\n success: false,\n errorType: error.name,\n metadata: {\n taskId: params.taskId,\n errorMessage: sanitizeErrorMessage(error.message)\n }\n };\n \n // Re-throw the original error after capturing telemetry\n throw error;\n }\n}\n```\n</info added on 2025-05-09T04:02:44.847Z>",
|
||||
"status": "done",
|
||||
"dependencies": [],
|
||||
"parentTaskId": 77
|
||||
|
||||
Reference in New Issue
Block a user