(w http.ResponseWriter, r *http.Request, nodeID string)
| 338 | } |
| 339 | |
| 340 | func (a *API) handleNodeRuntime(w http.ResponseWriter, r *http.Request, nodeID string) { |
| 341 | if r.Method != http.MethodGet { |
| 342 | writeMethodNotAllowed(w, http.MethodGet) |
| 343 | return |
| 344 | } |
| 345 | client, err := a.clientFor(nodeID) |
| 346 | if err != nil { |
| 347 | writeNodeError(w, err) |
| 348 | return |
| 349 | } |
| 350 | ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second) |
| 351 | defer cancel() |
| 352 | out, err := client.Runtime(ctx) |
| 353 | if err != nil { |
| 354 | writeJSON(w, http.StatusUnprocessableEntity, map[string]any{"error": err.Error()}) |
| 355 | return |
| 356 | } |
| 357 | writeJSON(w, http.StatusOK, out) |
| 358 | } |
| 359 | |
| 360 | func (a *API) handleNodeMetrics(w http.ResponseWriter, r *http.Request, nodeID string) { |
| 361 | if r.Method != http.MethodGet { |
no test coverage detected