a month ago
Is there a way I can query memory per replica for a specific service with graphql? I have a way of checking the total ram across all the replicas for a specific service(see below) but was wondering if there was a way to find it for each individual replica
'''query metrics($startDate: DateTime!, $projectId: String!, $serviceId: String! = "", $environmentId: String = "") {
metrics(
projectId: $projectId
measurements: MEMORYUSAGEGB
startDate: $startDate
serviceId: $serviceId
environmentId: $environmentId
) {
values {
ts
value
}
measurement
}
}
'''
Pinned Solution
a month ago
You can query by replica by adding the argument groupBy: DEPLOYMENT_INSTANCE_ID to the query. Note that the replicas are named by their IDs, so if you want to match that to each replica, you'd want to log the variable RAILWAY_REPLICA_ID or something similar to that.
5 Replies
a month ago
No.
That GraphQL metrics API only exposes aggregated service-level memory, not per-replica/pod memory. There’s no argument to break it down by replica.
To get per-replica memory, you’d need infra-level metrics (e.g. Kubernetes/Prometheus, Datadog, etc.), not this GraphQL query.
ekipchirchir
No.That GraphQL metrics API only exposes aggregated service-level memory, not per-replica/pod memory. There’s no argument to break it down by replica.To get per-replica memory, you’d need infra-level metrics (e.g. Kubernetes/Prometheus, Datadog, etc.), not this GraphQL query.
a month ago
That is not true. Please make sure to validate your answers for bounty threads.
a month ago
You can query by replica by adding the argument groupBy: DEPLOYMENT_INSTANCE_ID to the query. Note that the replicas are named by their IDs, so if you want to match that to each replica, you'd want to log the variable RAILWAY_REPLICA_ID or something similar to that.
0x5b62656e5d
You can query by replica by adding the argument groupBy: DEPLOYMENT_INSTANCE_ID to the query. Note that the replicas are named by their IDs, so if you want to match that to each replica, you'd want to log the variable RAILWAY_REPLICA_ID or something similar to that.
a month ago
The groupBy: DEPLOYMENT_INSTANCE_ID worked. Thanks for this! By chance do you know if there is a way to restart one specific replica or would I have to restart all of them?
a month ago
I don't think you're able to restart one specific replica. You'd need to restart the entire service.
Status changed to Solved brody • 30 days ago
