Skip to main content

Monitoring gitGost

Monitor your gitGost instance to ensure healthy operation and detect issues early.

Health Check Endpoint

The /health endpoint provides service status and build information.

Check Service Health

curl https://gitgost.leapcell.app/health
Response:
{
  "status": "healthy",
  "deployedCommit": "a3f7b9c",
  "deployedAt": "2024-03-05T10:30:00Z",
  "sourceRepo": "https://github.com/livrasand/gitGost",
  "leapcell": true,
  "goVersion": "go1.21.5",
  "verify": {
    "github": "https://github.com/livrasand/gitGost/commit/a3f7b9c",
    "source": "100% open source - auditable"
  }
}
The verify.github URL allows you to audit the exact source code running on the server. This ensures transparency and builds trust.

Health Check Integration

1

Add to monitoring dashboard

Configure your monitoring tool (Prometheus, Datadog, etc.) to poll /health every 30-60 seconds.
2

Set up alerts

Alert when:
  • /health returns non-200 status
  • Response time exceeds 5 seconds
  • Service becomes unreachable
3

Verify deployments

After deploying, check the deployedCommit matches your expected commit hash.

Metrics Endpoint

The /metrics endpoint exposes runtime metrics for performance monitoring.

Fetch Metrics

curl https://gitgost.leapcell.app/metrics
Response:
{
  "memory": {
    "alloc": 4567890,
    "total_alloc": 123456789,
    "sys": 23456789,
    "num_gc": 42
  },
  "goroutines": 15,
  "uptime": "12h34m56s"
}

Key Metrics

MetricDescriptionNormal Range
memory.allocCurrent heap allocation (bytes)< 100 MB
memory.num_gcNumber of GC cyclesIncreases over time
goroutinesActive goroutines< 100 (idle), < 500 (busy)
uptimeTime since service startedN/A
High Memory Alert: If memory.alloc exceeds 500 MB consistently, investigate for memory leaks or consider scaling.

Service Status Endpoint

The /api/status endpoint shows if the panic button is active.
curl https://gitgost.leapcell.app/api/status
Response:
{
  "panic_mode": false
}
  • panic_mode: false → Service accepting pushes normally
  • panic_mode: true → Service suspended (panic button activated)

Logging System

GitGost uses privacy-focused logging that minimizes user data exposure.

Log Format

Configure log format via the LOG_FORMAT environment variable:
# Text format (default)
LOG_FORMAT=text

# JSON format (structured)
LOG_FORMAT=json

Text Format Logs

[gitGost] 2024/03/05 10:30:45 Privacy mode: Minimal logging enabled
[gitGost] 2024/03/05 10:30:45 Server started - Ready for anonymous contributions
[gitGost] 2024/03/05 10:35:12 Received push for owner/repo, size: 2048 bytes
[gitGost] 2024/03/05 10:35:15 Fork ready: gitgost-anonymous/repo
[gitGost] 2024/03/05 10:35:18 Created PR: https://github.com/owner/repo/pull/42

JSON Format Logs

{"timestamp":"2024-03-05T10:30:45Z","level":"info","message":"Privacy mode: Minimal logging enabled","privacy":"anonymized"}
{"timestamp":"2024-03-05T10:30:45Z","level":"info","message":"Server started - Ready for anonymous contributions","privacy":"anonymized"}
{"timestamp":"2024-03-05T10:35:12Z","level":"info","message":"Received push for owner/repo, size: 2048 bytes","privacy":"anonymized"}

Log Privacy Features

From internal/utils/logging.go:
  • No IP addresses logged in push operations
  • No user metadata captured or stored
  • Minimal context to prevent correlation attacks
  • All logs tagged with "privacy": "anonymized"
  • Logs focus on service health, not user activity
Privacy Notice: GitGost logs are designed to protect user anonymity. Do not add custom logging that captures IP addresses, user agents, or timing patterns that could deanonymize users.

Alert Configuration

1

Service Down

Trigger: /health endpoint returns non-200 or times outAction: Immediate investigation required
# Example healthcheck script
if ! curl -sf https://gitgost.leapcell.app/health > /dev/null; then
  echo "ALERT: gitGost service is down!"
  # Send alert notification
fi
2

High Memory Usage

Trigger: memory.alloc > 500 MB for 5+ minutesAction: Check for memory leaks, restart if necessary
3

Panic Mode Activated

Trigger: /api/status returns panic_mode: trueAction: Administrator intervention required (abuse detected)
4

Rate Limit Exceeded

Trigger: Multiple rate limit alerts from ntfy admin notificationsAction: Review IP patterns, consider temporary panic mode

ntfy Admin Notifications

GitGost sends real-time alerts via ntfy when configured. Configure ntfy alerts:
# Set environment variables
export NTFY_ADMIN_TOPIC="your-secret-admin-topic"
export PANIC_PASSWORD="your-secure-password"
Alert types:
  • Rate limit exceeded: Single IP exceeds 5 PRs/hour
  • Suspicious burst activity: 20+ pushes from 10+ IPs in 60 seconds
  • Service control: Action buttons to activate/deactivate panic mode
Subscribe to your admin topic on your phone using the ntfy app for instant push notifications:
https://ntfy.sh/your-secret-admin-topic

Log Analysis Examples

Find Recent Errors

# Text format
grep "ERROR:" app.log | tail -n 20

# JSON format
jq 'select(.level == "error")' app.log | tail -n 20

Count PR Creation Events

# Text format
grep "Created PR:" app.log | wc -l

# JSON format
jq 'select(.message | contains("Created PR:"))' app.log | wc -l

Monitor Fork Creation Rate

# Track fork operations over time
grep "Fork ready:" app.log | awk '{print $1, $2}' | uniq -c

Deployment Verification

Verify deployments match the source code:
1

Fetch deployed commit

DEPLOYED_COMMIT=$(curl -s https://gitgost.leapcell.app/health | jq -r '.deployedCommit')
echo "Deployed commit: $DEPLOYED_COMMIT"
2

Compare with GitHub

git fetch origin
git log --oneline origin/main | grep "$DEPLOYED_COMMIT"
3

Verify source transparency

Visit the GitHub verification URL:
curl -s https://gitgost.leapcell.app/health | jq -r '.verify.github'
# Open in browser to audit source code

Monitoring Best Practices

Production Monitoring Checklist

  • ✅ Health checks running every 30-60 seconds
  • ✅ Memory metrics tracked and alerted
  • ✅ Panic mode status monitored
  • ✅ ntfy admin notifications configured
  • ✅ Log aggregation set up (if using JSON format)
  • ✅ Uptime SLA tracking enabled
  • ✅ Deployment verification automated

Next Steps

Moderation

Learn how to moderate abuse and use the panic button

Troubleshooting

Diagnose and fix common operational issues

Build docs developers (and LLMs) love