Skip to content

Commit e5df2bf

Browse files
bzp2010kayx23
andauthored
Apply suggestions from code review
Co-authored-by: Traky Deng <[email protected]>
1 parent 3258665 commit e5df2bf

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

docs/en/latest/plugins/lago.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ This Plugin supports using batch processors to aggregate and process events in a
7474

7575
The examples below demonstrate how you can configure `lago` Plugin for typical scenario.
7676

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.
7878

7979
Follow these brief steps to configure the Lago:
8080

@@ -83,7 +83,7 @@ Follow these brief steps to configure the Lago:
8383
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$`.
8484
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.
8585

86-
Next we need to configure the APISIX for demonstrates.
86+
Next we need to configure APISIX for demonstrations.
8787

8888
:::note
8989

@@ -99,7 +99,7 @@ admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"/
9999

100100
The following example demonstrates how you can configure the `lago` Plugin on a Route to measuring API call usage.
101101

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:
103103

104104
```shell
105105
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 \
129129
}'
130130
```
131131

132-
Create Route 2:
132+
Create a second route with the `lago`, `request-id`, `key-auth` Plugin as such:
133133

134134
```shell
135135
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 \
162162
}'
163163
```
164164

165-
Creating Consumer:
165+
Create a Consumer:
166166

167167
```shell
168168
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 \
177177
}'
178178
```
179179

180-
Send three requests to two separate routes:
180+
Send three requests to the two routes respectively:
181181

182182
```shell
183183
curl "http://127.0.0.1:9080/get"
@@ -190,13 +190,13 @@ curl "http://127.0.0.1:9080/anything"
190190

191191
You should receive `HTTP/1.1 200 OK` responses for all requests.
192192

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.
194194

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.
196196

197197
## FAQ
198198

199-
### What's this for?
199+
### Purpose of the Plugin
200200

201201
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.
202202

@@ -225,7 +225,7 @@ Here's an [archive page](https://web.archive.org/web/20250516073803/https://getl
225225

226226
If the latest API changes, then you can submit an issue to inform the APISIX maintainers that this may require some changes.
227227

228-
### Events are not pushed properly
228+
### Why Lago can't receive events?
229229

230230
Look at `error.log` for such a log.
231231

@@ -250,7 +250,7 @@ So even if a retry is triggered because the network causes Lago to send a `succe
250250

251251
### Performance Impacts
252252

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.
254254

255255
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.
256256

0 commit comments

Comments
 (0)