Skip to content

Commit

Permalink
add header size to metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro Vega committed Jan 23, 2017
1 parent 3067dc0 commit add27e2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/orchestrator/common/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def rest_request(self, url, method, user=None, password=None,
res.code = 500
res.msg = self.ENDPOINT_NAME + " endpoint ERROR: " + res.args[0][1]

self.collectOutgoingMetrics(service_start, request.data, res)
self.collectOutgoingMetrics(service_start, request.data, request.headers, res)
return res


Expand Down Expand Up @@ -255,11 +255,11 @@ def rest_request2(self, url, method, user=None, password=None,
except Exception, e:
print e

self.collectOutgoingMetrics(service_start, rdata, res)
self.collectOutgoingMetrics(service_start, rdata, headers, res)
return res


def collectOutgoingMetrics(self, service_start, data_request, response):
def collectOutgoingMetrics(self, service_start, data_request, headers_request, response):
try:
service_stop = time.time()
transactionError = False
Expand All @@ -270,8 +270,8 @@ def collectOutgoingMetrics(self, service_start, data_request, response):
self.sum["outgoingTransactions"] += 1
else:
self.sum["outgoingTransactionErrors"] += 1
self.sum["outgoingTransactionRequestSize"] += len(json.dumps(data_request))
self.sum["outgoingTransactionResponseSize"] += len(json.dumps(data_response))
self.sum["outgoingTransactionRequestSize"] += len(json.dumps(data_request)) + len(str(headers_request))
self.sum["outgoingTransactionResponseSize"] += len(json.dumps(data_response)) + len(str(response.headers.headers))
self.sum["serviceTimeTotal"] += (service_stop - service_start)
except Exception, ex:
self.logger.error("ERROR collecting outgoing metrics %s", ex)
Expand Down

0 comments on commit add27e2

Please sign in to comment.