Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InfluxDB wont store float where string was first. #1

Open
rdek opened this issue May 15, 2019 · 0 comments
Open

InfluxDB wont store float where string was first. #1

rdek opened this issue May 15, 2019 · 0 comments

Comments

@rdek
Copy link

rdek commented May 15, 2019

I facing an issue:

/opt/sonarqube-exporter$ python3 sonarClient.py
before while loop...
count -----
1
begin export data...
com.g-dev.jve:G_PUS AWfG1stnhxQdf62aHguD
Traceback (most recent call last):
  File "sonarClient.py", line 132, in <module>
    project.export_metrics()
  File "sonarClient.py", line 82, in export_metrics
    influx_client.write_points(self._prepare_metrics())
  File "/home/me/.local/lib/python3.4/site-packages/influxdb/client.py", line 490, in write_points
    tags=tags, protocol=protocol)
  File "/home/me/.local/lib/python3.4/site-packages/influxdb/client.py", line 551, in _write_points
    protocol=protocol
  File "/home/me/.local/lib/python3.4/site-packages/influxdb/client.py", line 327, in write
    headers=headers
  File "/home/me/.local/lib/python3.4/site-packages/influxdb/client.py", line 286, in request
    raise InfluxDBClientError(response.content, response.status_code)
influxdb.exceptions.InfluxDBClientError: 400: {"error":"partial write: field type conflict: input field \"value\" on measurement \"violations\" is type float, already exists as type string dropped=35"}

and fix it simply by changing:

"value": float(metric['value'] if ('value' in metric) else 0)

to

"value": metric['value'] if ('value' in metric) else 0

Enjoy your day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant