Skip to main content
Version: 0.9.x

Discover

The first step to the Lunar mission, is the discover command. By executing this command, you can validate the seamless integration of Lunar Interceptor, ensuring the redirection of selected traffic to Lunar Proxy.

Lunar Discovery tool records basic metrics such as:

  • Call Count
  • Status codes Distribution
  • Average Duration

In addition, it aggregates them on an endpoint level. The shown metrics presented via printed JSON, are written into a local file for your convenience, without any additional needed configurations.

A visual representation (and more) of the Discover command

The Lunar Control Plane offers a comprehensive dashboard for managing and optimizing your API consumption. With intuitive visualizations and advanced analytics, you can gain deeper insights into your API usage and make data-driven decisions to optimize performance and efficiency.

Lunar Control Plane Dashboard

Discover Example

docker exec lunar-proxy discover 

Result Example

{
"interceptors": [
{
"type": "lunar-java-interceptor",
"version": "0.1.4",
"last_transaction_date": "2023-07-05T13:38:07Z"
},
{
"type": "lunar-aiohttp-interceptor",
"version": "0.1.3",
"last_transaction_date": "2023-07-05T13:38:01Z"
}
],
"endpoints": {
"GET:::httpbin.org:::/status/{code}": {
"min_time": "2023-02-05T17:07:42",
"max_time": "2023-02-05T17:09:14",
"count": 5,
"status_codes": {
"200": 1,
"201": 1,
"402": 3
},
"average_duration": 283
}
}
}

Breaking down the JSON Results

Interceptors:

  • type: This field represents the specific type of the Lunar interceptor that is being used.
  • version: The version field indicates the package version of the Lunar Interceptor.
  • last_transaction_date: This field shows the ISO 8601 formatted timestamp of the most recent transaction made through the Lunar interceptor.

Endpoints:

  • "GET:::httpbin.org:::/status/[code]": This is the key representing the specific API endpoint. The value associated with this key is an object containing various statistics related to this endpoint.
  • min_time: This field represents the minimum timestamp of when requests were made to the API endpoint through Lunar. The value "2023-02-05T17:07:42" is an ISO 8601 formatted timestamp, indicating that the minimum timestamp is February 5, 2023, at 5:07:42 PM.
  • max_time: This field represents the maximum timestamp of when requests were made to the API endpoint through Lunar. Similarly, the value "2023-02-05T17:09:14" is an ISO 8601 formatted timestamp, indicating that the maximum timestamp is February 5, 2023, at 5:09:14 PM.
  • count: This field represents the total number of requests made to the API endpoint through Lunar. In this case, it indicates that 5 requests were made.
  • status_codes: This field represents the distribution of HTTP status codes returned by the API endpoint. The status codes are represented as keys, and the corresponding values indicate the number of times each status code was returned. In this example, the API endpoint returned 1 response with a status code of 200, 1 response with a status code of 201, and 3 responses with a status code of 402.
  • average_duration: This field represents the average duration of the requests made to Lunar Proxy. The value 283 represents the average duration in milliseconds.
note

Lunar Proxy will clear its discovery cache upon restart.