save dongleid as value to limit cardinality (#23594)

pull/23557/merge
Robbe Derks 2022-01-21 17:10:43 +01:00 committed by GitHub
parent d3d10e014a
commit 0f95e605f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -42,11 +42,12 @@ class StatLog:
def main():
dongle_id = Params().get("DongleId", encoding='utf-8')
def get_influxdb_line(measurement: str, value: float, timestamp: datetime, tags: dict):
res = f"{measurement}"
for k, v in tags.items():
res += f",{k}={str(v)}"
res += f" value={value} {int(timestamp.timestamp() * 1e9)}\n"
res += f" value={value},dongle_id=\"{dongle_id}\" {int(timestamp.timestamp() * 1e9)}\n"
return res
# open statistics socket
@ -59,7 +60,6 @@ def main():
# initialize tags
tags = {
'dongleId': Params().get("DongleId", encoding='utf-8'),
'started': False,
'version': get_short_version(),
'branch': get_short_branch(),