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

Adding "total" in API responses + database stats in "/status" endpoint #635

Merged
merged 2 commits into from
Oct 16, 2015

Conversation

subnetmarco
Copy link
Member

This PR implements:

  • Adding a total field in each API response, that counts the total number of elements in the table regardless of the size and offset specified.
  • Not showing the next link if there are no more next elements to show.
  • Adds database statistics to the /status endpoint, and moves the old stats into a server parent key, like:
{
  "server": {
    "connections_handled": 1,
    "connections_reading": 0,
    "connections_active": 1,
    "connections_waiting": 0,
    "connections_writing": 1,
    "total_requests": 3,
    "connections_accepted": 1
  },
  "database": {
    "oauth2_tokens": 1,
    "jwt_secrets": 0,
    "response_ratelimiting_metrics": 0,
    "keyauth_credentials": 0,
    "oauth2_authorization_codes": 0,
    "acls": 0,
    "apis": 2,
    "hmacauth_credentials": 0,
    "consumers": 1,
    "plugins": 1,
    "oauth2_credentials": 1,
    "basicauth_credentials": 0,
    "ratelimiting_metrics": 0
  }
}

subnetmarco added a commit that referenced this pull request Oct 16, 2015
Adding "total" in API responses + database stats in "/status" endpoint
@subnetmarco subnetmarco merged commit 9f2e83a into next Oct 16, 2015
@subnetmarco subnetmarco deleted the chore/api-totals branch October 16, 2015 00:10
@thibaultcha
Copy link
Member

The correct namespace for this is 'feat'. Also would have appreciate a review before merging

@@ -553,9 +553,12 @@ end
-- @return `res`
-- @return `err`
-- @return `filtering` A boolean indicating if ALLOW FILTERING was needed by the query
function BaseDao:count_by_keys(where_t)
function BaseDao:count_by_keys(where_t, page_size, paging_state)
local select_q, where_columns, filtering = query_builder.count(self._table, where_t, self._column_family_details)
Copy link
Member

Choose a reason for hiding this comment

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

actually count_q

Copy link
Member Author

Choose a reason for hiding this comment

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

why?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh you mean instead of select_q - the PR that introduced the count function has been waiting for a while under the dao/count branch, so I merged it. Didn't spot this.

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.

2 participants