You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "dragosvictor (via GitHub)" <gi...@apache.org> on 2024/07/16 16:55:10 UTC
[PR] [feat][misc] PIP-264: Add OpenTelemetry HTTP rate limiting filter metric [pulsar]
dragosvictor opened a new pull request, #23042:
URL: https://github.com/apache/pulsar/pull/23042
[PIP-264](https://github.com/apache/pulsar/blob/master/pip/pip-264.md)
### Motivation
Adds metrics for the HTTP `RateLimitingFilter` class, currently exposed as Prometheus metric `pulsar_broker_http_rejected_requests` ([ref](https://github.com/apache/pulsar/blob/23163f97b7e971e8e6cc07a6e20899c49e435bef/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/web/RateLimitingFilter.java#L40)).
### Modifications
- Added metrics, as described by https://github.com/apache/pulsar-site/pull/944, to the OpenTelemetry pipeline.
- Deviating from the exiting design, the new metric exposes counters for both accepted and rejected requests. The cost for doing this is very small, and we get increased visibility into the server.
### Verifying this change
- [x] Make sure that the change passes the CI checks.
This change added tests and can be verified as follows:
- Updated tests `WebServiceTest#testRateLimiting` to validate the metric counts.
### Does this pull request potentially affect one of the following parts:
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [x] The metrics: _As described in https://github.com/apache/pulsar-site/pull/944_
- [ ] Anything that affects deployment
### Documentation
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [x] `doc-required` https://github.com/apache/pulsar-site/pull/944
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: https://github.com/dragosvictor/pulsar/pull/43
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [feat][misc] PIP-264: Add OpenTelemetry HTTP rate limiting filter metric [pulsar]
Posted by "dragosvictor (via GitHub)" <gi...@apache.org>.
dragosvictor commented on code in PR #23042:
URL: https://github.com/apache/pulsar/pull/23042#discussion_r1680335193
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/web/RateLimitingFilter.java:
##########
@@ -50,9 +71,11 @@ public void init(FilterConfig filterConfig) throws ServletException {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
if (limiter.tryAcquire()) {
+ rateLimitRequestCounter.add(1, Result.ACCEPTED.attributes);
Review Comment:
Unfortunately these counter classes are final in OpenTelemetry, so adding or modifying their functionality is not possible without some serious hacking.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [feat][misc] PIP-264: Add OpenTelemetry HTTP rate limiting filter metric [pulsar]
Posted by "heesung-sn (via GitHub)" <gi...@apache.org>.
heesung-sn commented on code in PR #23042:
URL: https://github.com/apache/pulsar/pull/23042#discussion_r1680200109
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/web/RateLimitingFilter.java:
##########
@@ -50,9 +71,11 @@ public void init(FilterConfig filterConfig) throws ServletException {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
if (limiter.tryAcquire()) {
+ rateLimitRequestCounter.add(1, Result.ACCEPTED.attributes);
Review Comment:
can we overload this add function to be `rateLimitRequestCounter.add(Result.ACCEPTED.attributes);` only?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [feat][misc] PIP-264: Add OpenTelemetry HTTP rate limiting filter metric [pulsar]
Posted by "dao-jun (via GitHub)" <gi...@apache.org>.
dao-jun closed pull request #23042: [feat][misc] PIP-264: Add OpenTelemetry HTTP rate limiting filter metric
URL: https://github.com/apache/pulsar/pull/23042
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [feat][misc] PIP-264: Add OpenTelemetry HTTP rate limiting filter metric [pulsar]
Posted by "merlimat (via GitHub)" <gi...@apache.org>.
merlimat merged PR #23042:
URL: https://github.com/apache/pulsar/pull/23042
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org