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

Do not fail es-cleaner if there are no jaeger indices #1569

Merged

Conversation

pavolloffay
Copy link
Member

@pavolloffay pavolloffay commented May 27, 2019

Resolves #1468

The original stacktrace

Traceback (most recent call last):
  File "plugin/storage/es/esCleaner.py", line 89, in <module>
    main()
  File "plugin/storage/es/esCleaner.py", line 49, in main
    filter_main_indices(ilo, prefix)
  File "plugin/storage/es/esCleaner.py", line 65, in filter_main_indices
    ilo.filter_by_age(source='name', direction='older', timestring='%Y-%m-%d', unit='days', unit_count=int(sys.argv[1]))
  File "/usr/local/lib/python3.6/site-packages/curator/indexlist.py", line 495, in filter_by_age
    stats_result=stats_result
  File "/usr/local/lib/python3.6/site-packages/curator/indexlist.py", line 356, in _calculate_ages
    self._get_name_based_ages(timestring)
  File "/usr/local/lib/python3.6/site-packages/curator/indexlist.py", line 279, in _get_name_based_ages
    self.empty_list_check()
  File "/usr/local/lib/python3.6/site-packages/curator/indexlist.py", line 226, in empty_list_check
    raise exceptions.NoIndices('index_list object is empty.')
curator.exceptions.NoIndices: index_list object is empty.

I have tested this with ES 5.x and 6.x. Archive storage works also fine.

@codecov
Copy link

codecov bot commented May 27, 2019

Codecov Report

Merging #1569 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1569   +/-   ##
=======================================
  Coverage   98.79%   98.79%           
=======================================
  Files         190      190           
  Lines        9063     9063           
=======================================
  Hits         8954     8954           
  Misses         85       85           
  Partials       24       24

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ed618d...67030ad. Read the comment docs.

@@ -59,6 +59,7 @@ def main():

def filter_main_indices(ilo, prefix):
ilo.filter_by_regex(kind='prefix', value=prefix + "jaeger")
empty_list(ilo, "No indices to delete")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty_list function seems to kill the process if the list is empty (better name would be panic_if_list_empty)

so how does this achieve "do not fail" objective?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty_list ends the process with 0 which indicates success. This is exactly what we want. Without this fix the process is not ended and an exception is thrown.

@objectiser
Copy link
Contributor

@pavolloffay Just checking - you say archive storage works fine, but shouldn't filter_archive_indices also have the same empty_list check?

@pavolloffay
Copy link
Member Author

Yes the archive storage wors well. The methods invoked in ilo does not fail if the list is empty.

@objectiser objectiser merged commit 29615cb into jaegertracing:master May 28, 2019
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

Successfully merging this pull request may close these issues.

Elasticsearch Curator fails the Kubernetes CronJob when there's no data
3 participants