
Metrics
Query Railway CPU, memory, network, and disk metrics to see whether a deployed service is healthy or resource-bound.
Overview
metrics is an agent skill for the Operate phase that queries Railway service resource usage for CPU, memory, network, and disk performance debugging.
Install
npx skills add https://github.com/railwayapp/railway-skills --skill metricsWhat is this skill?
- Covers 9 MetricMeasurement types including CPU_USAGE, MEMORY_USAGE_GB, NETWORK_RX/TX_GB, and disk variants
- Prerequisite flow: railway status --json for environmentId and optional serviceId
- GroupBy via MetricTag: DEPLOYMENT_ID, INSTANCE_ID, REGION, SERVICE_ID
- Explicit when-to-use triggers for memory, CPU, network, disk, and performance debugging
- allowed-tools: Bash(railway:*) for CLI metric queries
- 9 MetricMeasurement values documented (CPU, memory, network, disk families)
- 4 MetricTag groupBy dimensions (deployment, instance, region, service)
Adoption & trust: 811 installs on skills.sh; 274 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You deployed on Railway but cannot tell if slowness or crashes come from CPU limits, memory pressure, or disk growth without manual dashboard hunting.
Who is it for?
Indie builders operating Railway-hosted APIs or workers who need quick answers to how much memory or CPU a service uses.
Skip if: Non-Railway hosts, local-only dev profiling, or deep APM trace analysis without the Railway CLI linked project.
When should I use this skill?
User asks about resource usage, CPU, memory, network, disk, or service performance on Railway.
What do I get? / Deliverables
You run documented Railway CLI metric queries scoped by environment and service with the right measurements and groupBy tags for a concrete usage snapshot.
- Metric query results for chosen measurements and time window
- Grouped breakdown by deployment, instance, region, or service when requested
Recommended Skills
Journey fit
Operate is the canonical shelf because the skill answers live resource usage and performance questions after deployment. Monitoring subphase matches MetricMeasurement tables, GraphQL-style metric queries, and debugging slow or thirsty services.
How it compares
Infrastructure metrics via Railway CLI skill, not a full observability MCP or host-agnostic Prometheus recipe.
Common Questions / FAQ
Who is metrics for?
Solo builders and small teams running services on Railway who debug capacity and health using the official CLI.
When should I use metrics?
Use it in Operate when users ask how much memory a service uses, whether CPU is saturated, or if network/disk metrics explain sluggish behavior—often alongside the service skill.
Is metrics safe to install?
It instructs read-oriented Railway CLI usage; confirm scopes on your machine and review the Security Audits panel on this Prism page before granting Bash railway:* in your agent.
SKILL.md
READMESKILL.md - Metrics
# Service Metrics Query resource usage metrics for Railway services. ## When to Use - User asks "how much memory is my service using?" - User asks about CPU usage, network traffic, disk usage - User wants to debug performance issues - User asks "is my service healthy?" (combine with `service` skill) ## Prerequisites Get environmentId and serviceId from linked project: ```bash railway status --json ``` Extract: - `environment.id` → environmentId - `service.id` → serviceId (optional - omit to get all services) ## MetricMeasurement Values | Measurement | Description | |-------------|-------------| | CPU_USAGE | CPU usage (cores) | | CPU_LIMIT | CPU limit (cores) | | MEMORY_USAGE_GB | Memory usage in GB | | MEMORY_LIMIT_GB | Memory limit in GB | | NETWORK_RX_GB | Network received in GB | | NETWORK_TX_GB | Network transmitted in GB | | DISK_USAGE_GB | Disk usage in GB | | EPHEMERAL_DISK_USAGE_GB | Ephemeral disk usage in GB | | BACKUP_USAGE_GB | Backup usage in GB | ## MetricTag Values (for groupBy) | Tag | Description | |-----|-------------| | DEPLOYMENT_ID | Group by deployment | | DEPLOYMENT_INSTANCE_ID | Group by instance | | REGION | Group by region | | SERVICE_ID | Group by service | ## Query ```graphql query metrics( $environmentId: String! $serviceId: String $startDate: DateTime! $endDate: DateTime $sampleRateSeconds: Int $averagingWindowSeconds: Int $groupBy: [MetricTag!] $measurements: [MetricMeasurement!]! ) { metrics( environmentId: $environmentId serviceId: $serviceId startDate: $startDate endDate: $endDate sampleRateSeconds: $sampleRateSeconds averagingWindowSeconds: $averagingWindowSeconds groupBy: $groupBy measurements: $measurements ) { measurement tags { deploymentInstanceId deploymentId serviceId region } values { ts value } } } ``` ## Example: Last Hour CPU and Memory Use heredoc to avoid shell escaping issues: ```bash bash <<'SCRIPT' START_DATE=$(date -u -v-1H +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date -u -d "1 hour ago" +"%Y-%m-%dT%H:%M:%SZ") ENV_ID="your-environment-id" SERVICE_ID="your-service-id" VARS=$(jq -n \ --arg env "$ENV_ID" \ --arg svc "$SERVICE_ID" \ --arg start "$START_DATE" \ '{environmentId: $env, serviceId: $svc, startDate: $start, measurements: ["CPU_USAGE", "MEMORY_USAGE_GB"]}') scripts/railway-api.sh \ 'query metrics($environmentId: String!, $serviceId: String, $startDate: DateTime!, $measurements: [MetricMeasurement!]!) { metrics(environmentId: $environmentId, serviceId: $serviceId, startDate: $startDate, measurements: $measurements) { measurement tags { deploymentId region serviceId } values { ts value } } }' \ "$VARS" SCRIPT ``` ## Example: All Services in Environment Omit serviceId and use groupBy to get metrics for all services: ```bash bash <<'SCRIPT' START_DATE=$(date -u -v-1H +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date -u -d "1 hour ago" +"%Y-%m-%dT%H:%M:%SZ") ENV_ID="your-environment-id" VARS=$(jq -n \ --arg env "$ENV_ID" \ --arg start "$START_DATE" \ '{environmentId: $env, startDate: $start, measurements: ["CPU_USAGE", "MEMORY_USAGE_GB"], groupBy: ["SERVICE_ID"]}') scripts/railway-api.sh \ 'query metrics($environmentId: String!, $startDate: DateTime!, $measurements: [MetricMeasurement!]!, $groupBy: [MetricTag!]) { metrics(environmentId: $environmentId, startDate: $startDate, measurements: $measurements, groupBy: $groupBy) { measurement tags { serviceId region } values { ts value } } }' \ "$VARS" SCRIPT ``` ## Time Parameters | Parameter | Description | |-----------|-------------| | startDate | Required. ISO 860