-
Notifications
You must be signed in to change notification settings - Fork 896
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
BP-36: Stats documentation annotation #1786
Conversation
*Motivation* A common ask from people using bookkeeper is how they can monitor bookies and bookkeeper clients, what kind of metrics that bookkeeper exposes and what are the important metrics. Currently bookkeeper doesn't provide any metrics page for guiding people on monitoring bookkeeper services. In order to help people on this, we need to provide a few documentation pages about metrics. However if we just write such pages, those pages can quickly get out-of-dated when code is changed. The proposal here is to seek a programming way for generating metrics related pages.
run bookkeeper-server replication tests |
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.
Wonderful
I left just one question
/** | ||
* Documenting the stats. | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) |
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.
Why runtime?
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.
Because current approach requires them to be RUNTIME
. Otherwise it doesn't work.
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.
Looks good.
I have just seen the implementation
Now that you have already implemented the whole tool it is better to keep it.
Another approach would have been to implement a Java Annotation processor or to use ASM
was thinking about that as well. however that is too much work for me :( |
@sijie I totally agree. It's not worth and it is not a big deal. Thanks |
@sijie This is a really awesome start and improves user experience a lot at the beginning. @StatsDoc(name = JOURNAL_QUEUE_LATENCY,
help = "time spent in the journal queue",
parent = JOURNAL_ADD_ENTRY,
happensAfter = null)
@StatsDoc(name = JOURNAL_PROCESS_TIME_LATENCY,
help = "time spent processing data in the journal",
parent = JOURNAL_ADD_ENTRY,
happensAfter = JOURNAL_QUEUE_LATENCY) |
@dlg99 good suggestion. what is the difference between |
@sijie i.e. addEntry does bookieAddEntry and journalAddEntry so it is a parent for both. parent defines hierarchy and happensAfter simply orders sequence of siblings. |
@dlg99 gotcha. I will update the BP |
* | ||
* @return the metric name of an operation that happens after the operation of this metric. | ||
*/ | ||
default String happenAfter() { return ""; } |
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.
nit, grammar: "happensAfter" (though check with native speakers anyways)
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.
ah, I was planning to type happensAfter
. however it becomes happenAfter
:(
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.
fixed
run pr validation |
marked this BP as |
…s exposed by bookkeeper Descriptions of the changes in this PR: ### Motivation A common ask from people using bookkeeper is how they can monitor bookies and bookkeeper clients, what kind of metrics that bookkeeper exposes and what are the important metrics. Currently bookkeeper doesn't provide any metrics page for guiding people on monitoring bookkeeper services. In order to help people on this, we need to provide a few documentation pages about metrics. However if we just write such pages, those pages can quickly get out-of-dated when code is changed. ### Changes - Introduce an annotation `StatsDoc` for annotating the counters/gauges/opstats in the source code. - Provide a tool to generate the stats and their documentation into a yaml file. The yaml file will be used by the website for rendering a metrics reference page. ### Results ``` "server": "bookie_BOOKIE_READ_ENTRY_BYTES": "description": |- bytes stats of ReadEntry on a bookie "type": |- OPSTATS "bookie_WRITE_BYTES": "description": |- total bytes written to a bookie "type": |- COUNTER "bookie_BOOKIE_ADD_ENTRY": "description": |- operations stats of AddEntry on a bookie "type": |- OPSTATS "bookie_BOOKIE_RECOVERY_ADD_ENTRY": "description": |- operation stats of RecoveryAddEntry on a bookie "type": |- OPSTATS "bookie_BOOKIE_ADD_ENTRY_BYTES": "description": |- bytes stats of AddEntry on a bookie "type": |- OPSTATS "bookie_BOOKIE_FORCE_LEDGER": "description": |- total force operations occurred on a bookie "type": |- COUNTER "bookie_READ_BYTES": "description": |- total bytes read from a bookie "type": |- COUNTER "bookie_BOOKIE_READ_ENTRY": "description": |- operation stats of ReadEntry on a bookie "type": |- OPSTATS ``` Master Issue: #1786 Reviewers: Ivan Kelly <ivank@apache.org>, Jia Zhai <None> This closes #1787 from sijie/stats_generator
Descriptions of the changes in this PR:
Motivation
A common ask from people using bookkeeper is how they can monitor bookies and bookkeeper clients, what kind of metrics that bookkeeper exposes
and what are the important metrics. Currently bookkeeper doesn't provide any metrics page for guiding people on monitoring bookkeeper services.
In order to help people on this, we need to provide a few documentation pages about metrics. However if we just write such pages, those pages
can quickly get out-of-dated when code is changed. The proposal here is to seek a programming way for generating metrics related pages.
Master Issue: #1785