Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

feat: have package version prefixed in PException #63

Merged
merged 3 commits into from
Nov 5, 2019

Conversation

neverchanje
Copy link

@neverchanje neverchanje commented Nov 4, 2019

Package version is necessary for debugging our clients in Xiaomi, where hundreds of users are using pegasus-java-client in different versions. Some may misuse but insist they are using the latest version (usually with less bugs). With version included in PException, we can save time for digging down to the root cause.

How does it work

We use maven-jar-plugin to inject the version during packaging. To obtain the version we use

PException.class.getPackage().getImplementationVersion()

When unit test the version is set "{version}" as a place-holder.

Finally the exception message of a PException is like:

com.xiaomi.infra.pegasus.client.PException: 1.11.8-thrift-0.11.0-inlined: com.xiaomi.infra.pegasus.rpc.ReplicationException: ERR_OBJECT_NOT_FOUND: [table=temp,operation=put,replicaServer=127.0.0.1:34801,gpid=(gpid(2.1))] The replica server doesn't serve this partition!"

@neverchanje neverchanje merged commit 0ec8cb3 into XiaoMi:thrift-0.11.0-inlined Nov 5, 2019
@neverchanje neverchanje deleted the version branch November 5, 2019 06:10
foreverneverer pushed a commit to foreverneverer/pegasus-java-client that referenced this pull request Nov 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants