Skip to main content
Version: Next

Flow Configuration Template

Flow Configuration

/etc/lunar-proxy/flows/flow.yaml
# Name of the flow for identification purposes
name: RetryFlow

# Filter configuration to specify which requests the flow applies to
filter:
url: "api.com/resource/{id}" # Target URL pattern for retry logic

# Processor configuration for the Retry Flow
processors:
RetryProcessor:
processor: Retry # Specifies the Retry processor
parameters:
- key: attempts
value: 3 # Maximum number of retry attempts
- key: initial_cooldown_seconds
value: 2 # Initial cooldown time before the first retry (in seconds)
- key: cooldown_multiplier
value: 2 # Multiplier for exponential backoff
- key: min_status_code
value: 500 # Minimum status code to trigger a retry
- key: max_status_code
value: 599 # Maximum status code to trigger a retry

# Metrics configuration for tracking retry behavior
metrics:
enabled: true # Enables metric collection
labels:
- flow_name # Include the flow name as a label
- processor_key # Include the processor key as a label
- http_method # Include the HTTP method (GET, POST, etc.)
- url # Include the URL of the request
- status_code # Include the HTTP status code of the response

# Flow definition for request handling
flow:
request:
# Start of the request flow
- from:
stream:
name: globalStream # Use the global stream for capturing requests
at: start
to:
processor:
name: RetryProcessor # Route the request to the RetryProcessor

# End of the request flow
- from:
processor:
name: RetryProcessor
to:
stream:
name: globalStream # Return the request to the global stream
at: end

Configuration Fields Explained

FieldDescriptionExample Value
attemptsMaximum number of retry attempts.3
initial_cooldown_secondsInitial wait time before the first retry.2
cooldown_multiplierMultiplier for exponential backoff.2
min_status_codeMinimum status code to trigger a retry.500
max_status_codeMaximum status code to trigger a retry.599