How newrelic/newrelic-browser-agent works
Main Components
a. Core Agent Components:
• Browser Agent (main entry point)
• Micro Agent (lightweight version)
• Base Agent (customizable version)
• Feature Modules System
b. Feature Modules Layer:
• Ajax Monitoring
• JavaScript Error Tracking
• Metrics Collection
• Page View Events
• Session Replay
• SPA Monitoring
• Session Trace
• Generic Events
c. Common Infrastructure Layer:
• Configuration Management
• Event Aggregation
• Data Collection
• Storage Handling
• Timer Management
• URL Management
d. Integration Points:
• New Relic Backend Services
• Browser APIs
• DOM Interface
• Network Monitoring
┌─ Browser Environment ──────────────────────────────────────────┐
• ┌─ Browser Agent Instance ─────────────────────────┐ │
• ┌─ Core Services ─────┐ ┌─ Feature Modules ─┐ │ │
• Configuration │ │- Ajax │ │ │
• Event Emission │ │- JSErrors │ │ │
• Harvesting │ │- Metrics │ │ │
• Session Management │ │- Page View Event │ │ DOM │
• ┬─┘ │- Session Replay │ │ │
• SPA │ │ │
• ┌─ Common Layer ─┐ │ └────────┬─────────┘ │ │
• Aggregation │ │ │ │ │
• Storage │ │ │ │ │
• Timing │ │ │ │ │
• URL Handling │ │ │ │ │
• ┬┘ │ │ │ │
• ┘ │
• ┌─ Browser APIs ───┼───┼──────────────┼──────────────┐ │
• Performance │ │ │ │ │
• Network │ │ │ │ │
• Storage │ │ │ │ │
• ┘ │
• ┘
┌─ New Relic Backend ─│───│──────────────│──────────────────────┐
• ▼ ▼ ▼ │
• ┌─ Data Collection and Processing ─────────────────┐ │
• ┘ │
• ┘
Important Relationships
• Data flow from feature modules to core services
• Event propagation paths
• Integration points with browser APIs
• Communication channels with New Relic backend
Implementation Details
• Version/compatibility information
• Security boundaries
Performance Aspects
• Harvesting paths
• Data aggregation points
• Monitoring checkpoints
• Performance-critical paths
• Nested components
• Different line styles
• Clear text labels
• Export to common formats