8000 Get usage statistics for Views · Issue #179 · tableau/server-client-python · GitHub
[go: up one dir, main page]

Skip to content

Get usage statistics for Views #179

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

Closed
d45 opened this issue Apr 19, 2017 · 1 comment
Closed

Get usage statistics for Views #179

d45 opened this issue Apr 19, 2017 · 1 comment

Comments

@d45
Copy link
Contributor
d45 commented Apr 19, 2017

Currently, there is no way to get usage stats for Views using the TSC library. Getting usage stats would be helpful if you wanted to monitor how the site was being used. The stats could identify popular content and content that wasn't viewed that could be removed, etc.

You can retrieve the usage stats for views in the REST API by including a query in the URL in a GET request for views: '?includeUsageStatistics=true'

The TSC library is set up for storing this data, but it isn't implemented. The ViewItem class has the attribute total_views , but there is no way to add the usage data. To collect the data, you could add a new endpoint, similar to the populate_views() endpoint for workbooks, or you could modify the views.get() endpoint to return the data by default, or with a parameter. Whatever works best with your design model.

Here's one idea using a parameter:

From class Views:

   def get(self, req_options=None, usage=False):
          logger.info('Querying all views on site')
           url = "{0}/views?includeUsageStatistics={1}".format(self.baseurl,usage)
           server_response = self.get_request(url, req_options)
           pagination_item = PaginationItem.from_response(server_response.content)
           all_view_items = ViewItem.from_response(server_response.content)
           return all_view_items, pagination_item

This implementation works, but it changes the signature of the get method. It is false by default to mirror the REST API behavior.

Cheers,
Dave

@graysonarts
Copy link
Contributor

implemented by #242

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

No branches or pull requests

2 participants
0