









Lightweight telemetry system for tracking events across the LightSpeed .github repository.
This telemetry infrastructure enables monitoring, debugging, and performance tracking of critical workflows including:
- Release agent changelog validation
- Metrics collection orchestration
- Metrics reporting generation
- Website theme toggle interactions
- Privacy-First: Clear separation between safe (anonymous) and restricted (detailed) properties
- Environment-Aware: Automatic detection of development, production, and test environments
- Multiple Backends: Support for console, file, and analytics service backends
- Zero-Impact: Telemetry failures never break application flow
- Schema Validation: Automatic property validation against event schemas
scripts/telemetry/
├── telemetry-client.js # Core telemetry client
├── event-schemas.js # Event definitions and validation schemas
└── __tests__/
└── telemetry-client.test.js # Unit tests
const { createTelemetryClient } = require('./scripts/telemetry/telemetry-client.js');
const { EVENT_SCHEMAS } = require('./scripts/telemetry/event-schemas.js');
// Create client
const telemetry = createTelemetryClient({
eventSchemas: EVENT_SCHEMAS
});
// Emit an event and flush (wrapped in async function to avoid top-level await)
(async () => {
telemetry.emit('release.validation.started', {
safe: {
component: 'release-agent',
version: '1.0.0'
},
restricted: {
repositoryName: 'lightspeedwp/.github'
}
});
// Flush (optional, for file backend)
await telemetry.flush();
})();// Simple inline telemetry for browser contexts
const telemetry = {
emit(eventType, properties) {
const event = {
eventType,
timestamp: new Date().toISOString(),
environment: 'browser',
...properties
};
console.log('[Telemetry]', event);
}
};
telemetry.emit('website.theme.toggled', {
safe: { fromTheme: 'light', toTheme: 'dark' }
});Emitted when release validation workflow begins.
Safe Properties:
component(required): Component nameversion(required): Version numbertrigger(optional): Trigger type (manual, dry-run, automated)
Restricted Properties:
repositoryName(required): Repository identifierchangelogPath(optional): Path to CHANGELOG.mdversionFile(optional): Path to VERSION file
Emitted when release validation completes successfully.
Safe Properties:
component(required): Component nameversion(required): Version numbervalidationDuration(required): Duration in millisecondsgatesPassed(optional): Number of gates passedwarningCount(optional): Number of warnings
Restricted Properties:
repositoryName(required): Repository identifierchangelogPath(optional): Path to CHANGELOG.mdvalidationResults(optional): JSON string of validation results
Emitted when a validation gate fails.
Safe Properties:
component(required): Component namegateName(required): Name of failed gatefailureReason(required): Reason for failureattemptNumber(optional): Attempt numberrecoverable(optional): Whether failure is recoverable
Restricted Properties:
repositoryName(required): Repository identifierchangelogPath(optional): Path to CHANGELOG.mderrorDetails(optional): Detailed error messagestackTrace(optional): Error stack trace
Emitted when metrics collection workflow begins.
Safe Properties:
repositoryCount(required): Number of repositoriescollectionType(required): Type of collection (manual, weekly, daily)scheduledRun(optional): Whether triggered by scheduletrigger(optional): Trigger source
Restricted Properties:
repositories(optional): Array of repository namesconfigPath(optional): Path to configuration file
Emitted when metrics collection completes.
Safe Properties:
repositoryCount(required): Total repositoriessuccessCount(required): Successful collectionsfailureCount(required): Failed collectionscollectionDuration(required): Duration in millisecondsmetricsCollected(optional): Total metrics collectedanomaliesDetected(optional): Anomalies found
Restricted Properties:
repositories(optional): Array of repository namesfailedRepositories(optional): Array of failed repositoriessummaryPath(optional): Path to summary report
Emitted when collection fails for a specific repository.
Safe Properties:
failureReason(required): Reason for failureattemptNumber(required): Attempt numberrecoverable(optional): Whether recoverableretryScheduled(optional): Whether retry is scheduled
Restricted Properties:
repository(required): Repository identifiererrorDetails(optional): Detailed error messageapiResponse(optional): API response codestackTrace(optional): Error stack trace
Emitted when a metrics report is successfully generated.
Safe Properties:
reportType(required): Type of reportperiod(required): Reporting period (weekly, monthly)metricsIncluded(required): Number of metricstrendsIncluded(optional): Whether trends includedanomaliesIncluded(optional): Whether anomalies includedgenerationDuration(optional): Duration in milliseconds
Restricted Properties:
repository(required): Repository identifierreportPath(optional): Path to report filefileSize(optional): Report file size in bytes
Emitted when user toggles website theme.
Safe Properties:
fromTheme(required): Previous themetoTheme(required): New thememethod(optional): Toggle method (user-click, auto, system)
Restricted Properties:
userAgent(optional): Browser user agentviewport(optional): Viewport dimensions
Emitted when theme storage fails (e.g., private browsing).
Safe Properties:
failureType(required): Type of failuretheme(optional): Theme that failed to savefallbackUsed(optional): Whether fallback was used
Restricted Properties:
storageError(optional): Storage error messagebrowserInfo(optional): Browser information
NODE_ENV: Environment (development, production, test)CI: Set to 'true' for CI/production environmentsTELEMETRY_INCLUDE_RESTRICTED: Set to 'true' to include restricted properties in production
The telemetry client automatically selects backends based on environment:
| Environment | Default Backend | Behavior |
|---|---|---|
| test | NONE | No output (silent) |
| development | CONSOLE | Logs to console |
| production | FILE | Writes to .github/reports/telemetry/ |
const telemetry = createTelemetryClient({
environment: 'production',
backend: 'file',
outputPath: './custom/telemetry/path',
eventSchemas: EVENT_SCHEMAS,
enabled: true
});Safe Properties:
- Anonymous, aggregated data
- Safe for all environments
- Always included in telemetry events
- Examples: counts, durations, types, status
Restricted Properties:
- May contain repository-specific or detailed information
- Included in development/test by default
- Excluded in production unless
TELEMETRY_INCLUDE_RESTRICTED=true - Examples: repository names, file paths, error details
- No PII: Never collect personally identifiable information
- Fail-Safe: Telemetry errors never break application flow
- Opt-Out: Can be disabled via
enabled: falseconfiguration - Transparent: All events documented with clear schemas
Run unit tests:
npm test scripts/telemetry/__tests__/telemetry-client.test.jsTest coverage targets 100% for scripts, including the telemetry client.
| File | Events | Description |
|---|---|---|
.github/agentic-workflows/release.agent.js |
3 | Release validation workflow |
scripts/workflows/metrics-collection-orchestrator.cjs |
3 | Metrics collection across repositories |
scripts/workflows/metrics-reporting-orchestrator.cjs |
1 | Metrics report generation |
website/src/scripts/theme-toggle.js |
0 (not yet instrumented) | Website theme toggle (browser) — prior instrumentation targeted a deleted duplicate at .github/website/, not the real site |
- Check environment: telemetry disabled in test mode by default
- Verify
enabled: truein configuration - Check output path permissions for file backend
- Ensure output directory exists and is writable
- Check disk space
- Verify no file system errors in logs
- Check required properties are provided
- Verify event type exists in EVENT_SCHEMAS
- Review property names match schema exactly
- Add schema to
event-schemas.js - Update this README with event documentation
- Add unit tests for the new event
- Instrument code to emit the event
- Update schema in
event-schemas.js - Update documentation
- Update existing instrumentation
- Run tests to verify compatibility
- Analytics service backend integration (Google Analytics, Mixpanel, Segment)
- Real-time telemetry dashboard
- Anomaly detection and alerting
- Event aggregation and reporting
- Browser-compatible telemetry client module
GPL-3.0
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs
This page brought to you by the 🦄 Magic Automation Unicorns of LightSpeedWP. Automation Docs