Skip to content
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

KAFKA-3809: Auto-generate documentation for topic-level configuration #1527

Closed
wants to merge 16 commits into from

Conversation

wushujames
Copy link
Contributor

@wushujames wushujames commented Jun 20, 2016

@ijuma said that it would make sense to split out this work from KAFKA-3234, since KAFKA-3234 had both a mechanical change (generating docs) as well as a change requiring discussion (deprecating/renaming config options).

@jjkoshy, I hope you don't mind that I took over this work. It's been 3 months since the last activity on KAFKA-3234, so I thought it would be okay to take over.

This work is essentially is the first 5-6 commits from Joel's #907. However, since I'm not very experienced with git, I didn't do a direct merge/rebase, but instead largely hand-merged it. I did some minor cleanup. All credit goes to Joel, all blame goes to me. :)

For reference, I attached the auto-generated configuration.html file (as a PDF, because github won't let me attache html).
configuration.pdf

This is my first time writing Scala, so let me know if there are any changes needed.

I don't know who is the right person to review this. @ijuma, can you help me redirect this to the appropriate person? Thanks.

@ijuma
Copy link
Contributor

ijuma commented Jun 20, 2016

Maybe @gwenshap.

@ijuma
Copy link
Contributor

ijuma commented Jun 20, 2016

Thanks for picking this up by the way. :)

@wushujames
Copy link
Contributor Author

Aside from copy/pasting the descriptions from the old docs into the new docs, I chose not to correct any of the descriptions in this, to make this a mostly mechanical change. I figured that a mechanical change could go in quickly, while new wording might require a couple iterations back and forth.

However, I noticed a couple things that are wrong/could be improved. For example, the description for flush.messages wrongly says

This setting can be overridden on a per-topic basis

when it already is a topic-level config. And the topic-level description of flush.messages is actually better than the broker level config, so it would make sense to update the broker level config.

Should I make those improvements? I can make them in a separate checkin, since those might require more discussion.

val MinInSyncReplicasDoc = "If number of insync replicas drops below this number, we stop accepting writes with" +
" -1 (or all) required acks"
val DeleteRetentionMsDoc = "The amount of time to retain delete tombstone markers " +
"for <a href=\"#compaction\">log compacted</a> topics. This setting also gives a bound " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it'd be ideal if we didn't have to include links in docs. HTML is definitely the "native" output for docs for Kafka, but it's baking weird references that we don't have easy ways of checking into strings in the source code...

On the other hand, not sure I have a better suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure either.

On the one hand, it makes the docs clearer and better. It's really useful to click from the config section (which contains a simple one-line description) to the relevant section of the doc (which explains stuff in much more detail).

On the other hand, I agree that it's weird to have references in it that are not useful in isolation. The links will look weird and not make sense in the toRst() output, for example.

We could add the idea of a "footnote", which is added to the docs to say "for more info, go to see this section". It would be something on the ConfigDef, and the toHtmlString() method could use this footnote to append to the description, and the toRst() method would not. Hm, maybe it should be called an "HTML footnote"?

Not sure if it's worth building that code infrastructure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose to leave this as is, where the HTML docs have embedded links to other sections in the Kafka webpage. Hope that's okay.

@ewencp
Copy link
Contributor

ewencp commented Aug 4, 2016

@wushujames Thanks for the changes. I had some comments, but functionally this is great and fills in a bunch of important missing topic configs. Re: docs changes, feel free to leave them to a later patch (I think the only reason it may have made sense was that I had to go double check that they were, in fact, the same as the existing docs; once I realized that, reviewing that chunk of code wasn't really worthwhile). I think this is a great improvement since nobody wants to maintain this manually, just had a couple of possible refinements.

private final val serverDefaultConfigNames = mutable.Map[String, String]()

def define(name: String, defType: ConfigDef.Type, defaultValue: Object, validator: ConfigDef.Validator,
importance: ConfigDef.Importance, doc: String, serverDefaultConfigName: String) = {
Copy link
Contributor

@ijuma ijuma Aug 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should include an explicit return type in public methods. And replace Object with Any. Applies to other define methods.

@wushujames
Copy link
Contributor Author

@ewencp @ijuma I made all the suggested changes, except for the one about embedded HTML in the descriptions.

This pull request was based off of trunk from 6 weeks ago. Do I need to merge trunk into the branch myself and update this PR, or will Github do it for me if/when you accept the pull request?

Thanks.

@ijuma
Copy link
Contributor

ijuma commented Aug 5, 2016

@wushujames, it's generally a good idea to merge trunk into the branch so that when someone (including yourself) tests your branch, they test the code as it will be once it's merged.

@wushujames
Copy link
Contributor Author

It sounds like Github would do the merge if it can, but of course you're right that it's better for me to see it myself in order to test it. And Github would not be able to resolve merge conflicts, so I should do it myself anyway.

I updated my branch to the latest trunk. I'm not sure if Jenkins is going to auto-rebuild it.

@wushujames
Copy link
Contributor Author

Jenkins claimed that the PR failed in :streams:test, but the log didn't give any indication as to where. ./gradlew :streams:test worked fine on my dev machine. Closing/reopening PR in order to kick Jenkins.

@wushujames wushujames closed this Aug 5, 2016
@wushujames wushujames reopened this Aug 5, 2016
val NumRecoveryThreadsPerDataDirDoc = "The number of threads per data directory to be used for log recovery at startup and flushing at shutdown"
val AutoCreateTopicsEnableDoc = "Enable auto creation of topic on the server"
val MinInSyncReplicasDoc = "define the minimum number of replicas in ISR needed to satisfy a produce request with acks=all (or -1)"
val MinInSyncReplicasDoc = LogConfig.MinInSyncReplicasDoc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be changed back as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not have time to follow this conversation closely, but I think the reason I did the above in #907 was to consolidate all the docs in one place - i.e., I thought it would be better to have all in KafkaConfig or LogConfig, but not both. Anyway, @wushujames thanks a lot for picking this up :) and Ewen/Ismael for helping review!

…gConfig reference it.

Fix indentation and style issues in LogConfigDef.getConfigValue().
@ewencp
Copy link
Contributor

ewencp commented Aug 7, 2016

LGTM. I think the only remaining issue is the HTML-specific links, but this is no worse than what we already had in the docs (and lack of ability to auto-generate). Will be nice to clean up later, but shouldn't block us from getting this in now.

@asfgit asfgit closed this in 778fcd0 Aug 7, 2016
efeg added a commit to efeg/kafka that referenced this pull request May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants