From 193513bfea577133244d1d1aacedd4ef0f9a1368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Ignacio=20S=C3=A1nchez=20Lara?= Date: Wed, 11 Apr 2018 12:56:55 +0200 Subject: [PATCH] params at metrics --- .../cdb_dataservices_server--0.30.5--0.31.0.sql | 12 +++++++++--- server/extension/cdb_dataservices_server--0.31.0.sql | 12 +++++++++--- server/extension/sql/20_geocode_street.sql | 4 +++- server/extension/sql/85_isodistance.sql | 4 +++- server/extension/sql/90_isochrone.sql | 4 +++- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/server/extension/cdb_dataservices_server--0.30.5--0.31.0.sql b/server/extension/cdb_dataservices_server--0.30.5--0.31.0.sql index 73d095e..040af68 100644 --- a/server/extension/cdb_dataservices_server--0.30.5--0.31.0.sql +++ b/server/extension/cdb_dataservices_server--0.30.5--0.31.0.sql @@ -154,7 +154,9 @@ RETURNS Geometry AS $$ logger_config = GD["logger_config"] logger = Logger(logger_config) - with metrics('cdb_geocode_street_point', user_geocoder_config, logger): + params = {'searchtext': searchtext, 'city': city, 'state_province': state_province, 'country': country} + + with metrics('cdb_geocode_street_point', user_geocoder_config, logger, params): if user_geocoder_config.heremaps_geocoder: here_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_here_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(here_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] @@ -379,7 +381,9 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ if user_isolines_config.google_services_user: raise Exception('This service is not available for google service users.') - with metrics('cb_isodistance', user_isolines_config, logger): + params = {'source': source, 'mode': mode, 'range': range, 'options': options} + + with metrics('cdb_isodistance', user_isolines_config, logger, params): if user_isolines_config.heremaps_provider: here_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.cdb_here_isodistance($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) return plpy.execute(here_plan, [username, orgname, source, mode, range, options]) @@ -428,7 +432,9 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ if user_isolines_config.google_services_user: raise Exception('This service is not available for google service users.') - with metrics('cb_isochrone', user_isolines_config, logger): + params = {'source': source, 'mode': mode, 'range': range, 'options': options} + + with metrics('cdb_isochrone', user_isolines_config, logger, params): if user_isolines_config.heremaps_provider: here_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.cdb_here_isochrone($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) return plpy.execute(here_plan, [username, orgname, source, mode, range, options]) diff --git a/server/extension/cdb_dataservices_server--0.31.0.sql b/server/extension/cdb_dataservices_server--0.31.0.sql index 7215d78..a62e503 100644 --- a/server/extension/cdb_dataservices_server--0.31.0.sql +++ b/server/extension/cdb_dataservices_server--0.31.0.sql @@ -1956,7 +1956,9 @@ RETURNS Geometry AS $$ logger_config = GD["logger_config"] logger = Logger(logger_config) - with metrics('cdb_geocode_street_point', user_geocoder_config, logger): + params = {'searchtext': searchtext, 'city': city, 'state_province': state_province, 'country': country} + + with metrics('cdb_geocode_street_point', user_geocoder_config, logger, params): if user_geocoder_config.heremaps_geocoder: here_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_here_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(here_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] @@ -3472,7 +3474,9 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ if user_isolines_config.google_services_user: raise Exception('This service is not available for google service users.') - with metrics('cb_isodistance', user_isolines_config, logger): + params = {'source': source, 'mode': mode, 'range': range, 'options': options} + + with metrics('cdb_isodistance', user_isolines_config, logger, params): if user_isolines_config.heremaps_provider: here_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.cdb_here_isodistance($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) return plpy.execute(here_plan, [username, orgname, source, mode, range, options]) @@ -3561,7 +3565,9 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ if user_isolines_config.google_services_user: raise Exception('This service is not available for google service users.') - with metrics('cb_isochrone', user_isolines_config, logger): + params = {'source': source, 'mode': mode, 'range': range, 'options': options} + + with metrics('cdb_isochrone', user_isolines_config, logger, params): if user_isolines_config.heremaps_provider: here_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.cdb_here_isochrone($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) return plpy.execute(here_plan, [username, orgname, source, mode, range, options]) diff --git a/server/extension/sql/20_geocode_street.sql b/server/extension/sql/20_geocode_street.sql index 6466855..30a477a 100644 --- a/server/extension/sql/20_geocode_street.sql +++ b/server/extension/sql/20_geocode_street.sql @@ -12,7 +12,9 @@ RETURNS Geometry AS $$ logger_config = GD["logger_config"] logger = Logger(logger_config) - with metrics('cdb_geocode_street_point', user_geocoder_config, logger): + params = {'searchtext': searchtext, 'city': city, 'state_province': state_province, 'country': country} + + with metrics('cdb_geocode_street_point', user_geocoder_config, logger, params): if user_geocoder_config.heremaps_geocoder: here_plan = plpy.prepare("SELECT cdb_dataservices_server._cdb_here_geocode_street_point($1, $2, $3, $4, $5, $6) as point; ", ["text", "text", "text", "text", "text", "text"]) return plpy.execute(here_plan, [username, orgname, searchtext, city, state_province, country], 1)[0]['point'] diff --git a/server/extension/sql/85_isodistance.sql b/server/extension/sql/85_isodistance.sql index 18bd35f..9609c27 100644 --- a/server/extension/sql/85_isodistance.sql +++ b/server/extension/sql/85_isodistance.sql @@ -14,7 +14,9 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ if user_isolines_config.google_services_user: raise Exception('This service is not available for google service users.') - with metrics('cb_isodistance', user_isolines_config, logger): + params = {'source': source, 'mode': mode, 'range': range, 'options': options} + + with metrics('cdb_isodistance', user_isolines_config, logger, params): if user_isolines_config.heremaps_provider: here_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.cdb_here_isodistance($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) return plpy.execute(here_plan, [username, orgname, source, mode, range, options]) diff --git a/server/extension/sql/90_isochrone.sql b/server/extension/sql/90_isochrone.sql index 8e5721f..61a5fce 100644 --- a/server/extension/sql/90_isochrone.sql +++ b/server/extension/sql/90_isochrone.sql @@ -14,7 +14,9 @@ RETURNS SETOF cdb_dataservices_server.isoline AS $$ if user_isolines_config.google_services_user: raise Exception('This service is not available for google service users.') - with metrics('cb_isochrone', user_isolines_config, logger): + params = {'source': source, 'mode': mode, 'range': range, 'options': options} + + with metrics('cdb_isochrone', user_isolines_config, logger, params): if user_isolines_config.heremaps_provider: here_plan = plpy.prepare("SELECT * FROM cdb_dataservices_server.cdb_here_isochrone($1, $2, $3, $4, $5, $6) as isoline; ", ["text", "text", "geometry(geometry, 4326)", "text", "integer[]", "text[]"]) return plpy.execute(here_plan, [username, orgname, source, mode, range, options])