-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix MsgDropRate missing from NonPersistentTopics stats output. #11119
Fix MsgDropRate missing from NonPersistentTopics stats output. #11119
Conversation
* @throws PulsarAdminException | ||
* Unexpected error | ||
*/ | ||
NonPersistentTopicStats getStatsNonPersistent(String topic, boolean getPreciseBacklog, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The NonPersistentTopicStats also implement the TopicStats, So I think we do not need to introduce a new method in the API? We can just use the getStats
method, and if users want to get the msgDropRate, they can convert TopicStats to NonPersistentTopicStats directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codelipenghui
I just tried that, once the response object got deserialized as TopicStats, it's actual type will be TopicStatsImpl at client side(we set the binding at ObjectMapperFactory ref), even server send it out as NonPersistentTopicStatsImpl, and we won't be able to convert the object back to NonPersistentTopicStats or NonPersistentTopicStatsImpl.
I think we'll have to deserialize the response to the desired type when we receive it. So a new method is needed for this purpose.
/pulsarbot rerun-failure-checks |
@codelipenghui addressed your comments, PTAL |
@codelipenghui Can you review this? |
public List<? extends NonPersistentPublisherStats> nonPersistentPublishers; | ||
|
||
/** Map of non-persistent subscriptions with their individual statistics. */ | ||
public Map<String, ? extends NonPersistentSubscriptionStats> nonPersistentSubscriptions; | ||
|
||
/** Map of non-persistent replication statistics by remote cluster context. */ | ||
public Map<String, ? extends NonPersistentReplicatorStats> nonPersistentReplicators; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add @JsonAlias to make sure the name that exposed to the JSON result not changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JsonAlias seems only used during deserialization, used @JasonProperty to keep the output field name. Updated issue description.
…e#11119) Fixes #apache#10495 ### Motivation MsgDropRate info is missing after NonPersistentTopics admin api merged with Topics admin api. This PR is trying to fix this. ### Modifications Seems due to API merging, data is not properly deserialized in admin client. And also due to the added TopicsStats interface, the field hiding causing weird behavior with Jackson so fields in NonPersistentTopicStatsImpl intended to hide superclass' fields are not shown in output. Fixing by not using same field name to hide superclass fields and use @JsonIgnore to hide them from output. And add new fields to store subscription/publisher/replicator info for NonPersistentTopic. This does change the output name of those info, but it only changed in cli output, for admin client the old getSubscriptions/getSubscriptions/getReplication will still work.
Fixes ##10495 ### Motivation MsgDropRate info is missing after NonPersistentTopics admin api merged with Topics admin api. This PR is trying to fix this. ### Modifications Seems due to API merging, data is not properly deserialized in admin client. And also due to the added TopicsStats interface, the field hiding causing weird behavior with Jackson so fields in NonPersistentTopicStatsImpl intended to hide superclass' fields are not shown in output. Fixing by not using same field name to hide superclass fields and use @JsonIgnore to hide them from output. And add new fields to store subscription/publisher/replicator info for NonPersistentTopic. This does change the output name of those info, but it only changed in cli output, for admin client the old getSubscriptions/getSubscriptions/getReplication will still work. (cherry picked from commit 0aca5f9)
…e#11119) Fixes #apache#10495 MsgDropRate info is missing after NonPersistentTopics admin api merged with Topics admin api. This PR is trying to fix this. Seems due to API merging, data is not properly deserialized in admin client. And also due to the added TopicsStats interface, the field hiding causing weird behavior with Jackson so fields in NonPersistentTopicStatsImpl intended to hide superclass' fields are not shown in output. Fixing by not using same field name to hide superclass fields and use @JsonIgnore to hide them from output. And add new fields to store subscription/publisher/replicator info for NonPersistentTopic. This does change the output name of those info, but it only changed in cli output, for admin client the old getSubscriptions/getSubscriptions/getReplication will still work. (cherry picked from commit 0aca5f9) (cherry picked from commit 8ce9e2d)
…e#11119) Fixes #apache#10495 ### Motivation MsgDropRate info is missing after NonPersistentTopics admin api merged with Topics admin api. This PR is trying to fix this. ### Modifications Seems due to API merging, data is not properly deserialized in admin client. And also due to the added TopicsStats interface, the field hiding causing weird behavior with Jackson so fields in NonPersistentTopicStatsImpl intended to hide superclass' fields are not shown in output. Fixing by not using same field name to hide superclass fields and use @JsonIgnore to hide them from output. And add new fields to store subscription/publisher/replicator info for NonPersistentTopic. This does change the output name of those info, but it only changed in cli output, for admin client the old getSubscriptions/getSubscriptions/getReplication will still work.
Fixes ##10495
Motivation
MsgDropRate info is missing after NonPersistentTopics admin api merged with Topics admin api. This PR is trying to fix this.
Modifications
Seems due to API merging, data is not properly deserialized in admin client.
And also due to the added TopicsStats interface, the field hiding causing weird behavior with Jackson so fields in NonPersistentTopicStatsImpl intended to hide superclass' fields are not shown in output.
Fixing by not using same field name to hide superclass fields and use @JsonIgnore to hide them from output. And add new fields to store subscription/publisher/replicator info for NonPersistentTopic.
This does change the output name of those info, but it only changed in cli output, for admin client the old getSubscriptions/getSubscriptions/getReplication will still work.
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changes