debugapi

package
v1.17.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

README

Substreams Debug API

A simple HTTP API for runtime debugging and management of Substreams tier2.

Making Requests with curl

Simulate Overloaded State

Get the current overloaded simulation state:

curl -s http://localhost:8081/debug/simulate_overloaded | jq

Example response:

{
  "overloaded": false
}

Set the service to simulate being overloaded:

curl -s -X POST -H "Content-Type: application/json" -d '{"overloaded": true}' http://localhost:8081/debug/simulate_overloaded | jq

Alternative using query parameter:

curl -s -X POST http://localhost:8081/debug/simulate_overloaded?value=true | jq

Example response:

{
  "overloaded": true
}
Force Garbage Collection

Trigger an immediate garbage collection:

curl -s -X POST http://localhost:8081/debug/gc | jq

Example response:

{
  "before": "Alloc = 235 MiB, Heap inuse = 245 MiB",
  "after": "Alloc = 198 MiB, Heap inuse = 210 MiB"
}
Manage Active Requests

List all currently active requests:

curl -s http://localhost:8081/debug/requests | jq

Example response will show details of all active requests.

Cancel a specific request:

curl -s -X DELETE -H "Content-Type: application/json" -d '{
  "trace_id": "abc123",
  "output_module_hash": "def456"
}' http://localhost:8081/debug/requests | jq

Example response:

{
  "matches": ["request-1", "request-2"]
}

For more specific cancellation, you can include optional parameters:

curl -s -X DELETE -H "Content-Type: application/json" -d '{
  "trace_id": "abc123",
  "output_module_hash": "def456",
  "segment_number": 5,
  "segment_size": 100,
  "stage": 2
}' http://localhost:8081/debug/requests | jq

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugAPI

type DebugAPI struct {
	// contains filtered or unexported fields
}

DebugAPI provides HTTP endpoints for inspecting and simulating state of a service

func New

func New(
	listenAddr string,
	logger *zap.Logger,
	simulateOverloaded func(bool),
	getSimulateOverloaded func() bool,
	listActiveRequests func() string,
	cancelRequest func(string, string, *uint64, *uint64, *uint32) []string,
) *DebugAPI

func (*DebugAPI) Start

func (api *DebugAPI) Start()

type Option

type Option func(*DebugAPI)

Option is a functional option for configuring the DebugAPI

func WithListenAddr

func WithListenAddr(addr string) Option

WithListenAddr sets the listen address for the debug API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL