Skip to content

Commit

Permalink
Merge pull request #444 from shankari/move_stats_to_timeseries
Browse files Browse the repository at this point in the history
Add formatters for the client stats
  • Loading branch information
shankari authored Nov 2, 2016
2 parents cdfad07 + 20778d0 commit 0667888
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 0 deletions.
26 changes: 26 additions & 0 deletions emission/net/usercache/formatters/android/client_error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import logging
import copy
import pytz

import emission.core.wrapper.consentconfig as ecws
import emission.net.usercache.formatters.common as fc

# Currently, we just reflect this back to the user, so not much editing to do
# here. Since we get the timezone from javascript guessing, though, let's just
# verify that it is correct.
def format(entry):
formatted_entry = entry

metadata = entry.metadata
try:
valid_tz = pytz.timezone(entry.metadata.time_zone)
except pytz.UnknownTimeZoneError, e:
logging.warn("Got error %s while checking format validity" % e)
# Default timezone in for the Bay Area, which is probably a fairly safe
# assumption for now
metadata.time_zone = "America/Los_Angeles"
# adds the python datetime and fmt_time entries. important for future searches!
fc.expand_metadata_times(metadata)
formatted_entry.metadata = metadata
formatted_entry.data = entry.data
return formatted_entry;
26 changes: 26 additions & 0 deletions emission/net/usercache/formatters/android/client_nav_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import logging
import copy
import pytz

import emission.core.wrapper.consentconfig as ecws
import emission.net.usercache.formatters.common as fc

# Currently, we just reflect this back to the user, so not much editing to do
# here. Since we get the timezone from javascript guessing, though, let's just
# verify that it is correct.
def format(entry):
formatted_entry = entry

metadata = entry.metadata
try:
valid_tz = pytz.timezone(entry.metadata.time_zone)
except pytz.UnknownTimeZoneError, e:
logging.warn("Got error %s while checking format validity" % e)
# Default timezone in for the Bay Area, which is probably a fairly safe
# assumption for now
metadata.time_zone = "America/Los_Angeles"
# adds the python datetime and fmt_time entries. important for future searches!
fc.expand_metadata_times(metadata)
formatted_entry.metadata = metadata
formatted_entry.data = entry.data
return formatted_entry;
26 changes: 26 additions & 0 deletions emission/net/usercache/formatters/android/client_time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import logging
import copy
import pytz

import emission.core.wrapper.consentconfig as ecws
import emission.net.usercache.formatters.common as fc

# Currently, we just reflect this back to the user, so not much editing to do
# here. Since we get the timezone from javascript guessing, though, let's just
# verify that it is correct.
def format(entry):
formatted_entry = entry

metadata = entry.metadata
try:
valid_tz = pytz.timezone(entry.metadata.time_zone)
except pytz.UnknownTimeZoneError, e:
logging.warn("Got error %s while checking format validity" % e)
# Default timezone in for the Bay Area, which is probably a fairly safe
# assumption for now
metadata.time_zone = "America/Los_Angeles"
# adds the python datetime and fmt_time entries. important for future searches!
fc.expand_metadata_times(metadata)
formatted_entry.metadata = metadata
formatted_entry.data = entry.data
return formatted_entry;
26 changes: 26 additions & 0 deletions emission/net/usercache/formatters/ios/client_error.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import logging
import copy
import pytz

import emission.core.wrapper.consentconfig as ecws
import emission.net.usercache.formatters.common as fc

# Currently, we just reflect this back to the user, so not much editing to do
# here. Since we get the timezone from javascript guessing, though, let's just
# verify that it is correct.
def format(entry):
formatted_entry = entry

metadata = entry.metadata
try:
valid_tz = pytz.timezone(entry.metadata.time_zone)
except pytz.UnknownTimeZoneError, e:
logging.warn("Got error %s while checking format validity" % e)
# Default timezone in for the Bay Area, which is probably a fairly safe
# assumption for now
metadata.time_zone = "America/Los_Angeles"
# adds the python datetime and fmt_time entries. important for future searches!
fc.expand_metadata_times(metadata)
formatted_entry.metadata = metadata
formatted_entry.data = entry.data
return formatted_entry;
26 changes: 26 additions & 0 deletions emission/net/usercache/formatters/ios/client_nav_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import logging
import copy
import pytz

import emission.core.wrapper.consentconfig as ecws
import emission.net.usercache.formatters.common as fc

# Currently, we just reflect this back to the user, so not much editing to do
# here. Since we get the timezone from javascript guessing, though, let's just
# verify that it is correct.
def format(entry):
formatted_entry = entry

metadata = entry.metadata
try:
valid_tz = pytz.timezone(entry.metadata.time_zone)
except pytz.UnknownTimeZoneError, e:
logging.warn("Got error %s while checking format validity" % e)
# Default timezone in for the Bay Area, which is probably a fairly safe
# assumption for now
metadata.time_zone = "America/Los_Angeles"
# adds the python datetime and fmt_time entries. important for future searches!
fc.expand_metadata_times(metadata)
formatted_entry.metadata = metadata
formatted_entry.data = entry.data
return formatted_entry;
26 changes: 26 additions & 0 deletions emission/net/usercache/formatters/ios/client_q
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import logging
import copy
import pytz

import emission.core.wrapper.consentconfig as ecws
import emission.net.usercache.formatters.common as fc

# Currently, we just reflect this back to the user, so not much editing to do
# here. Since we get the timezone from javascript guessing, though, let's just
# verify that it is correct.
def format(entry):
formatted_entry = entry

metadata = entry.metadata
try:
valid_tz = pytz.timezone(entry.metadata.time_zone)
except pytz.UnknownTimeZoneError, e:
logging.warn("Got error %s while checking format validity" % e)
# Default timezone in for the Bay Area, which is probably a fairly safe
# assumption for now
metadata.time_zone = "America/Los_Angeles"
# adds the python datetime and fmt_time entries. important for future searches!
fc.expand_metadata_times(metadata)
formatted_entry.metadata = metadata
formatted_entry.data = entry.data
return formatted_entry;
26 changes: 26 additions & 0 deletions emission/net/usercache/formatters/ios/client_time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import logging
import copy
import pytz

import emission.core.wrapper.consentconfig as ecws
import emission.net.usercache.formatters.common as fc

# Currently, we just reflect this back to the user, so not much editing to do
# here. Since we get the timezone from javascript guessing, though, let's just
# verify that it is correct.
def format(entry):
formatted_entry = entry

metadata = entry.metadata
try:
valid_tz = pytz.timezone(entry.metadata.time_zone)
except pytz.UnknownTimeZoneError, e:
logging.warn("Got error %s while checking format validity" % e)
# Default timezone in for the Bay Area, which is probably a fairly safe
# assumption for now
metadata.time_zone = "America/Los_Angeles"
# adds the python datetime and fmt_time entries. important for future searches!
fc.expand_metadata_times(metadata)
formatted_entry.metadata = metadata
formatted_entry.data = entry.data
return formatted_entry;

0 comments on commit 0667888

Please sign in to comment.