Comprehensive monitoring and observability for Portkey Enterprise Gateway through Prometheus metrics
/metrics
text/plain; version=0.0.4; charset=utf-8
/metrics
endpoint. In production deployments, consider securing this endpoint or restricting access to monitoring infrastructure only.app
: Service identifier (from SERVICE_NAME
environment variable)env
: Deployment environment (from NODE_ENV
environment variable)node_
prefix using the prom-client
default collectors:
node_process_cpu_user_seconds_total
, node_process_cpu_system_seconds_total
node_process_resident_memory_bytes
, node_process_heap_bytes
node_process_open_fds
, node_process_max_fds
node_process_start_time_seconds
node_eventloop_lag_seconds
(critical for detecting Node.js performance issues)node_gc_duration_seconds
with custom buckets optimized for LLM gateway workloads[0.001, 0.01, 0.1, 1, 1.5, 2, 3, 5, 7, 10, 15, 20, 30, 45, 60, 90, 120, 240, 500, 1000, 6000]
(seconds)method
: HTTP verb (GET, POST, PUT, DELETE, etc.)endpoint
: Normalized API endpoint path (e.g., /v1/chat/completions
, /v1/completions
)code
: HTTP response status code (200, 400, 500, etc.)provider
: LLM provider identifier (openai, anthropic, azure-openai, etc.)model
: Specific model name (gpt-4, claude-3, etc.)source
: Request origination source or client identifierstream
: Boolean indicator for streaming responses (“true”/“false”)cacheStatus
: Cache interaction result (“hit”, “miss”, “disabled”, “error”)metadata_*
: Dynamic labels from request metadata (see configuration section)request_count
http_request_duration_seconds
[0.1, 1, 1.5, 2, 3, 5, 7, 10, 15, 20, 30, 45, 60, 90, 120, 240, 500, 1000, 3000]
llm_request_duration_milliseconds
[0.1, 1, 2, 5, 10, 30, 50, 75, 100, 150, 200, 350, 500, 1000, 2500, 5000, 10000, 50000, 100000, 300000, 500000, 10000000]
portkey_processing_time_excluding_last_byte_ms
llm_last_byte_diff_duration_milliseconds
portkey_request_duration_milliseconds
llm_cost_sum
authentication_duration_milliseconds
api_key_rate_limit_check_duration_milliseconds
pre_request_processing_duration_milliseconds
post_request_processing_duration_milliseconds
llm_cache_processing_duration_milliseconds
grpc_req_conversion_duration_milliseconds
[0.01, 0.1, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000]
PROMETHEUS_LABELS_METADATA_ALLOWED_KEYS
Configuration Format: Comma-separated list of metadata keys
x-portkey-metadata
HTTP header as a JSON stringmetadata_
to avoid naming conflicts/metrics
endpoint with authentication or network restrictionsPROMETHEUS_LABELS_METADATA_ALLOWED_KEYS
configuration and limit high-cardinality labels/metrics
endpoint is accessible