Added the routing config and metrics
This commit is contained in:
parent
75a915019f
commit
54622d5c81
@ -28,6 +28,28 @@ class ServiceConfig(object):
|
|||||||
return self._orgname
|
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):
|
class InternalGeocoderConfig(ServiceConfig):
|
||||||
|
|
||||||
def __init__(self, redis_connection, username, orgname=None):
|
def __init__(self, redis_connection, username, orgname=None):
|
||||||
|
@ -28,6 +28,12 @@ class QuotaService:
|
|||||||
else:
|
else:
|
||||||
return False
|
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):
|
def increment_success_geocoder_use(self, amount=1):
|
||||||
self._user_service.increment_service_use(
|
self._user_service.increment_service_use(
|
||||||
self._user_geocoder_config.service_type, "success_responses",
|
self._user_geocoder_config.service_type, "success_responses",
|
||||||
@ -47,3 +53,8 @@ class QuotaService:
|
|||||||
self._user_service.increment_service_use(
|
self._user_service.increment_service_use(
|
||||||
self._user_geocoder_config.service_type, "total_requests",
|
self._user_geocoder_config.service_type, "total_requests",
|
||||||
amount=amount)
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user