zengguan opened a new pull request, #17610:
URL: https://github.com/apache/pulsar/pull/17610
### Motivation
Add a new api named clientStats to proxy stats. After the producer or
consumer is created, we can find some client stats like topic or producer
name/subscription name。This is useful for knowing which topic the client is
connecting to.
```json
{
"/127.0.0.1:58774":{
"channelId":"b5b8e701",
"type":"producer",
"clientId":0,
"clientName":"client01",
"createTime":"2022-09-13 11:40:56",
"topic":"persistent://pulsar/default/test-topic-partition-0"
},
"/127.0.0.1:58775":{
"channelId":"bcd86c75",
"type":"producer",
"clientId":1,
"clientName":"client01",
"createTime":"2022-09-13 11:40:56",
"topic":"persistent://pulsar/default/test-topic-partition-1"
}
}
```
### Modifications
Added a new `ClientStats` class. This class return some client stats like
`producerName/subscriptionName`. When we process a create producer request or
create a subscribe request, we add client stats to the map. If the connection
is closed, we remove client stats from the map.
### Verifying this change
- [x] 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:
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [x] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] Anything that affects deployment
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [x] `doc-required`
(Your PR needs to update docs and you will update later)
- [ ] `doc-not-needed`
(Please explain why)
- [ ] `doc`
(Your PR contains doc changes)
- [ ] `doc-complete`
(Docs have been already added)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]