You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "hangc0276 (via GitHub)" <gi...@apache.org> on 2024/05/25 00:54:58 UTC

[PR] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

hangc0276 opened a new pull request, #22778:
URL: https://github.com/apache/pulsar/pull/22778

   <!--
   ### Contribution Checklist
     
     - PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://pulsar.apache.org/contribute/develop-semantic-title/)*. 
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   -->
   
   <!-- Either this PR fixes an issue, -->
   
   Fixes #xyz
   
   <!-- or this PR is one task of an issue -->
   
   Main Issue: #xyz
   
   <!-- If the PR belongs to a PIP, please add the PIP link here -->
   
   PIP: #xyz 
   
   <!-- Details of when a PIP is required and how the PIP process work, please see: https://github.com/apache/pulsar/blob/master/pip/README.md -->
   
   ### Motivation
   
   <!-- Explain here the context, and why you're making that change. What is the problem you're trying to solve. -->
   
   ### Modifications
   
   <!-- Describe the modifications you've done. -->
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] 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
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [x] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [ ] `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: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "asafm (via GitHub)" <gi...@apache.org>.
asafm commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1623246991


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   I would like those labels we add to be consistent across in and out. Instead of using two new terms "system" and "scope", how about we add two boolean labels:
   1. `system_topic` when this is a system (internal) topic.
   2. `system_subscription` when this is a system (internal) subscription.
   
   Should look like this:
   ```
   pulsar_broker_in_bytes_total{cluster=, topic=, system_topic=true}
   pulsar_broker_out_bytes_total{cluster=, topic=, subscription=, system_subscription=true}
   pulsar_broker_out_bytes_total{cluster=, topic=, subscription=, system_subscription=true, system_topic=true}
   ```
   
   WDYT?



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "dragosvictor (via GitHub)" <gi...@apache.org>.
dragosvictor commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1621618995


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   Maybe `topic_scope` instead of `subscription_scope`, such that we can have the same label across the two I/O directions.



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "asafm (via GitHub)" <gi...@apache.org>.
asafm commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1614815257


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   I'm trying to think how this would be written in OTel, to compare.
   In OTel we won't have broker level metrics, since we will always have namespace level metrics - I believe @dragosvictor is working on adding them).
   Assuming `pulsar.broker.namespace.outgoing.size`, then it may be reasonable to have another attribute named `pulsar.system.topic=true|false`.
   
   In Prometheus, we can call the label `system_topic=true|false`.
   
   The reason I was thinking about it is that it's unlikely to put anything after `_total`, and the second reason is that nobody will understand `_internal` without going to the docs.



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "asafm (via GitHub)" <gi...@apache.org>.
asafm commented on PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#issuecomment-2143504701

   @hangc0276 I added one more comment reply which is important IMO.


-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#issuecomment-2141051243

   > Overall LGTM. But I have a question, do we need to consider the system topic, the system topic producer and consumer may be not used by users directly, but it looks like the metrics will include the traffic
   
   @horizonzy good point. I update the document and include the system topics for traffic in


-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "asafm (via GitHub)" <gi...@apache.org>.
asafm commented on PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#issuecomment-2131388430

   @dragosvictor Needs to be aware of this, as he is working on converting the existing metrics to OTel.


-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "asafm (via GitHub)" <gi...@apache.org>.
asafm commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1630126030


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   @hangc0276 wrote that there exists a situation that a normal topic will have a system subscription (maybe replication has that use case?). In that case, the attribute `topic_scope` will be confusing and doesn't match what you wish to convey: This is a normal topic and the subscription is a system one. The boolean labels help to differentiate between those use cases.



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 merged PR #22778:
URL: https://github.com/apache/pulsar/pull/22778


-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1621624193


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   `topic_scope` is also a little confusing for `pulsar_broker_out_bytes_total`. In general understanding, `topic_scope=system` means only taking system topic dispatch traffic into account. However, it means any topics with system cursors dispatch traffic.



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1620177193


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   Adding a label instead of a new metric name makes sense.
   
   For `pulsar_broker_out_bytes_total`, adding the label `subscription_scope`, which is more reasonable because we may add system cursors on any topics and those outgoing traffic should be treated as system traffic
   
   For `pulsar_broker_in_size`, adding the label `system_topic` is more reasonable.



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "dragosvictor (via GitHub)" <gi...@apache.org>.
dragosvictor commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1618136018


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   Seconded. If we can use attributes instead of multiple metric names, we can aid the discovery and understanding of these metrics, as well as offer an easy path for future extension if desired. Continuing with that second point, maybe instead of boolean label `system_topic`, we can have a string label `subscription_scope` with values `system` and `user`?



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "dragosvictor (via GitHub)" <gi...@apache.org>.
dragosvictor commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1633765907


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   Sounds good to me :+1:



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1615433662


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   That sounds a good idea
   
   For prometheus:
   ```
   pulsar_broker_out_bytes_total {system_topic="true | false"}
   pulsar_broker_in_bytes_total {system_topic="true | false"}
   ```
   
   Is that correct? Or we can should use the same name, for example
   
   ```
   pulsar_broker_out_size {system_topic="true | false"}
   pulsar_broker_in_size {system_topic="true | false"}
   ```



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "dragosvictor (via GitHub)" <gi...@apache.org>.
dragosvictor commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1625217069


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   @asafm My idea was to introduce an attribute that can be easily extended in the future if needed, which is why I proposed a string attribute. A boolean restricts this, and can introduce various combinations which might not make sense in practice (for instance, `system_subscription=true, system_topic=false` doesn't look probable IMO).
   
   WDYT?



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#issuecomment-2141051620

   @asafm @dragosvictor @codelipenghui @horizonzy I updated the document, and please help take a look, thanks.


-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1630975709


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   As discussed with @dragosvictor, we will use the label name `scope` instead of `topic_scope`, for example:
   ```
   pulsar_broker_in_bytes_total{cluster=, topic=, scope="system | user"}
   pulsar_broker_out_bytes_total{cluster=, topic=, scope="system | user"}
   ```
   I agree with @asafm, it will be a little confusing because the meaning of `scope` in `pulsar_broker_in_bytes_total` and `pulsar_broker_out_bytes_total` is different. 
   In `pulsar_broker_in_bytes_total`, it means system topic or user normal topic
   In `pulsar_broker_out_bytes_total`, it means system cursor or user cursor.
   
   In order to make the meaning of label in sync and easy to understand, I perfer @asafm's idea to use two separate labels. Just like:
   ```
   pulsar_broker_in_bytes_total{cluster=, system_topic="true | false" }
   pulsar_broker_out_bytes_total{cluster=, system_subscription=" true | false"}
   ```



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "asafm (via GitHub)" <gi...@apache.org>.
asafm commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1623246991


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   I would like those labels we add to be consistent across in and out. Instead of using two new terms "system" and "scope", how about we add two boolean labels:
   1. `system_topic` when this is a system (internal) topic.
   2. `system_subscription` when this is a system (internal) subscription.
   
   Should look like this:
   ```
   pulsar_broker_in_bytes_total{cluster=, topic=, system_topic=true}
   pulsar_broker_out_bytes_total{cluster=, topic=, subscription=, system_subscription=true}
   pulsar_broker_out_bytes_total{cluster=, topic=, subscription=, system_subscription=true, system_topic=true}
   ```
   
   
   WDYT?



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "dragosvictor (via GitHub)" <gi...@apache.org>.
dragosvictor commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1621626401


##########
pip/pip-355.md:
##########
@@ -0,0 +1,36 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:

Review Comment:
   Nit:
   
   ```suggestion
   To achieve the outlined goals, the proposal introduces two new broker-level metrics:
   ```



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1623714315


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   From the usage perspective, we only care about the `system_subscription` in `pulsar_broker_out_bytes_total`, and do not need system_topic, which will make the metric generation complex.
   The following two metric is enough:
   ```
   pulsar_broker_in_bytes_total{cluster=, topic=, system_topic=true}
   pulsar_broker_out_bytes_total{cluster=, topic=, subscription=, system_subscription=true}
   ```
   But it will fall back to this pair of metrics having different labels. I'm not sure if it is acceptable.



-- 
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] [improve] [pip] PIP-355: Enhancing Broker-Level Metrics for Pulsar [pulsar]

Posted by "hangc0276 (via GitHub)" <gi...@apache.org>.
hangc0276 commented on code in PR #22778:
URL: https://github.com/apache/pulsar/pull/22778#discussion_r1630976165


##########
pip/pip-355.md:
##########
@@ -0,0 +1,39 @@
+# PIP-355: Enhancing Broker-Level Metrics for Pulsar
+
+# Background Knowledge
+Pulsar provides broker-level, namespace-level, and topic-level metrics to monitor and analyze the behavior of the Pulsar service. These metrics are accessible through the Prometheus metrics endpoint. Detailed explanations of all metrics can be found on the Pulsar website: [Pulsar Metrics Reference](https://pulsar.apache.org/docs/3.2.x/reference-metrics/)
+
+# Motivation
+Within Pulsar's current metrics framework, the `pulsar_out_bytes_total` metric is utilized to expose the total bytes dispatched by the broker to consumers. However, there are notable limitations and challenges associated with this metric:
+- Inclusion of system subscriptions in the total bytes out, alongside user subscriptions, complicates accurate calculation of user-specific data.
+- The granularity of the metric (namespace-level vs. topic-subscription level) impacts the scalability and resource consumption when calculating cluster-level total out bytes.
+
+# Goals
+This proposal aims to address the following objectives:
+- Simplify the process of calculating cluster-level total out bytes.
+- Enable the calculation of total out bytes dispatched to system subscriptions.
+
+# High-Level Design
+To achieve the outlined goals, the proposal introduces three new broker-level metrics:
+- `pulsar_broker_out_bytes_total`: Represents the total out bytes dispatched by the broker to consumers, encompassing both user and system subscriptions.

Review Comment:
   @dragosvictor Do you have any concerns?



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