$ show adobe-apiplatform/apigateway
This repository implements an API Gateway based on Openresty and NGINX with LuaJIT for high-performance request processing. The system provides service discovery via Marathon integration, API key validation, HMAC/OAuth authentication, rate limiting, request/response transformation, and metrics collection. Architecture-wise, it uses a modular design with NGINX configuration files defining request processing phases, Lua modules for extensible functionality (validation, tracking, metrics), and external dependencies for service discovery (Marathon), caching (Redis), and metrics reporting (StatsD). Key entry points include the health-check endpoint (/health-check), metrics endpoint (/api-gateway-stats), and admin API (/tracking/* on port 5000). The gateway processes client requests through validation phases, proxies them to backend services, collects metrics throughout, and returns responses while supporting dynamic configuration reloading and remote config sync from S3.
The LLM identified 2 files worth highlighting for reuse:
Implements a reusable metrics buffering system with counters and timers using NGINX shared dictionaries. Features include automatic expired key flushing, proper timer averaging calculations, and nil value handling. The component is isolated, demonstrates non-obvious skill in managing concurrent metric updates, and could be extracted to other Openresty/Lua projects with minimal modification (primarily replacing the storage mechanism).
A background worker that polls a metrics endpoint and sends data to StatsD with UDP buffering to prevent packet loss. Implements efficient batching, reconnection handling, and error resilience. The component is self-contained, demonstrates non-obvious skill in network programming and metrics transport, and could be reused for any service exposing JSON metrics with only endpoint configuration changes.