Skip to content

Commit

Permalink
Set username to anonymous for unauthenticated requests
Browse files Browse the repository at this point in the history
  • Loading branch information
spil-jasper committed Feb 27, 2012
1 parent a2f6661 commit ef52a66
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion swprobe/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ def __call__(self, env, start_response):
self.statsd.timing("auth", time)
else:
# Find out for which account the request was made
swift_account = env["REMOTE_USER"].split(",")[1]
if "REMOTE_USER" in env.keys():
swift_account = env["REMOTE_USER"].split(",")[1]
else:
swift_account = "anonymous"
self.statsd.timing("%s.%s_%s" %(swift_account, req.method, response_code), time)
# Upload and download size statistics
if req.method == "PUT":
Expand Down

0 comments on commit ef52a66

Please sign in to comment.