Flows Hub
The Flows Hub is your central location for managing API traffic and monitoring performance within the Lunar.dev ecosystem.
This hub lists the available flows under two main categories: Traffic Controls and Observability and Monitoring.
These flows help you efficiently manage your API traffic, enforce quotas, prioritize requests, and track key performance metrics.
Popular Flows to Explore
📄️ Client Side Limiting
The Client-Side Limiting Flow regulates API traffic by enforcing predefined Quotas within the flow. This ensures that API usage stays within limits, preventing overconsumption and maintaining stable integration. The flow dynamically manages requests and provides appropriate responses when quotas are exceeded using the Limiter and GenerateResponse processors.
📄️ Priority Queue
The Priority Queue Flow manages API requests based on their priority, ensuring high-priority traffic is handled first while maintaining smooth processing for lower-priority requests. Using the Queue processor, it controls the number of requests in the queue and assigns priorities via the x-lunar-consumer-tag header. Requests are delayed until their turn arrives or the time-to-live (TTL) expires. If the queue is full, or limits are exceeded, a 429 "Too Many Requests" response is generated.
📄️ Endpoint Access Control
The Endpoint Access Control Flow enforces access rules based on endpoints and custom headers.
📄️ Custom Metrics Collection
The Custom Metrics Collector Flow tracks user-defined metrics for API requests and responses, such as request size or rate limits. This flow helps monitor API performance and usage patterns in real-time, offering flexibility with histograms, gauges, and other metric types.
📄️ HAR Collector
The HAR Collector Flow captures detailed HTTP transaction data, including headers, query parameters, and request/response bodies. It stores the data in a log file using a File Exporter, making it easy to trace API interactions for troubleshooting and auditing.
📄️ Async
The Async Flow is primarily a reliability feature, designed to ensure robust communication using the Lunar.dev Gateway.The Lunar.dev Gateway handles requests asynchronously and delivers responses once they are ready, decoupling the client from the timing of the response.
📄️ Retry
The Retry Flow automatically handles retries for failed API requests based on configurable criteria, such as status codes and retry strategies. It is designed to enhance API reliability by managing temporary failures without requiring client-side retry logic.
📄️ Transform
The Transform Flow modifies API requests based on predefined transformation rules. It allows setting, deleting, and obfuscating specific request parameters.
📄️ Caching
The Caching Flow is designed to enhance API performance and reliability by caching responses to frequently accessed API requests. This reduces the load on API providers, and improves response times for consumers. Caching based on URL, query parameters and specific headers are supported.
Traffic Controls
The Traffic Controls category provides comprehensive flows designed to regulate and manage API traffic. These flows ensure optimal API performance, helping you prevent overconsumption, manage high-traffic environments, and enforce access control policies.
-
This flow enforces quotas within the client-side application, regulating API consumption by limiting the number of requests that can be sent. It's ideal for controlling overuse and protecting API provider resources.
-
The Priority Queue Flow manages API requests based on their priority. It ensures high-priority traffic is processed first, with the ability to queue lower-priority requests until their time-to-live (TTL) expires.
-
This flow enforces access rules based on domain names and custom headers, allowing you to allow or block traffic from specific domains or IPs.
Observability and Monitoring
The Observability and Monitoring category allows users to define and track custom metrics for their API operations. This section is focused on providing detailed insights into API performance, usage, and rate limits, with built-in support for exporting metrics to Prometheus for real-time analysis.
-
This flow enables users to define custom metrics to track specific API behaviors, such as request size or response times. Metrics can be customized using labels and exported to Prometheus for visualization in tools like Grafana and Datadog.