HTTP Monitoring
Track inbound and outbound HTTP requests with timing, status codes, and path information.
HTTP monitoring captures every HTTP request your application makes or receives, recording method, host, path, status code, duration, and payload sizes. Requests are batched (up to 100 per call) for efficient delivery.
Auto-Instrumentation
The simplest way to start is to enable automatic instrumentation. This patches your runtime's HTTP client to capture all requests without code changes.
import SeeStack from '@seestack/sdk';
SeeStack.init({ apiKey: '...', host: '...' });
SeeStack.instrumentHttp();
// All fetch() and XMLHttpRequest calls are now trackedWhat gets patched:
fetch()(browser and Node.js)XMLHttpRequest(browser)http.request/https.request(Node.js)
import seestack
seestack.init(api_key="...", host="...")
seestack.instrument_http()
# All requests via urllib3, httpx, and aiohttp are now trackedWhat gets patched:
urllib3(used byrequests)httpxaiohttp
// Use the SeeStack transport wrapper for http.Client
client := &http.Client{
Transport: seestack.NewHTTPTransport(http.DefaultTransport),
}
resp, err := client.Get("https://api.example.com/data")Go does not support monkey-patching. Use the transport wrapper on HTTP clients you want to monitor.
Request Direction
Each captured request is tagged with a direction:
| Direction | Meaning | Example |
|---|---|---|
inbound | A request your application received | An incoming API call to your server |
outbound | A request your application made | A call to a third-party API or microservice |
Auto-instrumentation captures outbound requests by default. For inbound request tracking, use middleware in your web framework.
Captured Data
Prop
Type
Batching
HTTP requests are batched for efficiency:
- Up to 100 items per batch request
- Flushed every 5 seconds or when the batch reaches 50 items (whichever comes first)
- Requests are buffered in a ring buffer (default: 500 items)
Query parameters are automatically stripped from captured paths to prevent leaking secrets (tokens, API keys, etc.). Only the path portion of the URL is recorded.
Sensitive headers (Authorization, Cookie, X-SeeStack-Key) are never captured. See Privacy & Data Masking for the full list.
Inbound Request Middleware
For server-side SDKs, use middleware to track inbound requests:
import express from 'express';
const app = express();
app.use((req, res, next) => {
const start = Date.now();
res.on('finish', () => {
SeeStack.captureHttpRequest({
traceId: req.headers['x-request-id'] || crypto.randomUUID(),
direction: 'inbound',
method: req.method,
host: req.hostname,
path: req.path,
statusCode: res.statusCode,
durationMs: Date.now() - start,
requestSize: Number(req.headers['content-length'] || 0),
responseSize: Number(res.getHeader('content-length') || 0),
timestamp: new Date(start).toISOString(),
});
});
next();
});import time
import uuid
from seestack import capture_http_request
class SeeStackMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
start = time.time()
response = self.get_response(request)
duration_ms = int((time.time() - start) * 1000)
capture_http_request(
trace_id=request.headers.get("X-Request-ID", str(uuid.uuid4())),
direction="inbound",
method=request.method,
host=request.get_host(),
path=request.path,
status_code=response.status_code,
duration_ms=duration_ms,
request_size=len(request.body),
response_size=len(response.content),
timestamp=start,
)
return responsefunc SeeStackMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
rw := &responseWriter{ResponseWriter: w}
next.ServeHTTP(rw, r)
seestack.CaptureHTTPRequest(seestack.HTTPRequest{
TraceID: r.Header.Get("X-Request-ID"),
Direction: "inbound",
Method: r.Method,
Host: r.Host,
Path: r.URL.Path,
StatusCode: rw.statusCode,
DurationMs: int(time.Since(start).Milliseconds()),
RequestSize: int(r.ContentLength),
ResponseSize: rw.bytesWritten,
Timestamp: start.UTC().Format(time.RFC3339),
})
})
}