Skip to main content

Monitoring

This guide explains how to monitor your Source Push deployments and track update metrics.

Overview

Effective monitoring helps you:

  • Track update adoption
  • Identify issues quickly
  • Measure user engagement
  • Make data-driven decisions

Deployment Metrics

Viewing Deployment Status

srcpush deployment ls MyApp-iOS

Key metrics displayed:

  • Active users
  • Update adoption rate
  • Pending updates
  • Rollback events

Detailed History

srcpush deployment history MyApp-iOS Production

Information includes:

  • Release dates
  • Version numbers
  • Author information
  • Installation metrics

Update Metrics

Installation Statistics

# View detailed metrics for a specific deployment
srcpush deployment ls MyApp-iOS Production -k

Key metrics:

  1. Active Installations:

    • Currently running version
    • Percentage of total users
    • Device distribution
  2. Total Installations:

    • Cumulative installs
    • Success rate
    • Platform breakdown
  3. Pending Updates:

    • Downloads in progress
    • Installation queue
    • Retry attempts

Rollout Tracking

# Track rollout progress
srcpush deployment ls MyApp-iOS Production --format detailed

Metrics include:

  • Rollout percentage
  • Target audience reached
  • Installation success rate
  • Error frequency

Real-Time Monitoring

Debug Mode

Enable debug logging in your app:

// App.js
import codePush from "@srcpush/react-native-code-push";

codePush.enableDebugMode();

View logs in real-time:

srcpush debug ios

Live Updates

Monitor live update status:

# Watch deployment status
watch -n 60 "srcpush deployment ls MyApp-iOS Production"

Alert Configuration

Error Thresholds

Set up alerts for:

  • High failure rates
  • Slow adoption rates
  • Frequent rollbacks
  • Network issues

Example script:

#!/bin/bash
# monitor.sh

check_metrics() {
# Get deployment metrics
metrics=$(srcpush deployment ls MyApp-iOS Production)

# Check failure rate
failure_rate=$(echo "$metrics" | grep "failures" | awk '{print $2}')
if [ "$failure_rate" -gt 5 ]; then
send_alert "High failure rate detected: $failure_rate%"
fi
}

Integration Examples

Slack Integration

send_slack_alert() {
curl -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"$1\"}" \
$SLACK_WEBHOOK_URL
}

Email Alerts

send_email_alert() {
echo "$1" | mail -s "Source Push Alert" [email protected]
}

Performance Monitoring

Bundle Size Tracking

# Track bundle size changes
get_bundle_size() {
ls -l "$(srcpush deployment ls MyApp-iOS Production | grep 'Bundle' | awk '{print $2}')"
}

Download Speed

# Monitor download performance
check_download_speed() {
srcpush deployment ls MyApp-iOS Production | grep 'Download Time'
}

Custom Metrics

Implementing Custom Tracking

// App.js
codePush
.notifyApplicationReady()
.then(() => {
// Track successful installation
trackMetric("update_success");
})
.catch((error) => {
// Track failure
trackMetric("update_failure", error);
});

Metric Collection

const trackMetric = async (name, data) => {
try {
await fetch("https://metrics.company.com/collect", {
method: "POST",
body: JSON.stringify({ name, data }),
});
} catch (error) {
console.error("Failed to track metric:", error);
}
};

Dashboard Setup

Metrics Dashboard

Create a dashboard showing:

  • Update adoption
  • Installation success
  • Error rates
  • User engagement

Example structure:

// dashboard.js
const Dashboard = () => {
return (
<div>
<InstallationChart />
<ErrorRateGraph />
<UserEngagementMetrics />
<RolloutProgress />
</div>
);
};

Data Collection

// metrics-collector.js
const collectMetrics = async () => {
const metrics = await Promise.all([
srcpush.getInstallationMetrics(),
srcpush.getErrorRates(),
srcpush.getUserEngagement(),
]);

return processMetrics(metrics);
};

Best Practices

1. Regular Monitoring

  • Check metrics daily
  • Set up automated reports
  • Review trends weekly
  • Monitor error logs

2. Alert Configuration

  • Set appropriate thresholds
  • Configure notification channels
  • Define escalation paths
  • Document response procedures

3. Data Retention

  • Store historical data
  • Track trends over time
  • Maintain audit logs
  • Back up metrics regularly

4. Performance Optimization

  • Monitor bundle sizes
  • Track download speeds
  • Measure startup time
  • Analyze user impact

Troubleshooting

Common Issues

  1. Missing Metrics:

    # Verify data collection
    srcpush deployment ls MyApp-iOS Production --debug
  2. Delayed Updates:

    # Check network status
    srcpush debug ios --network
  3. Installation Failures:

    # View error logs
    srcpush deployment history MyApp-iOS Production --errors

Next Steps

  1. Set up CI/CD integration
  2. Configure metrics collection
  3. Learn about troubleshooting