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

WIP: move events serverside #2661

Closed
wants to merge 67 commits into from

Conversation

alison985
Copy link
Contributor

relates to #1501 (though I don't know if it should close it)

This is a port of a change in the Mozilla fork. It was previously reviewed by Arik here: mozilla#246

It does not port the move of the query version events because that feature isn't in upstream.

Copy link
Member

@arikfr arikfr left a comment

Choose a reason for hiding this comment

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

Thanks! See my comments. It's mainly about which object_type/id/etc to use.

@@ -14,6 +14,12 @@ class AlertResource(BaseResource):
def get(self, alert_id):
alert = get_object_or_404(models.Alert.get_by_id_and_org, alert_id, self.current_org)
require_access(alert.groups, self.current_user, view_only)
self.record_event({
'action': 'view',
'timestamp': int(time.time()),
Copy link
Member

Choose a reason for hiding this comment

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

timestamp is being added by self.record_event,so no need to pass it manually (of course this applies in all other similar instances).

self.record_event({
'action': 'view',
'object_id': page,
'object_type': 'api_call',
Copy link
Member

Choose a reason for hiding this comment

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

Here the object_type should be datasource and object_id should be ds.id.

@@ -49,6 +49,12 @@ def get(self):

include_drafts = request.args.get('include_drafts') is not None

self.record_event({
'action': 'search',
'object_id': term,
Copy link
Member

Choose a reason for hiding this comment

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

We should pass term as its own field, i.e.:

self.record_event({'action': 'search', 'object_type': 'query', 'term': term})

'object_type': 'api_call',
'object_id': 'admin/outdated_queries',
'timestamp': int(time.time()),
})
Copy link
Member

Choose a reason for hiding this comment

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

action -> list
object_type -> outdated_queries

(object_id can be null and can be ommited)

'object_type': 'api_call',
'object_id': 'admin/tasks',
'timestamp': int(time.time()),
})
Copy link
Member

Choose a reason for hiding this comment

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

action -> list
object_type -> celery_tasks

'timestamp': int(time.time()),
'object_id': 'alerts',
'object_type': 'api_call'
})
Copy link
Member

Choose a reason for hiding this comment

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

Let's convert all the list actions, where you used object_type=api_call to:

action -> list
object_type -> <the relevant resource type> (in this case it will be alert, to be consistent with the other events for this type).

@alison985
Copy link
Contributor Author

@arikfr Updated. :)

@jezdez
Copy link
Member

jezdez commented Jul 19, 2018

@alison985 This needs another pass to rebase things sadly.

@vercel
Copy link

vercel bot commented Jul 22, 2018

This pull request is automatically deployed with Now.

To access deployments, click Details below or on the icon next to each push.

@alison985
Copy link
Contributor Author

@jezdez rebased

@jezdez
Copy link
Member

jezdez commented Aug 14, 2018

@alison985 We can safely ignore the Code Climate issues for now. (especially until #2727 has received some feedback)

@jezdez
Copy link
Member

jezdez commented Aug 14, 2018

Needs another rebase 🤓

self.record_event({
'action': 'list',
'object_id': 'admin/data_sources',
'object_type': 'data_sources',
Copy link
Member

Choose a reason for hiding this comment

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

The object type for this event is datasource below, but data_sources here. Should this be the same?

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 for catching these!

self.record_event({
'action': 'list',
'object_id': 'alerts',
'object_type': 'alerts'
Copy link
Member

Choose a reason for hiding this comment

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

The object type is different to what is used above. Should this be the same?

Allen Short and others added 26 commits August 16, 2018 20:08
…ash#336)

* Support authentication for URL data source (re getredash#330)

* Refactor authentication support for data sources.

Adds a new BaseHTTPQueryRunner class.
In the long run we'll be able to install additional dependencies by
having an own Dockerfile to build images based on the Redash image
but that installs additional Python dependencies. But until we have
a fork with lots of changes ourselves we need to do it this way.

Redash-stmo contains the ability to hook up our own Dockerflow
library.

Refs #13
Refs getredash#37
…dash#311)

Extend the Remote User Auth backend with the ability to pass remote user groups via a configurable request header similar to the REMOTE_USER header.

Refs getredash#37.

If enabled the feature allows checks the header value against a configured list of group names, including the ability to use UNIX shell-style wildcards.
* Use --max-tasks-per-child as per celery documentation

* Set --max-memory-per-child to 1/4th of total system memory

* Split exec command over multiple lines

* Fix memory variable typo
Merge upstream to my fork's master
@alison985
Copy link
Contributor Author

@jezdez I made changes based on your comments, rebased again, and address the CodeClimate issues that I deemed reasonable and were in files touched by this PR.

Now there are a TON of other files changed in this PR that I didn't touch. I'm adding WIP to the title of the PR so it doesn't get accidentally merged and will send you a meeting request to discuss.

@alison985 alison985 changed the title move events serverside WIP: move events serverside Aug 20, 2018
@alison985 alison985 closed this Aug 26, 2018
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.

6 participants