You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/latest/plugins/lago.md
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -74,7 +74,7 @@ This Plugin supports using batch processors to aggregate and process events in a
74
74
75
75
The examples below demonstrate how you can configure `lago` Plugin for typical scenario.
76
76
77
-
To follow along the examples, start a Lago instance. Refer to [https://github.com/getlago/lago](https://github.com/getlago/lago) or use Lago cloud.
77
+
To follow along the examples, start a Lago instance. Refer to [https://github.com/getlago/lago](https://github.com/getlago/lago) or use Lago Cloud.
78
78
79
79
Follow these brief steps to configure the Lago:
80
80
@@ -83,7 +83,7 @@ Follow these brief steps to configure the Lago:
83
83
3. Create a Plan and add the created metric to it. Its code doesn't matter, you can specify as much as you like. In the `Usage-based charges` section, add the billable metric you just created as a `Metered charge` item. Specify the default price as `1$`. Add a filter, use `tier: expensive` to perform the filtering, and specify its price as `10$`.
84
84
4. Select an existing or create a new consumer to assign the Plan you just created to it. You need to specify a `Subscription external ID` (or you can have Lago generate it), which will be used as the APISIX consumer username.
85
85
86
-
Next we need to configure the APISIX for demonstrates.
86
+
Next we need to configure APISIX for demonstrations.
87
87
88
88
:::note
89
89
@@ -99,7 +99,7 @@ admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"/
99
99
100
100
The following example demonstrates how you can configure the `lago` Plugin on a Route to measuring API call usage.
101
101
102
-
Create a Route 1 with the `lago`, `request-id`, `key-auth`Plugin and configure it:
102
+
Create a Route with the `lago`, `request-id`, `key-auth`Plugins as such:
103
103
104
104
```shell
105
105
curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
@@ -129,7 +129,7 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
129
129
}'
130
130
```
131
131
132
-
Create Route 2:
132
+
Create a second route with the `lago`, `request-id`, `key-auth` Plugin as such:
133
133
134
134
```shell
135
135
curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
@@ -162,7 +162,7 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
162
162
}'
163
163
```
164
164
165
-
Creating Consumer:
165
+
Create a Consumer:
166
166
167
167
```shell
168
168
curl "http://127.0.0.1:9180/apisix/admin/consumers" -X PUT \
@@ -177,7 +177,7 @@ curl "http://127.0.0.1:9180/apisix/admin/consumers" -X PUT \
177
177
}'
178
178
```
179
179
180
-
Send three requests to two separate routes:
180
+
Send three requests to the two routes respectively:
You should receive `HTTP/1.1 200 OK` responses for all requests.
192
192
193
-
Wait a few seconds, go to the `Developer` page in the Lago dashboard, look at `Events` and you will see 6 event entries sent by APISIX.
193
+
Wait a few seconds, then navigate to the __Developer__ page in the Lago dashboard. Under __Events__, you should see 6 event entries sent by APISIX.
194
194
195
-
If the self-hosted instance's event worker is configured correctly (or if you're using Lago Cloud), you can also see the total amount consumed in real time in the consumer's subscription usage, which should be `3 * 1$ + 3 * 10$ = 33$` according to our demo use case.
195
+
If the self-hosted instance's event worker is configured correctly (or if you're using Lago Cloud), you can also see the total amount consumed in real time in the consumer's subscription usage, which should be `3 * $1 + 3 * $10 = $33` according to our demo use case.
196
196
197
197
## FAQ
198
198
199
-
### What's this for?
199
+
### Purpose of the Plugin
200
200
201
201
When you make an effort to monetize your API, it's hard to find a ready-made, low-cost solution, so you may have to build your own billing stack, which is complicated.
202
202
@@ -225,7 +225,7 @@ Here's an [archive page](https://web.archive.org/web/20250516073803/https://getl
225
225
226
226
If the latest API changes, then you can submit an issue to inform the APISIX maintainers that this may require some changes.
227
227
228
-
### Events are not pushed properly
228
+
### Why Lago can't receive events?
229
229
230
230
Look at `error.log` for such a log.
231
231
@@ -250,7 +250,7 @@ So even if a retry is triggered because the network causes Lago to send a `succe
250
250
251
251
### Performance Impacts
252
252
253
-
The plugin is logically simple and reliable, it just builds a Lago event object for each request, buffers and sends them in bulk. The logic is not coupled to the request proxy path, so this does not cause latency to rise for requests going through the gateway.
253
+
The plugin is logically simple and reliable; it simply builds a Lago event object for each request, buffers and sends them in bulk. The logic is not coupled to the request proxy path, so this does not cause latency to rise for requests going through the gateway.
254
254
255
255
Technically, the logic is executed in the NGINX log phase and [batch processor](../batch-processor.md) timer, so this does not affect the request itself.
0 commit comments