-
-
Notifications
You must be signed in to change notification settings - Fork 929
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
Add Fastly log processor #1176
Add Fastly log processor #1176
Conversation
Rubocop is not a happy. π± I'll amend the commits. π |
4158ccb
to
13f1bab
Compare
@@ -3,4 +3,4 @@ | |||
Delayed::Worker.max_run_time = 5.minutes | |||
Delayed::Worker.logger = Logger.new(Rails.root.join('log/delayed_job.log')) | |||
|
|||
PRIORITIES = { push: 1, download: 2, web_hook: 3 }.freeze | |||
PRIORITIES = { push: 1, download: 2, web_hook: 3, download_metrics: 4 }.freeze |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we shorten this to stats
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate this constant been here :( eventually i wanna moved it out. I had that somewhere. Anyways, not in the scope of this PR
I added a few comments and it looks like this needs a rebase. |
|
||
# TODO: set real queue name | ||
# TODO: set auto_delete: true after testing | ||
shoryuken_options queue: 'TODO-add-real-queue', body_parser: :json, auto_delete: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need Shoryuken here? What's the advantage to using this when we have Delayed::Job?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need Shoryuken here? What's the advantage to using this when we have Delayed::Job?
We need a tool that uses AWS SQS as the queue. See this comment & discussion on rubygems-infrastructure.
b100d0c
to
15de30b
Compare
f9b3c19
to
1fcebe6
Compare
Weβll use shoryuken for processing SQS messages; and aws-sdk for downloading S3 files
It takes an S3 bucket & key, parses out the download counts, and bulk updated download counts in redis
The Shoryuken worker reads S3 ObjectCreated messages from SQS, and enqueues an associated FastlyLogProcessor job.
- count 304 responses as download attempts - rename download_metrics queue to stats Also add a test that 404 responses are not counted as downloads.
Now it relies on an SQS_QUEUE env var
1fcebe6
to
786c20b
Compare
LGTM π’ |
π Happy Friday πββοΈ
This implements much of rubygems/rubygems-infrastructure#35, allowing us to update Rubygem download counts in bulk using Fastly access logs rather than on each HTTP request.
I still have some cleanup to do, but wanted to get some π earlier.
To Do
stat-update
C library as part of the feature flagshoryuken
process on deploy once Chef provisions a runit script for itDeploy plan
NB that this code is disabled right now. We're not currently running a
shoryuken
worker, and so nothing would enqueue aFastlyLogProcessor
job.Once this is merged, the next step is to start running a
shoryuken
process, withFastlyLogProcessor
only logging results & not updating redis.After that I'll toggle the feature flag so
FastlyLogProcessor
updates stats, and disablestat-update
per request.FYI @dwradcliffe