Closed Bug 853920 Opened 11 years ago Closed 11 years ago

[socorro-crashstats] Implement statsd on the internal middleware

Categories

(Socorro :: Webapp, task)

x86
macOS
task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: peterbe, Assigned: gabithume)

Details

(Whiteboard: [qa-])

We should record:

* number of requests made to the middleware
** # 2xx codes
** # 3xx codes
** # 4xx codes
** # 5xx codes
* time it takes to make the requests

(:lonnen, should we count each error (like 301) code or reduce it to groups like 3xx)

Most likely the tech to use is: https://github.com/andymckay/django-statsd
Target Milestone: --- → Future
metrics need to be prefixed appropriately

socorro-{env}.{component}.rest.of.the.metric

^- from env   ^- hardcoded
Summary: [socorro-crashstats] Implement statsd on all middleware usage → [socorro-crashstats] Implement statsd on all public API usage
peter -- I believe the new status is a dupe of 908334? The new analytics middleware should capture /api/ as well.

This was becoming a bug to track the same stats from the django-middleware. If that's not wanted we can close this.
Sorry. I'm a mess. 

I didn't know about #908334.

I saw that this bug was about Socorro::Webapp but the bug summary talked about middleware. 

What we need, is statsd in both places. Or all three??

1) The middleware (done by adding statsd to middleware_app.py)
2) The django 
(optionally 3) Where django makes requests to the middleware

I guess I was thinking we'd put in statsd calls on the public API which reflect what the it gets back from the middleware. 

Now I think that, since we lightly proxy the middleware in the public API we can simply have a general statsd thing for ALL django requests. 

What makes it confusing is that we use the middleware in two places in the webapp. We use it to generate the templates and we use it for the public API. 

We can either slap a generic statsd on ALL django requests but sometimes what we do is get one code from the middleware (e.g. 404) but swallow that and respond with (200 - Sorry Crash ID not found). 

Does that make any sense?

I guess we need a new bug. Something like: "Implemented statsd for middleware" and then we'll let #908334 deal with all statsd for all things Django. Then we can close this bug as invalid.
So 908334 is landed. It keeps count of requests by verb, response code, and path. It should catch public api calls.


For this bug, lets get similar tracking in the middleware. It could be as simple as copying over my django middleware from the front end.
Summary: [socorro-crashstats] Implement statsd on all public API usage → [socorro-crashstats] Implement statsd on the internal middleware
(In reply to Chris Lonnen :lonnen from comment #4)
> 
> For this bug, lets get similar tracking in the middleware. It could be as
> simple as copying over my django middleware from the front end.

You mean, in crashstats/crashstats/models.py ?
Ok, so we don't want statsd at 'views' anymore? (public API)

I am a little bit confused about the internal middleware. Where should I deal with statsd for it?
There's a django version of the socorro middleware in /socorro/ somewhere (not to be confused with webapp-django). That django instance should have a django-middleware applied to it.

Socorro uses the term middleware to mean intermediary api. In django a middleware is code that is called on in the middle of the request-response process.
I am sorry to bother you about it again but I don't know what django version are you talking about. I didn't found any script django related in /socorro/ :(

I saw that the status response is raised at places like https://github.com/mozilla/socorro/blob/master/socorro/middleware/middleware_app.py#L436, should I create the statsd in there? (Is the only place I know where I can get the status)
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [qa-]
Assignee: nobody → gabithume
Target Milestone: Future → 59
You need to log in before you can comment on or make changes to this bug.