Skip to content

Diagnostics API

DRAFT — Internal Developer Use Only

This API reference is for internal development teams.

Overview

What it is: The Diagnostics API provides profiling and runtime statistics endpoints for performance analysis and troubleshooting. The primary endpoint generates Go pprof profiles from running grid modules.

Source: src/grid/client/rest.go

Authentication

All endpoints require JWT cookie or API token authentication.

Endpoints

MethodPathDescriptionAuth required
POST/internal/v1/pprofGenerate a profiling snapshot for a grid moduleJWT + API token

POST /internal/v1/pprof

Generate a Go pprof profile from a running grid module. The response is a gzip-compressed binary profile file that can be analyzed with standard Go profiling tools.

Request:

http
POST /internal/v1/pprof
Content-Type: application/json
Authorization: Bearer <token>
json
{
  "client": "node-uuid",
  "module": "grid.client",
  "profile": "cpu"
}

Request fields:

FieldTypeRequiredDescription
clientstringYesGrid client node ID to profile
modulestringNoModule name (default: grid.client)
profilestringYesProfile type to collect

Available profile types:

ProfileDescription
cpuCPU usage profile (30-second sample)
allocsMemory allocation profile
heapHeap memory profile
goroutineGoroutine stack traces
blockBlocking profile
mutexMutex contention profile
threadcreateThread creation profile

Response (200): Binary gzip-compressed pprof data.

Response headers:

HeaderValue
Content-Dispositionattachment; filename=hydden-{profile}-{timestamp}.out
Content-Typeapplication/octet-stream

Usage with Go tools:

bash
# Download profile
curl -X POST "https://portal/internal/v1/pprof" \
  -H "Authorization: Bearer <token>" \
  -d '{"client":"node-uuid","profile":"cpu"}' \
  -o cpu.out

# Analyze with pprof
go tool pprof cpu.out

Grid Runtime Statistics (gRPC only)

The grid module also exposes runtime statistics via gRPC (no REST surface). These are defined in src/grid/api/grid_api.proto:

Available via gRPC:

MessageFieldsDescription
StatsnID, disk, version, error, runtime, component, uptimeNode runtime statistics
DiskStatstotal, freeDisk usage statistics
Runtimeversion, maxProcs, arch, oS, envGo runtime information

These statistics are used internally by the grid cluster management layer and are not exposed via REST.


Error Responses

StatusDescription
400Invalid request body or unknown profile type
403Authentication failed or insufficient permissions
404Target node not found or offline
500Profiling failed (target module unresponsive)

Hydden Documentation and Training Hub