Skip to content

Commit

Permalink
Force some fields to be floats
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrgn committed Oct 2, 2024
1 parent 4f1b2c3 commit 95339fe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ def log_to_influxdb(
Log the specified data to InfluxDB.
"""
print(f'Tags: {tags}, Fields: {fields}')

# Force data type for certain fields
if 'bit_rate_download' in fields:
fields['bit_rate_download'] = float(fields['bit_rate_download'])
if 'bit_rate_upload' in fields:
fields['bit_rate_upload'] = float(fields['bit_rate_upload'])

json_body = [{
'measurement': 'jvb_stats',
'tags': tags,
Expand Down

0 comments on commit 95339fe

Please sign in to comment.