vimeo / graph-explorer

A graphite dashboard powered by structured metrics
http://vimeo.github.io/graph-explorer/
Apache License 2.0
1.06k stars 93 forks source link

update_metrics.py: "IndexAlreadyExistsException" #87

Closed andral closed 10 years ago

andral commented 10 years ago

Hi

I have elasticsearch running on the same host as graph-exlporer.

When I run update-metrics.py for the first time it creates a new es index but then exceptions out with the following:

2014-01-13 15:51:46,522 - update_metrics - INFO - fetching/saving metrics from graphite...
2014-01-13 15:51:46,543 - update_metrics - INFO - generating structured metrics data...
2014-01-13 15:51:46,543 - update_metrics - DEBUG - loading metrics
2014-01-13 15:51:46,547 - update_metrics - DEBUG - removing outdated targets
2014-01-13 15:51:46,547 - update_metrics - DEBUG - making sure index exists..
2014-01-13 15:51:47,222 - update_metrics - DEBUG - making sure shard is started..
2014-01-13 15:51:47,238 - update_metrics - DEBUG - shard[0][0] state: RECOVERING
2014-01-13 15:51:47,344 - update_metrics - DEBUG - shard[0][0] state: STARTED
2014-01-13 15:51:47,345 - update_metrics - DEBUG - making sure index exists..
2014-01-13 15:51:47,390 - update_metrics - ERROR - sorry, something went wrong: (ElasticException(...), 'ElasticSearch Error: {"error":"IndexAlreadyExistsException[[graphite_metrics] already exists]","status":400}')
Traceback (most recent call last):
  File "./update_metrics.py", line 36, in <module>
    backend.update_data(s_metrics)
  File "/opt/graph-explorer/backend.py", line 78, in update_data
    s_metrics.remove_metrics_not_in(metrics)
  File "/opt/graph-explorer/structured_metrics/__init__.py", line 201, in remove_metrics_not_in
    for es_metrics in self.get_all_metrics():
  File "/opt/graph-explorer/structured_metrics/__init__.py", line 298, in get_all_metrics
    self.assure_index()
  File "/opt/graph-explorer/structured_metrics/__init__.py", line 180, in assure_index
    self.es.post('graphite_metrics', data=body)
  File "/usr/lib/python2.6/site-packages/rawes/elastic.py", line 62, in post
    return self.request('post', path, **kwargs)
  File "/usr/lib/python2.6/site-packages/rawes/elastic.py", line 84, in request
    return self.connection.request(method, new_path, **kwargs)
  File "/usr/lib/python2.6/site-packages/rawes/http_connection.py", line 48, in request
    return self._decode(response, json_decoder)
  File "/usr/lib/python2.6/site-packages/rawes/http_connection.py", line 61, in _decode
    result=decoded, status_code=response.status_code)
ElasticException: (ElasticException(...), 'ElasticSearch Error: {"error":"IndexAlreadyExistsException[[graphite_metrics] already exists]","status":400}')

ES is fine according to http://.../_status. If I run the script again, the same exception gets thrown, this is also true if I delete the index first and then run the script again.

This is on RHEL6.4 with python 2.6.6 and elasticsearch 0.90.10.

Any help is appreciated! Cheers

Dieterbe commented 10 years ago

hmmm so that has been fixed in git for a while, but i haven't done a release recently. i just realised most people will try to use the most recent stable release and hence hit this bug :l

for now you can pretty safely use the latest git version but i guess i really need to do a new release

Dieterbe commented 10 years ago

hey @andral I just pushed a new release that comes with the fix https://github.com/vimeo/graph-explorer/releases/tag/v1.2.0

please reopen if you get the issue again (very unlikely :)

andral commented 10 years ago

Hey @Dieterbe, thanks a lot for the new release, the issue is gone and the script runs without any errors, yay :)

Thanks a lot