Identify Your API Consumer
Lunar.dev supports the ability to identify and segment requests based on the x-lunar-consumer-tag header. This feature allows users to add a custom header to their HTTP requests, enabling better visibility and control in Lunar.dev Control Plane.
When a request is sent with the x-lunar-consumer-tag header, Lunar.dev API Consumption Gateway captures this header and uses it for segmentation and filtering:
- Segmentation: In the discovery command, Lunar.dev segments results by different consumer tags, providing a detailed view of traffic per consumer. For example, requests tagged with
x-lunar-consumer-tag: example-appwill be grouped under theexample-appconsumer segment. - Filtering: In the control plane dashboards, users can filter views according to specific consumer tags. This allows for more focused monitoring and troubleshooting based on the origin of requests. Implementation
To use this feature, add the x-lunar-consumer-tag header to your outgoing HTTP requests. The header value should be a short, informative string indicating the name of the application, service, or job from which the request originated.
The x-lunar-consumer-tag header (as with any other header prefixed with x-lunar-) will be removed from the request before it is sent to a third-party provider. This ensures that the header is used solely for internal purposes within the Lunar.dev ecosystem and does not affect the behavior of external APIs.