Skip to content

Add Fastly log processor#1176

Merged
ktheory merged 9 commits into
rubygems:masterfrom
ktheory:fastly-log-processor
Feb 18, 2016
Merged

Add Fastly log processor#1176
ktheory merged 9 commits into
rubygems:masterfrom
ktheory:fastly-log-processor

Conversation

@ktheory

@ktheory ktheory commented Jan 15, 2016

Copy link
Copy Markdown
Member

👋 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

  • add a feature flag to control whether to have FastlyLogProcessor actually update stats, or just log results. (It would only log initially.)
  • figure out how to disable the stat-update C library as part of the feature flag
  • Cleanup & test shoryuken config, preferably loading SQS queue names from ENV vars
  • Make another PR to run a shoryuken process on deploy once Chef provisions a runit script for it

Deploy plan

NB that this code is disabled right now. We're not currently running a shoryuken worker, and so nothing would enqueue a FastlyLogProcessor job.

Once this is merged, the next step is to start running a shoryuken process, with FastlyLogProcessor only logging results & not updating redis.

After that I'll toggle the feature flag so FastlyLogProcessor updates stats, and disable stat-update per request.

FYI @dwradcliffe

@ktheory

ktheory commented Jan 15, 2016

Copy link
Copy Markdown
Member Author

Rubocop is not a happy. 😱

I'll amend the commits. 😄

@ktheory ktheory force-pushed the fastly-log-processor branch 2 times, most recently from 4158ccb to 13f1bab Compare January 21, 2016 14:50
Comment thread config/initializers/delayed_job.rb Outdated

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member

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

@dwradcliffe

Copy link
Copy Markdown
Member

I added a few comments and it looks like this needs a rebase.

Comment thread app/jobs/sqs_worker.rb Outdated

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@qrush:

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.

@ktheory ktheory force-pushed the fastly-log-processor branch 2 times, most recently from b100d0c to 15de30b Compare February 17, 2016 16:25
@ktheory ktheory force-pushed the fastly-log-processor branch from f9b3c19 to 1fcebe6 Compare February 17, 2016 20:57
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
@ktheory ktheory force-pushed the fastly-log-processor branch from 1fcebe6 to 786c20b Compare February 17, 2016 21:09
@dwradcliffe

Copy link
Copy Markdown
Member

LGTM 🚢

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.

5 participants