Closed Bug 772716 Opened 14 years ago Closed 13 years ago

log user id and request processing time for each sync server request

Categories

(Cloud Services Graveyard :: Server: Sync, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: rmiller, Assigned: rmiller)

Details

(Whiteboard: [qa+])

Attachments

(2 files)

We want to be able to spot users who are sucking up inordinate server resources, this adds request processing time tracking by user on sync 1.1. Will be output through metlog to HDFS and then aggregated; we won't keep the fine granularity data.
Whiteboard: [qa?]
It's a bad code smell that changes in server-core lead to test changes in server-storage (and not in server-core) but no new software is being developed on the server-core stack so I'm not going to worry about it too much.
Attachment #640929 - Flags: review?(rfkelly)
Comment on attachment 640928 [details] [diff] [review] server-core patch sending request processing time w/ user id to metlog Review of attachment 640928 [details] [diff] [review]: ----------------------------------------------------------------- LGTM. I assume there are no privacy issues with this since the userid is already logged as part of the URL? ::: services/baseapp.py @@ +142,5 @@ > if ((method is not None) and > (not hasattr(controller_instance, wrapped_name))): > # add wrapped method > + wrapped = send_services_data(incr_count( > + svc_timeit(method))) Hmm, line-wrapping nested function calls is never pretty. Consider something like this for clarity? wrapped = svc_timeit(method) wrapped = incr_count(wrapped) wrapped = send_services_data(wrapped) No big deal either way, just a thought.
Attachment #640928 - Flags: review?(rfkelly) → review+
Comment on attachment 640929 [details] [diff] [review] test that user id and elapsed time is being pushed through metlog Review of attachment 640929 [details] [diff] [review]: ----------------------------------------------------------------- ::: syncstorage/tests/test_metlog.py @@ +96,1 @@ > wrapped_method._fn._fn._fn = orig_inner Wow that's a lot of _fn chaining. Just want to double-check whether there should be one more _fn on here due to the extra decorator?
(In reply to Ryan Kelly [:rfkelly] from comment #3) > Comment on attachment 640928 [details] [diff] [review] > server-core patch sending request processing time w/ user id to metlog > > Review of attachment 640928 [details] [diff] [review]: > ----------------------------------------------------------------- > > LGTM. I assume there are no privacy issues with this since the userid is > already logged as part of the URL? Use cases for this are in abuse detection and systems improvement, and we'll be aggregating across fairly large (per-day-level) time periods, so it's not really a privacy issue.
Comment on attachment 640929 [details] [diff] [review] test that user id and elapsed time is being pushed through metlog Review of attachment 640929 [details] [diff] [review]: ----------------------------------------------------------------- ::: syncstorage/tests/test_metlog.py @@ +96,1 @@ > wrapped_method._fn._fn._fn = orig_inner Yeah, it's ugly. In non-test code we'd recurse up until there was no more `_fn` attribute instead of assuming we knew how many times we'd been decorated, but the test is specifically ensuring that things are as we expect. And no, there shouldn't be one more; we changed `timeit` to `svc_timeit`, but there are still the same number of decorators as before (3).
Comment on attachment 640929 [details] [diff] [review] test that user id and elapsed time is being pushed through metlog well then, LGTM :-)
Attachment #640929 - Flags: review?(rfkelly) → review+
It looks like these were committed, are we OK to close out this bug?
Yes, I think so.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Needs QA, we should be able to check that it's working by looking in the logs. Will defer to :RaFromBRC for most appropriate way to verify.
Whiteboard: [qa?] → [qa+]
This can be verified by the existence of records in the metrics_hdfs.log file with a 'type' value of 'services' and a 'fields' value that contains both 'userid' and 'req_time' keys. For example, the following record from metrics_hdfs.log on sync2.web... {"severity":6,"timestamp":"2012-08-31T01:12:03.955928","metlog_hostname":"sync2.web.scl2.stage.svc.mozilla.com","fields":{"req_time":1,"userid":"847520"},"metlog_pid":24250,"logger":"syncstorage","type":"services","payload":"","env_version":"0.8"} ...has a 'services' type value, and a 'fields' value of {"req_time":1,"userid":"847520"}, which contains both of the required keys. This is a positive indicator.
OK. So, looking at file metrics_hdfs.log=2012-08-31.gz on sync1 Verified that there were many instance of the above records.
Status: RESOLVED → VERIFIED
Product: Cloud Services → Cloud Services Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: