mirror of
https://github.com/sprockets/sprockets-influxdb.git
synced 2024-11-15 03:00:24 +00:00
Add some exception handling just in case
This commit is contained in:
parent
a22c66fda5
commit
9ba7a5e82c
1 changed files with 6 additions and 2 deletions
|
@ -89,11 +89,15 @@ class InfluxDBMixin(object):
|
|||
if hasattr(self, 'correlation_id'):
|
||||
self.influxdb.set_tag('correlation_id', self.correlation_id)
|
||||
self.influxdb.set_tag('status_code', self._status_code)
|
||||
ctype = self._headers['Content-Type'].decode('utf-8')
|
||||
self.influxdb.set_tag('content_type', ctype.split(';')[0].strip())
|
||||
self.influxdb.set_field('duration', self.request.request_time())
|
||||
self.influxdb.set_field('content_length',
|
||||
int(self._headers['Content-Length']))
|
||||
try:
|
||||
ctype = self._headers['Content-Type'].decode('utf-8')
|
||||
except (AttributeError, TypeError):
|
||||
pass
|
||||
else:
|
||||
self.influxdb.set_tag('content_type', ctype.split(';')[0].strip())
|
||||
add_measurement(self.influxdb)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue