This repository has been archived by the owner on Feb 24, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a stats system in the background that will silently collect usa…
…ge statistics. fixes #3. fixes #4. fixes #8. Laid the groundwork for #5 and #6. #10 is implemented, but untested.
- Loading branch information
Paddy Foran
committed
Jul 7, 2011
1 parent
127cf78
commit dca1294
Showing
7 changed files
with
130 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
queue: | ||
- name: stats | ||
rate: 10/s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from google.appengine.api import prospective_search | ||
from google.appengine.ext import db | ||
from datetime import datetime | ||
|
||
import logging | ||
|
||
class StatsRecord(db.Model): | ||
event = db.StringProperty() | ||
timestamp = db.DateTimeProperty() | ||
value = db.StringProperty() | ||
|
||
def record(key, value, timestamp=False): | ||
record = StatsRecord(event=key, value=value) | ||
if not timestamp: | ||
timestamp = datetime.now() | ||
record.timestamp = timestamp | ||
logging.info("Firing stats off. Event: %s" % key) | ||
prospective_search.match(record, result_task_queue='stats') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<html> | ||
<head> | ||
<title>Add Subscription</title> | ||
</head> | ||
<body> | ||
<form method="POST"> | ||
Event: <input type="text" name="event" /><br /> | ||
Datapoint: <input type="text" name="datapoint" /><br /> | ||
<input type="submit" value="Add Subscription" /> | ||
</form> | ||
</body> | ||
</html> |