Skip to main content

Module metrics

Module metrics 

Source
Expand description

Prometheus metrics for observability

This module provides comprehensive metrics collection for monitoring IPFRS interface performance, usage patterns, and system health.

§Global registry (lazy_static)

The module exposes a set of well-known lazy_static metrics that register themselves in the default prometheus registry. These are used by the HTTP middleware and route helpers.

§Per-node registry (IpfrsMetrics)

For fine-grained per-node observability (block operations, DHT, inference sessions, GossipSub, storage and GC) each Node or gateway instance can hold an IpfrsMetrics value. Metrics are registered in a private prometheus::Registry so multiple test instances do not collide.

Structs§

ASYNC_TASKS_ACTIVE
Number of goroutines (async tasks)
AUTH_ATTEMPTS_TOTAL
Authentication attempts
AUTH_SESSIONS_ACTIVE
Active authenticated sessions
BATCH_OPERATION_DURATION_SECONDS
Batch operation duration
BATCH_OPERATION_SIZE
Batch operation size (number of items)
BLOCKS_RETRIEVED_TOTAL
Total blocks retrieved
BLOCKS_STORED_TOTAL
Total blocks stored
BLOCK_ERRORS_TOTAL
Block operation errors
BLOCK_RETRIEVAL_DURATION_SECONDS
Block retrieval duration
CACHE_HITS_TOTAL
Cache hits
CACHE_MISSES_TOTAL
Cache misses
CACHE_SIZE_BYTES
Current cache size
DOWNLOAD_BYTES_TOTAL
Total bytes downloaded
GRPC_REQUESTS_TOTAL
gRPC requests total
GRPC_REQUEST_DURATION_SECONDS
gRPC request duration
HTTP_CONNECTIONS_ACTIVE
Currently active HTTP connections
HTTP_REQUESTS_TOTAL
Total number of HTTP requests by endpoint and method
HTTP_REQUEST_DURATION_SECONDS
HTTP request duration in seconds
HTTP_REQUEST_SIZE_BYTES
HTTP request body size in bytes
HTTP_RESPONSE_SIZE_BYTES
HTTP response size in bytes
IpfrsMetrics
Global metrics registry for IPFRS.
MEMORY_ALLOCATED_BYTES
Total memory allocated (in bytes)
RATE_LIMIT_HITS_TOTAL
Rate limit hits (requests blocked)
RATE_LIMIT_TOKENS_AVAILABLE
Available rate limit tokens
STREAMING_CHUNK_SIZE_BYTES
Streaming chunk size
STREAMING_OPERATIONS_ACTIVE
Active streaming operations
TENSOR_OPERATIONS_TOTAL
Tensor operations total
TENSOR_SIZE_BYTES
Tensor size in bytes
TENSOR_SLICE_OPERATIONS_TOTAL
Tensor slice operations
Timer
Helper struct for timing operations
UPLOAD_BYTES_TOTAL
Total bytes uploaded
WEBSOCKET_CONNECTIONS_ACTIVE
Active WebSocket connections
WEBSOCKET_MESSAGES_RECEIVED_TOTAL
WebSocket messages received
WEBSOCKET_MESSAGES_SENT_TOTAL
WebSocket messages sent

Functions§

encode_metrics
Encode all metrics in Prometheus text format
finish_http_request_timer
Finish timing an HTTP request
new_shared_metrics
Create a new SharedMetrics instance.
record_auth_attempt
Record authentication attempt
record_block_error
Record block error
record_block_retrieved
Record block retrieval
record_block_stored
Record block storage
record_cache_hit
Record cache hit
record_cache_miss
Record cache miss
record_download_bytes
Record download bytes
record_http_request
Record an HTTP request
record_http_request_size
Record HTTP request size
record_http_response_size
Record HTTP response size
record_rate_limit_hit
Record rate limit hit
record_upload_bytes
Record upload bytes
start_http_request_timer
Start timing an HTTP request

Type Aliases§

SharedMetrics
A thread-safe shared handle to an IpfrsMetrics instance.