feat: add batch process metrics#3070
Merged
spacewander merged 18 commits intoDec 24, 2020
Merged
Conversation
spacewander
requested changes
Dec 17, 2020
| local function gen_arr(...) | ||
| clear_tab(inner_tab_arr) | ||
|
|
||
| local function gen_arr(...) |
Member
There was a problem hiding this comment.
We don't need this if we can't share the table.
| table.insert(entries, entry) | ||
| -- add batch metric for every route | ||
| if batch_metrics then | ||
| batch_metrics:set(#entries, prometheus.gen_arr(self.name, self.route_id, self.server_addr)) |
Member
There was a problem hiding this comment.
We can store the table: self.xxx = {self.name, self.route_id, self.server_addr}.
Contributor
|
The test case reported an error and we need to resolve it. ^ _ ^ |
spacewander
reviewed
Dec 20, 2020
| table.insert(entries, entry) | ||
| -- add batch metric for every route | ||
| if batch_metrics then | ||
| local label = {self.name, self.route_id, self.server_addr} |
Member
There was a problem hiding this comment.
Look like we can store the label in self?
spacewander
reviewed
Dec 21, 2020
| GET /apisix/prometheus/metrics | ||
| --- error_code: 200 | ||
| --- response_body_like eval | ||
| qr/apisix_batch_process_entries{name="sys-logger",route_id="9"/ |
Contributor
Author
There was a problem hiding this comment.
plugin set error. 😄
spacewander
reviewed
Dec 24, 2020
| if not batch_metrics and prometheus.get_prometheus() and self.name | ||
| and self.route_id and self.server_addr then | ||
| batch_metrics = prometheus.get_prometheus():gauge("batch_process_entries", | ||
| "batch process remaining entries", |
Member
There was a problem hiding this comment.
spacewander
reviewed
Dec 24, 2020
| * `Bandwidth`: Total Bandwidth (egress/ingress) flowing through apisix. This metric is available per service and as a sum across all services. | ||
| * `etcd reachability`: A gauge type with a value of 0 or 1, representing if etcd can be reached by a apisix or not. | ||
| * `Connections`: Various Nginx connection metrics like active, reading, writing, and number of accepted connections. | ||
| * `Batch process entries`: A gauge type, when we use plugins such as: sys logger, http logger, sls logger, tcp logger, udp logger and zipkin, the surplus entries which not sended will be statistics in the metrics. |
Member
There was a problem hiding this comment.
Should mention the batch processor.
Some suggestions:
surplus entries => entries
not sended => hasn't been sent
statistics => counted
spacewander
approved these changes
Dec 24, 2020
tokers
approved these changes
Dec 24, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
fix: #2693
add metric for batch process, such as: sls logger, tcp logger ,udp logger , http logger, sys logger.
with this feature, users can use the metrics find how many entries remaining in batch process.
Pre-submission checklist: