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

Issue 674: Documentation for HTTP endpoints #721

Closed
wants to merge 3 commits into from

Conversation

zhaijack
Copy link
Contributor

Descriptions of the changes in this PR:
Add a document for http endpoints.

title: BookKeeper http endpoints
---

This document is to introducing BookKeeper http endpoints that could be used for BookKeeper administration.
Copy link
Contributor

Choose a reason for hiding this comment

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

This document introduces BookKeeper HTTP endpoints, which can be used ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, will change it.

---

This document is to introducing BookKeeper http endpoints that could be used for BookKeeper administration.
If user want to use this feature, parameter "httpServerEnabled" need to be set to "true" in file conf/bk_server.conf.
Copy link
Contributor

Choose a reason for hiding this comment

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

To use this feature, set "httpServerEnabled" to "true" in file conf/bk_server.conf.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, wll change it.


## All the endpoints

Currently all the http endpoints could be divided into these 4 components:
Copy link
Contributor

Choose a reason for hiding this comment

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

The HTTP endpoints are divided into the following groups:

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps they should be grouped by endpoints which are bookie specific and those which are for the whole cluster.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. will change the words.
And it is a good idea to do a new grouping following your suggestion. will consider to do it, and opened a new issue #722 to tracking this, but as the requirements goes on, maybe 2 big groups need futher dividing.

|200 | Successful operation |
|403 | Don't have permission |
|404 | Error handling |
1. Method: PUT
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there already an admin command to do this? Does this access a config in zookeeper or on the local disk?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

seems not command for this. it only update the inmemory value, which could be used for later ops.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure it's wise to expose functionality like this at all. It's just asking for people to change configuration in an uncontrolled and unpredictable manner. Was there a driving use case to add this to the http endpoints?

Copy link
Member

Choose a reason for hiding this comment

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

@ivankelly I think http endpoints (and configuration service) was introduced by twitter initially and Jia extended it to cover all admin commands. I can see this is useful on dynamic configurations. but Twitter folks can chime in more on the use cases.

BTW If there is a question on a feature whether this should be included or not, we should probably be discussing a bit earlier on the coding pull request, rather than later on the documentation pull request. (for future improvements)


| Name | Type | Required | Description |
|:-----|:-----|:---------|:------------|
|metadata | Boolean | No | whether print out metadata |
Copy link
Contributor

Choose a reason for hiding this comment

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

api doesn't print.

|404 | Error handling |

### Endpoint: /api/v1/ledger/read/?ledger_id=<ledger_id>&start_entry_id=<start_entry_id>&end_entry_id=<end_entry_id>
1. Method: GET
Copy link
Contributor

Choose a reason for hiding this comment

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

What format are these entries returned in?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks. will add the format


## Config

### Endpoint: /api/v1/config/server_config
Copy link
Contributor

Choose a reason for hiding this comment

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

The format of the response should be included in each call.

Copy link
Contributor Author

@zhaijack zhaijack Nov 13, 2017

Choose a reason for hiding this comment

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

Thanks. the response is construct of code and body, and some of the command the response body not contains too much info. Will add the useful respone body format.


| Name | Type | Required | Description |
|:-----|:-----|:---------|:------------|
|bookie_src | String | Yes | bookie source to recovery |
Copy link
Contributor

Choose a reason for hiding this comment

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

String or array of strings?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should the strings have a specific format?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

strings of host names or IP:Port

Copy link
Member

Choose a reason for hiding this comment

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

@zhaijack with my latest change in #612, it should be a list of strings.


| Name | Type | Required | Description |
|:-----|:-----|:---------|:------------|
|missingreplica | String | No | missing replica bookieId |
Copy link
Contributor

Choose a reason for hiding this comment

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

These parameters should have underscores between words to be consistent.

Copy link
Member

Choose a reason for hiding this comment

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

@ivankelly I think this is a documentation for what existed. if the parameters should be changed, we should create an issue for it.


| Name | Type | Required | Description |
|:-----|:-----|:---------|:------------|
|type | String | Yes | value: rw/ro , list read-write/read-only bookies. |
Copy link
Contributor

Choose a reason for hiding this comment

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

rw/ro is the value? or rw or ro?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will change to "rw or ro"

@asfgit
Copy link

asfgit commented Nov 13, 2017

FAILURE

--none--

@sijie
Copy link
Member

sijie commented Nov 13, 2017

/cc @lucperkins for documentation reviews.

@lucperkins
Copy link
Contributor

For the sake of maintainability, I think it'd be best to generate these docs from a JSON or YAML definition using a template, but I can do that work in a follow-up PR

@sijie
Copy link
Member

sijie commented Nov 13, 2017

@lucperkins a nice point! +1

@@ -28,6 +28,8 @@ groups:
endpoint: metrics
- name: Upgrade
endpoint: upgrade
- name: BookKeeper http endpoint
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest changing "http endpoint" to "Admin REST API", which would be more accurate.

Copy link
Member

Choose a reason for hiding this comment

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

thanks. will change it.

@@ -0,0 +1,394 @@
---
title: BookKeeper http endpoints
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest changing "http endpoint" to "Admin REST API", which would be more accurate.

Copy link
Member

@jiazhai jiazhai Nov 17, 2017

Choose a reason for hiding this comment

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

thanks. will change it.

@@ -28,6 +28,8 @@ groups:
endpoint: metrics
- name: Upgrade
endpoint: upgrade
- name: BookKeeper http endpoint
Copy link
Contributor

Choose a reason for hiding this comment

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

Capitalize HTTP

Copy link
Contributor

Choose a reason for hiding this comment

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

“endpoints” instead of “endpoint”

Copy link
Member

Choose a reason for hiding this comment

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

thanks. will follow @sijie 's comments

---

This document introduces BookKeeper HTTP endpoints, which can be used for BookKeeper administration.
To use this feature, set "httpServerEnabled" to "true" in file conf/bk_server.conf.
Copy link
Contributor

Choose a reason for hiding this comment

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

All variable and file names should be in backticks rather than quotation marks

Copy link
Member

Choose a reason for hiding this comment

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

Thanks. will change it.


## All the endpoints

Currently all the http endpoints could be divided into these 4 components:
Copy link
Contributor

Choose a reason for hiding this comment

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

HTTP should be capitalized when used in sentences

Copy link
Member

Choose a reason for hiding this comment

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

Thanks. will change it.

@asfgit
Copy link

asfgit commented Nov 17, 2017

FAILURE

--none--

@jiazhai jiazhai added this to the 4.7.0 milestone Nov 18, 2017
@jiazhai jiazhai closed this in c8c3f67 Nov 18, 2017
jiazhai added a commit that referenced this pull request Nov 18, 2017
Descriptions of the changes in this PR:
Add a document for http endpoints.

Author: Jia Zhai <zhaijia@apache.org>

Reviewers: Luc Perkins <lucperkins@gmail.com>, Sijie Guo <sijie@apache.org>

This closes #721 from zhaijack/http_doc, closes #674

(cherry picked from commit c8c3f67)
Signed-off-by: Jia Zhai <zhaijia@apache.org>
@sijie sijie modified the milestones: 4.7.0, 4.6.0 Nov 22, 2017
philipsu522 pushed a commit to philipsu522/bookkeeper that referenced this pull request Dec 8, 2017
Descriptions of the changes in this PR:
Add a document for http endpoints.

Author: Jia Zhai <zhaijia@apache.org>

Reviewers: Luc Perkins <lucperkins@gmail.com>, Sijie Guo <sijie@apache.org>

This closes apache#721 from zhaijack/http_doc, closes apache#674
aojea pushed a commit to aojea/bookkeeper that referenced this pull request Dec 16, 2017
Descriptions of the changes in this PR:
Add a document for http endpoints.

Author: Jia Zhai <zhaijia@apache.org>

Reviewers: Luc Perkins <lucperkins@gmail.com>, Sijie Guo <sijie@apache.org>

This closes apache#721 from zhaijack/http_doc, closes apache#674
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants