Skip to content

feat: Export functionality for CSV and JSON formats #12

@rlaope

Description

@rlaope

Problem

Users cannot export captured event data for:

  • External analysis in tools like Excel, pandas, or Grafana
  • Sharing with team members
  • Archiving for later review
  • Integration with other monitoring systems

Proposed Solution

Add export functionality supporting multiple formats:

  1. CSV export for spreadsheet analysis
  2. JSON export for programmatic processing
  3. Filtered exports (by time range, event type)
  4. Download from dashboard UI

Acceptance Criteria

  • Add /export API endpoint
  • Support CSV format with configurable columns
  • Support JSON format (array of events)
  • Support JSON Lines format for streaming
  • Add time range filtering (from, to parameters)
  • Add event type filtering
  • Add "Export" button to dashboard
  • Include metadata header in exports

API Design

GET /export?format=csv&from=2024-01-01T00:00:00Z&to=2024-01-02T00:00:00Z&type=PINNED

Response Headers:
Content-Type: text/csv
Content-Disposition: attachment; filename="argus-export-2024-01-01.csv"

CSV Format

timestamp,event_type,thread_id,thread_name,carrier_thread,duration_ns
2024-01-01T00:00:00.123Z,VIRTUAL_THREAD_START,123,VT-1,1,
2024-01-01T00:00:00.456Z,VIRTUAL_THREAD_END,123,VT-1,1,333000000
2024-01-01T00:00:00.789Z,VIRTUAL_THREAD_PINNED,124,VT-2,2,

JSON Format

{
  "exportedAt": "2024-01-01T12:00:00Z",
  "query": {
    "from": "2024-01-01T00:00:00Z",
    "to": "2024-01-02T00:00:00Z",
    "type": null
  },
  "totalEvents": 15234,
  "events": [
    {
      "timestamp": "2024-01-01T00:00:00.123Z",
      "eventType": "VIRTUAL_THREAD_START",
      "threadId": 123,
      "threadName": "VT-1",
      "carrierThread": 1
    }
  ]
}

UI Mockup

┌─────────────────────────────────────────────────────────────┐
│ Export Data                                         [X]     │
├─────────────────────────────────────────────────────────────┤
│ Format:    ○ CSV  ○ JSON  ○ JSON Lines                     │
│                                                             │
│ Time Range:                                                 │
│   From: [2024-01-01 00:00] To: [2024-01-02 00:00]          │
│                                                             │
│ Event Types:                                                │
│   [x] START  [x] END  [x] PINNED  [ ] SUBMIT_FAILED        │
│                                                             │
│                              [Cancel]  [Download Export]    │
└─────────────────────────────────────────────────────────────┘

Technical Considerations

  • Stream large exports to avoid memory issues
  • Consider compression for large exports (gzip)
  • Rate limit export requests
  • Add export to recent events buffer if persistence is disabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions