diff --git a/server/lib/python/cartodb_services/cartodb_services/metrics/config.py b/server/lib/python/cartodb_services/cartodb_services/metrics/config.py index 2d3ccc3..f95ea9d 100644 --- a/server/lib/python/cartodb_services/cartodb_services/metrics/config.py +++ b/server/lib/python/cartodb_services/cartodb_services/metrics/config.py @@ -28,6 +28,28 @@ class ServiceConfig(object): return self._orgname +class RoutingConfig(ServiceConfig): + + def __init__(self, redis_connection, username, orgname=None, + heremaps_app_id=None, heremaps_app_code=None): + super(InternalGeocoderConfig, self).__init__(redis_connection, + username, orgname) + self._heremaps_app_id = heremaps_app_id + self._heremaps_app_code = heremaps_app_code + + @property + def service_type(self): + return 'routing_here' + + @property + def heremaps_app_id(self): + return self._heremaps_app_id + + @property + def heremaps_app_code(self): + return self._heremaps_app_code + + class InternalGeocoderConfig(ServiceConfig): def __init__(self, redis_connection, username, orgname=None): diff --git a/server/lib/python/cartodb_services/cartodb_services/metrics/quota.py b/server/lib/python/cartodb_services/cartodb_services/metrics/quota.py index 9a373cf..340642c 100644 --- a/server/lib/python/cartodb_services/cartodb_services/metrics/quota.py +++ b/server/lib/python/cartodb_services/cartodb_services/metrics/quota.py @@ -28,6 +28,12 @@ class QuotaService: else: return False + # TODO + # We are going to change this class to be the generic one and + # create specific for routing and geocoding services but because + # this implies change all the extension functions, we are going to + # make the change in a minor release + def increment_success_geocoder_use(self, amount=1): self._user_service.increment_service_use( self._user_geocoder_config.service_type, "success_responses", @@ -47,3 +53,8 @@ class QuotaService: self._user_service.increment_service_use( self._user_geocoder_config.service_type, "total_requests", amount=amount) + + def increment_isolines_service_use(self, amount=1): + self._user_service.increment_service_use( + self._user_geocoder_config.service_type, "isolines_generated", + amount=amount)