delete unused code
diff --git a/api-gateway-config/conf.d/api_gateway_init.conf b/api-gateway-config/conf.d/api_gateway_init.conf
index a190517..c009531 100644
--- a/api-gateway-config/conf.d/api_gateway_init.conf
+++ b/api-gateway-config/conf.d/api_gateway_init.conf
@@ -53,15 +53,4 @@
 lua_shared_dict cachedkeys 50m; # caches api-keys
 lua_shared_dict cachedOauthTokens 50m; # caches OAuth tokens
 lua_shared_dict cachedUserProfiles 50m; # caches user profiles
-lua_shared_dict healthcheck_redis 1m; # used by lua health_check for redis cache
-
-# dictionaries used for storing the throttling / rate limiting rules
-lua_shared_dict tracking_rules_dict 5m;
-lua_shared_dict blocking_rules_dict 5m;
-lua_shared_dict delaying_rules_dict 5m;
-lua_shared_dict rewriting_rules_dict 5m;
-
-# metrics
-lua_shared_dict stats_counters 50m;
-lua_shared_dict stats_timers 50m;
-lua_shared_dict stats_all 50m;
\ No newline at end of file
+lua_shared_dict healthcheck_redis 1m; # used by lua health_check for redis cache
\ No newline at end of file
diff --git a/api-gateway-config/conf.d/includes/analytics_endpoints.conf b/api-gateway-config/conf.d/includes/analytics_endpoints.conf
index 3dbca5e..4e4b0c0 100644
--- a/api-gateway-config/conf.d/includes/analytics_endpoints.conf
+++ b/api-gateway-config/conf.d/includes/analytics_endpoints.conf
@@ -20,19 +20,6 @@
 # * DEALINGS IN THE SOFTWARE.
 # *
 # */
-#
-# This location exposes the metrics gathered by the legacy.metrics class
-#
-location /api-gateway-stats {
-    allow 127.0.0.1;
-    deny all;
-    content_by_lua '
-        local MetricsCls = require "metrics.MetricsBuffer"
-        local metrics = MetricsCls:new()
-        local json = assert( metrics:toJson(), "Could not read metrics")
-        ngx.say( json )
-    ';
-}
 
 location /nginx_status {
     stub_status on;
diff --git a/api-gateway-config/conf.d/managed_endpoints.conf b/api-gateway-config/conf.d/managed_endpoints.conf
index 37a5ed5..a7edb80 100644
--- a/api-gateway-config/conf.d/managed_endpoints.conf
+++ b/api-gateway-config/conf.d/managed_endpoints.conf
@@ -74,95 +74,4 @@
     location = /health {
         proxy_pass http://0.0.0.0:9000/v1/health-check;
     }
-}
-
-
-# example of hello-world service protected with API KEY
-#server {
-#    listen 80;
-#
-#    server_name ~hello-world.api.(?<domain>.+);
-#
-#    server_tokens off;
-#
-#    #turn off the uninitialized_variable_warn ,as it writes to error_log , hence io
-#    uninitialized_variable_warn off;
-#
-#    # block ips of embargoed countries
-#    if ( $blacklist ) {
-#        return 403;
-#    }
-#
-#    include /etc/api-gateway/conf.d/commons/common-headers.conf;
-#    include /etc/api-gateway/conf.d/includes/resolvers.conf;
-#    include /etc/api-gateway/conf.d/includes/default_validators.conf;
-#
-#    # Log locations with service name
-#    access_log /var/log/api-gateway/access.log platform;
-#    error_log /var/log/api-gateway/marathon_error.log debug;
-#
-#    # include environment variables
-#    include /etc/api-gateway/environment.conf.d/api-gateway-env-vars.server.conf;
-#
-#    error_page 500 501 502 503 504 /50x.html;
-#
-#    location /50x.html {
-#        more_set_headers 'Content-Type: application/json';
-#        more_set_headers 'X-Request-Id: $requestId';
-#        return 500 '{"code":$status, "message":"Oops. Something went wrong. Check your URI and try again."}\n';
-#    }
-#
-#    set $marathon_app_name hello-world;
-#
-#    location ~.*\.(png|jpg|jpeg|js)$ {
-#        proxy_pass http://$marathon_app_name$request_uri;
-#    }
-#
-#    location / {
-#        # ----------------------------------
-#        # add X-Request-Id header
-#        # ----------------------------------
-#        set $requestId $http_x_request_id;
-#        set_secure_random_alphanum $requestId_random 32;
-#        set_if_empty $requestId $requestId_random;
-#        # add_header X-Request-Id $requestId;
-#        proxy_set_header X-Request-Id  $requestId;
-#
-#        proxy_connect_timeout 10s;  # timeout for establishing a connection with a proxied server
-#
-#        proxy_read_timeout 10s;     # Defines a timeout for reading a response from the proxied server.
-#                                    # The timeout is set only between two successive read operations,
-#                                    # not for the transmission of the whole response.
-#
-#        proxy_send_timeout 10s;     # Sets a timeout for transmitting a request to the proxied server.
-#                                    # The timeout is set only between two successive write operations,
-#                                    # not for the transmission of the whole request.
-#        keepalive_timeout 10s;      # timeout during which a keep-alive client connection will stay open on the server side
-#        proxy_buffering off;        # enables or disables buffering of responses from the proxied server.
-#        proxy_http_version 1.1;     # Version 1.1 is recommended for use with keepalive connections.
-#        proxy_set_header Connection "";
-#
-#        # identify the service
-#        set $service_id $marathon_app_name;
-#
-#        # identify the api key
-#        #     either from the query params or from the "X-Api-Key" header
-#        set $api_key $arg_api_key;
-#        set_if_empty $api_key $http_x_api_key;
-#
-#        # add the api-key validator
-#        set $validate_api_key on;
-#
-#        #validate request
-#        access_by_lua "ngx.apiGateway.validation.validateRequest()";
-#
-#        proxy_pass http://$marathon_app_name$request_uri;
-#
-#        # capture usage data
-#        log_by_lua '
-#            if ( ngx.apiGateway.metrics ~= nil ) then
-#                ngx.apiGateway.metrics.captureUsageData()
-#            end
-#        ';
-#    }
-#}
+}
\ No newline at end of file
diff --git a/api-gateway-config/scripts/lua/api_gateway_init.lua b/api-gateway-config/scripts/lua/api_gateway_init.lua
index a5f46b3..3241147 100644
--- a/api-gateway-config/scripts/lua/api_gateway_init.lua
+++ b/api-gateway-config/scripts/lua/api_gateway_init.lua
@@ -1,23 +1,3 @@
--- Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved.
---
---   Permission is hereby granted, free of charge, to any person obtaining a
---   copy of this software and associated documentation files (the "Software"),
---   to deal in the Software without restriction, including without limitation
---   the rights to use, copy, modify, merge, publish, distribute, sublicense,
---   and/or sell copies of the Software, and to permit persons to whom the
---   Software is furnished to do so, subject to the following conditions:
---
---   The above copyright notice and this permission notice shall be included in
---   all copies or substantial portions of the Software.
---
---   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
---   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
---   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
---   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
---   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
---   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
---   DEALINGS IN THE SOFTWARE.
-
 -- An initialization script on a per worker basis.
 -- User: ddascal
 -- Date: 07/12/14
@@ -44,44 +24,7 @@
     return require(module)
 end
 
---- Initializes the `zmqLogger` used by `trackingRulesLogger.lua` from api-gateway-request-tracking module
--- @param parentObject
---
-local function initZMQLogger(parentObject)
-    ngx.log(ngx.DEBUG, "Initializing ZMQLogger on property [zmqLogger]")
-    -- when the ZmqModule is not present the script does not break
-    local ZmqLogger = loadrequire("api-gateway.zmq.ZeroMQLogger")
 
-    if (ZmqLogger == nil) then
-        return
-    end
-
-    local zmq_publish_address = "ipc:///tmp/nginx_queue_listen"
-    ngx.log(ngx.INFO, "Starting new ZmqLogger on pid [", tostring(ngx.worker.pid()), "] on address [", zmq_publish_address, "]")
-    local zmqLogger = ZmqLogger:new()
-    zmqLogger:connect(ZmqLogger.SOCKET_TYPE.ZMQ_PUB, zmq_publish_address)
-
-    parentObject.zmqLogger = zmqLogger
-end
-
-local function initValidationFactory(parentObject)
-    parentObject.validation = require "api-gateway.validation.factory"
-end
-
-local function initTrackingFactory(parentObject)
-    parentObject.tracking = require "api-gateway.tracking.factory"
-end
-
-local function initMetricsFactory(parentObject)
-    parentObject.metrics = require "metrics.factory"
-end
-
---initValidationFactory(_M)
---initZMQLogger(_M)
---initTrackingFactory(_M)
-initMetricsFactory(_M)
--- TODO: test health-check with the new version of Openresty
--- initRedisHealthCheck()
 
 ngx.apiGateway = _M
 
diff --git a/api-gateway-config/scripts/lua/metrics/MetricsBuffer.lua b/api-gateway-config/scripts/lua/metrics/MetricsBuffer.lua
deleted file mode 100644
index 47d322b..0000000
--- a/api-gateway-config/scripts/lua/metrics/MetricsBuffer.lua
+++ /dev/null
@@ -1,165 +0,0 @@
--- Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved.
---
---   Permission is hereby granted, free of charge, to any person obtaining a
---   copy of this software and associated documentation files (the "Software"),
---   to deal in the Software without restriction, including without limitation
---   the rights to use, copy, modify, merge, publish, distribute, sublicense,
---   and/or sell copies of the Software, and to permit persons to whom the
---   Software is furnished to do so, subject to the following conditions:
---
---   The above copyright notice and this permission notice shall be included in
---   all copies or substantial portions of the Software.
---
---   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
---   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
---   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
---   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
---   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
---   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
---   DEALINGS IN THE SOFTWARE.
-
--- Base class for analytics with functions for calculating counts,timers
--- and updating the cache with data on every service call.
---
---
---
--- Usage in Nginx conf:
---
--- location api-gateway-stats {
---    allow 127.0.0.1;
---    deny all;
---    content_by_lua '
---      local MetricsBuffer = require "metrics.MetricsBuffer"
---      local metrics = MetricsBuffer:new()
---      local json = assert( metrics:toJson(), "Could not read metrics")
---      ngx.say( json )
---    ';
--- }
-
-local cjson = require "cjson"
-
-local M = {}
-
-function M:new(o)
-    o = o or {}
-    setmetatable(o, self)
-    self.__index = self
-    return o
-end
-
---- Increments a counter with the given <value>
--- @param metric The name of the metrics
--- @param value The value to intecrement with
---
-function M:count(metric, value)
-    local localMetrics = ngx.shared.stats_counters
-    local r
-    if ( localMetrics == nil ) then
-        ngx.log(ngx.ERROR, "Please define 'lua_shared_dict stats_counters 50m;' in http block")
-        return nil
-    end
-
-    value = tonumber(value) or 0
-    if value == 0 then -- to exit when nil/zero
-        return 0
-    end
-
-    r = localMetrics:incr(metric, value)
-    if ( r == nil ) then
-        localMetrics:add(metric, value)
-        return value
-    end
-    return r
-end
-
---- Adds a new timer value. Unline counters, timers are averaged when flushed
--- @param metric The name of the metrics
--- @param value A new value for the timer
---
-function M:timer(metric, value)
-    local localMetrics = ngx.shared.stats_timers
-    local r, counter
-    if ( localMetrics == nil ) then
-        ngx.log(ngx.ERROR, "Please define 'lua_shared_dict stats_timers 50m;' in http block")
-        return nil
-    end
-
-    value = tonumber(value) or -2
-
-    -- Timers are counting only the positive values, by convention
-    if ( value < 0 ) then
-        return value
-    end
-
-    r, counter = localMetrics:get(metric)
-    if ( r == nil ) then
-        localMetrics:set(metric, value, 0, 1)
-        return value
-    end
-    -- FIXES: attempt to perform arithmetic on local 'counter' (a nil value)
-    if ( counter == nil ) then
-        counter = 0
-    end
-    -- Adding the timers and increamenting the counter to compute avg later
-    counter = counter + 1
-    r = r + value
-    localMetrics:set(metric, r, 0, counter)
-    return r
-end
-
-function M:getJsonFor( metric_type )
-   -- convert shared_dict to table
-    local localMetrics = ngx.shared[metric_type]
-    if ( localMetrics == nil ) then
-        return nil
-    end
-    local keys = localMetrics:get_keys(1024)
-    local counter
-    local jsonObj = {}
-    local count = 0
-    for i,metric in pairs(keys) do
-        local value, counter = localMetrics:get(metric)
-        if(counter == nil) then
-            counter = 0
-        end
-        -- check if avg needs to be computed
-        if(counter == 1 or counter == 0) then
-            jsonObj[metric] = value
-        end
-        if(counter >= 2) then
-            jsonObj[metric] = math.floor(value/counter)
-        end
-        -- mark item as expired
-        localMetrics:set(metric, 0, 0.001,0)
-        count = i
-    end
-    return cjson.encode(jsonObj),count,jsonObj
-end
-
-function M:toJson( flushExpiredMetrics )
-    local counters, count_counters, counterObject = self:getJsonFor("stats_counters")
-    local timers, count_timers, timerObject = self:getJsonFor("stats_timers")
-    local flush = flushExpiredMetrics or true
-
-    -- ngx.log(ngx.INFO, "Wrote " .. count_counters .. " counters and " .. count_timers .. " timers.")
-
-    if ( flush == true ) then
-        self:flushExpiredKeys()
-    end
-    return "{\"counters\":" .. counters .. ",\"timers\":" .. timers .. "}", counterObject, timerObject
-end
-
-function M:flushExpiredKeys()
-    local metrics = ngx.shared.stats_counters
-    if ( metrics ~= nil ) then
-        metrics:flush_expired()
-    end
-
-    metrics = ngx.shared.stats_timers
-    if ( metrics ~= nil ) then
-        metrics:flush_expired()
-    end
-end
-
-return M
-
diff --git a/api-gateway-config/scripts/lua/metrics/MetricsCollector.lua b/api-gateway-config/scripts/lua/metrics/MetricsCollector.lua
deleted file mode 100644
index 624fb1f..0000000
--- a/api-gateway-config/scripts/lua/metrics/MetricsCollector.lua
+++ /dev/null
@@ -1,185 +0,0 @@
--- Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved.
---
---   Permission is hereby granted, free of charge, to any person obtaining a
---   copy of this software and associated documentation files (the "Software"),
---   to deal in the Software without restriction, including without limitation
---   the rights to use, copy, modify, merge, publish, distribute, sublicense,
---   and/or sell copies of the Software, and to permit persons to whom the
---   Software is furnished to do so, subject to the following conditions:
---
---   The above copyright notice and this permission notice shall be included in
---   all copies or substantial portions of the Software.
---
---   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
---   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
---   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
---   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
---   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
---   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
---   DEALINGS IN THE SOFTWARE.
-
--- Records the metrics for the current request.
---
--- # Sample StatsD messages
--- # pub.publisher_name.consumer.consumer_name.app.application_name.service.service_name.prod.region.useast.request.device_links.POST.200.count
--- # pub.publisher_name.consumer.consumer_name.app.application_name.service.service_name.prod.region.useast.request.device_links.POST.200.responseTime
--- # pub.publisher_name.consumer.consumer_name.app.application_name.service.service_name.prod.region.useast.request.device_links.POST.200.upstreamResponseTime
--- # pub.publisher_name.consumer.consumer_name.app.application_name.service.service_name.prod.region.useast.request.validate_request.GET.200.responseTime
---
--- NOTE: by default it logs the root-path of the request. If the root path is used for versioning ( i.e. v1.0 ) there is the property $metric_path that
--- can be set on the location block in order to override the root-path
---
--- Created by IntelliJ IDEA.
--- User: nramaswa
--- Date: 3/14/14
--- Time: 12:45 AM
--- To change this template use File | Settings | File Templates.
---
-local MetricsCls = require "metrics.MetricsBuffer"
-local metrics = MetricsCls:new()
-
-local M = {}
-
-function M:new(o)
-    o = o or {}
-    setmetatable(o, self)
-    self.__index = self
-    return o
-end
-
--- To replace . with _
-local function normalizeString(input)
-    return input:gsub("%.", "_")
-end
-
-local function getPathForMetrics(serviceName)
-    local user_defined_path = ngx.var.metrics_path
-    if user_defined_path ~= nil and #user_defined_path < 2 then
-        user_defined_path = nil
-    end
-
-    local request_uri = user_defined_path or ngx.var.uri or "/" .. serviceName
-    local pattern = "(?:\\/?\\/?)([^\\/:]+)" -- To get the first part of the request uri excluding content after :
-    local requestPathFromURI, err = ngx.re.match(request_uri, pattern)
-    local requestPath = serviceName -- default value
-
-    if err then
-        ngx.log(ngx.WARN, "Assigned requestPath as serviceName due to error in extracting requestPathFromURI: ", err)
-    end
-
-    if requestPathFromURI then
-        if requestPathFromURI[1] then
-            requestPath = requestPathFromURI[1]
-            requestPath = requestPath:gsub("%.", "_")
-            --ngx.log(ngx.INFO, "\n the extracted requestPath::"..requestPath)
-        end
-    end
-    return requestPath
-end
-
-function M:logCurrentRequest()
-    -- Variables used in the bucket path
-    local publisherName = ngx.var.publisher_org_name or "undefined"
-    local consumerName = ngx.var.consumer_org_name or "undefined"
-    local appName = ngx.var.app_name or "undefined"
-    local serviceName = ngx.var.service_name or "undefined"
-    local realm = ngx.var.service_env or ngx.var.realm or "sandbox"
-    local requestMethod = ngx.var.request_method or "undefined"
-    local status = ngx.var.status or "0"
-    local validateRequestStatus = ngx.var.validate_request_status or "0"
-
-    -- Values for metrics - converted tonumber() later
-    local bucketCountValue = 1
-    local requestTime = tonumber(ngx.var.request_time) or -1
-    local upstreamResponseTime = tonumber(ngx.var.upstream_response_time) or -1
-    local validateTime = tonumber(ngx.var.validate_request_response_time) or -1
-    local rgnName = ngx.var.aws_region or "undefined"
-    local bytesSent = tonumber(ngx.var.bytes_sent) or -1
-    local bytesReceived = tonumber(ngx.var.request_length) or -1
-
-    -- ---------------------------------------------------------------------- --
-    -- ------------- Logging for all the requests            ---------------  --
-    -- ---------------------------------------------------------------------- --
-
-    local bucket = "publisher." .. normalizeString(publisherName) ..
-            ".consumer." .. normalizeString(consumerName) ..
-            ".application." .. normalizeString(appName) ..
-            ".service." .. normalizeString(serviceName) ..
-            "." .. realm ..
-            ".region." .. rgnName ..
-            ".request.";
-    local validate_request_response_time = bucket .. "validate_request." .. validateRequestStatus .. ".responseTime";
-
-    local requestPath = getPathForMetrics(serviceName)
-
-    local bytes_sent = bucket .. "bytesSent";
-    local bytes_received = bucket .. "bytesReceived";
-
-
-    --bandwidth data - update only if its greater than zero to sum up all calls
-    if bytesSent > 0 then
-        metrics:count(bytes_sent, bytesSent)
-    end
-    if bytesReceived > 0 then
-        metrics:count(bytes_received, bytesReceived)
-    end
-
-    -- log validate timer entry only if its passed
-    if validateTime >= 0 then
-        metrics:timer(validate_request_response_time, validateTime)
-    end
-
-    -- ---------------------------------------------------------------------- --
-    -- ------------- Non-blocked requests related logging    ---------------  --
-    -- ---------------------------------------------------------------------- --
-
-    -- Choosing log buckets in statsd based on validation success/failure in the gateway
-    if (validateRequestStatus == "200" or validateRequestStatus == "0" or validateRequestStatus == 200 or validateRequestStatus == "na") then
-        local cc_bucket = bucket ..
-                requestPath .. "." ..
-                requestMethod .. "." .. status;
-
-        local cc_response_time = cc_bucket .. ".responseTime";
-        local cc_upstream_response_time = cc_bucket .. ".upstreamResponseTime";
-
-        local hit_count_for_bucket = cc_bucket .. ".count";
-
-
-        --increament the count for all the calls
-        metrics:count(hit_count_for_bucket, bucketCountValue)
-        -- timers
-        if requestTime >= 0 then
-            metrics:timer(cc_response_time, requestTime)
-        end
-        --timer data - update only if its greater than or = zero as its avging all calls
-        if upstreamResponseTime >= 0 then
-            metrics:timer(cc_upstream_response_time, upstreamResponseTime)
-        end
-        return
-    end
-
-    -- ---------------------------------------------------------------------- --
-    -- ------------- Blocked requests related logging        ---------------  --
-    -- ---------------------------------------------------------------------- --
-
-    local blocked_bucket = bucket .. "_blocked_"
-
-    local code_count_bucket = blocked_bucket .. "." .. validateRequestStatus .. ".count"
-    local bytes_sent_bucket = blocked_bucket .. ".bytesSent"
-    local bytes_received_bucket = blocked_bucket .. ".bytesReceived"
-
-    --increament the count for all the calls
-    metrics:count(code_count_bucket, bucketCountValue)
-
-    --bandwidth data - update only if its greater than zero to sum up all calls
-    if bytesSent > 0 then
-        metrics:count(bytes_sent_bucket, bytesSent)
-    end
-    if bytesReceived > 0 then
-        metrics:count(bytes_received_bucket, bytesReceived)
-    end
-end
-
-
-return M
-
diff --git a/api-gateway-config/scripts/lua/metrics/factory.lua b/api-gateway-config/scripts/lua/metrics/factory.lua
deleted file mode 100644
index d71d504..0000000
--- a/api-gateway-config/scripts/lua/metrics/factory.lua
+++ /dev/null
@@ -1,37 +0,0 @@
--- Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved.
---
---   Permission is hereby granted, free of charge, to any person obtaining a
---   copy of this software and associated documentation files (the "Software"),
---   to deal in the Software without restriction, including without limitation
---   the rights to use, copy, modify, merge, publish, distribute, sublicense,
---   and/or sell copies of the Software, and to permit persons to whom the
---   Software is furnished to do so, subject to the following conditions:
---
---   The above copyright notice and this permission notice shall be included in
---   all copies or substantial portions of the Software.
---
---   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
---   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
---   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
---   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
---   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
---   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
---   DEALINGS IN THE SOFTWARE.
-
---
--- A factory to initialize the methods that can be used for capturing usage data
--- This class is provided as an example
--- User: ddascal
---
-
-local MetricsCollector = require "metrics.MetricsCollector"
-local collector = MetricsCollector:new()
-
-local function _captureUsageData()
-    return collector:logCurrentRequest()
-end
-
-return {
-    captureUsageData = _captureUsageData
-}
-
diff --git a/api-gateway-config/scripts/python/logger/StatsdLogger.py b/api-gateway-config/scripts/python/logger/StatsdLogger.py
deleted file mode 100644
index af57f76..0000000
--- a/api-gateway-config/scripts/python/logger/StatsdLogger.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#
-# Background worker that loads statistics from the Api-Gateway endpoint and sends them to StatsD.
-# Designed to be restarted every minute by a cronjob
-#
-import json, sys, socket, urllib2
-import argparse
-from threading import Timer
-
-class StatsCollectorWorker:
-
-    UDP_MAX_BUFFER_SIZE = 800
-
-    def __init__(self, statsRestEndpoint, statsd_host, statsd_port ):
-        print(("Starting collecting form [%s], sending to StatsD on [%s:%s]") % (gateway_uri, statsd_host, statsd_port) )
-        self.statsRestEndpoint = statsRestEndpoint
-        self.statsd_host = statsd_host
-        self.statsd_port = statsd_port
-        self.udp_buffer = ""
-
-    def getStatsFromUrl(self, url):
-        try:
-            stats_txt = urllib2.urlopen(url).read()
-            return json.loads(stats_txt)
-        except Exception as e:
-            print "Could not read stats", e
-            return None
-
-    def flushBuffer(self):
-        # print "Sending:", self.udp_buffer
-        self.udp_sock.send(self.udp_buffer)
-        self.udp_buffer = ''
-
-    def sentStatsFromCollection(self, metricCollection, metricType):
-        for i, item in enumerate(metricCollection):
-            # print i, item, metricCollection[item]
-            statsd_metric = ('%s:%s|%s' % (item, metricCollection[item],metricType)).encode("utf-8")
-            if self.udp_buffer.__len__() + statsd_metric.__len__() > StatsCollectorWorker.UDP_MAX_BUFFER_SIZE:
-                self.flushBuffer()
-            self.udp_buffer = ''.join([self.udp_buffer, "\n", statsd_metric])
-
-    def sendStats(self, obj):
-        # TODO: split statsd_host by space in order to support sending data to multiple statsd backends
-        try:
-            self.udp_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
-            self.udp_sock.connect((self.statsd_host, self.statsd_port))
-        except Exception as e:
-            print "Could not connect to StatsD", e
-            return None
-        try:
-            self.sentStatsFromCollection(obj["timers"], "ms")
-            self.sentStatsFromCollection(obj["counters"], "c")
-            if self.udp_buffer.__len__() > 0:
-                self.flushBuffer()
-        except Exception as e:
-            print "Could not send statistics", e
-        self.udp_sock.close()
-
-    def getAndSendStats(self,nextInterval, maxRuns):
-        # Read the JSON from the gateway's endpoint
-        # TODO: add an exception in case JSON conversion fails
-        obj = self.getStatsFromUrl(self.statsRestEndpoint)
-        if obj is not None:
-            self.sendStats(obj)
-
-        # print ("Stats processed. %s runs left" % (maxRuns))
-        if maxRuns <= 0:
-            return None
-        t = Timer(nextInterval, self.getAndSendStats, [nextInterval, maxRuns - 1])
-        t.start()
-
-
-statsd_host = "api-gateway-graphite"
-statsd_port = int("8125")
-gateway_uri = "http://127.0.0.1/api-gateway-stats"
-if __name__ == '__main__':
-    parser = argparse.ArgumentParser()
-    parser.add_argument('-s', '--statsd-host', dest='statsd_host', required=True)
-    parser.add_argument('-p', '--statsd-port', dest='statsd_port')
-    parser.add_argument('-g', '--gateway-uri', dest='gateway_uri')
-    args = parser.parse_args()
-    statsd_host = args.statsd_host or statsd_host
-    statsd_port = int(args.statsd_port or statsd_port)
-    gateway_uri = args.gateway_uri or gateway_uri
-
-collector = StatsCollectorWorker(statsRestEndpoint=gateway_uri, statsd_host=statsd_host, statsd_port=statsd_port)
-# set the collector to run each 3 seconds , max 18 times
-collector.getAndSendStats(nextInterval=3,maxRuns=18)
-
-# Sample StatsD messages
-# pub.publisher_name.consumer.consumer_name.app.application_name.service.service_name.prod.region.useast.request.device_links.POST.200.count
-# pub.publisher_name.consumer.consumer_name.app.application_name.service.service_name.prod.region.useast.request.device_links.POST.200.responseTime
-# pub.publisher_name.consumer.consumer_name.app.application_name.service.service_name.prod.region.useast.request.device_links.POST.200.upstreamResponseTime
-# pub.publisher_name.consumer.consumer_name.app.application_name.service.service_name.prod.region.useast.request.validate_request.GET.200.responseTime