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

Avoid long worrying log line at info level #1044

Merged
merged 1 commit into from
Jan 20, 2024
Merged

Conversation

sparrowt
Copy link
Contributor

@sparrowt sparrowt commented Jan 5, 2024

Currently there is an info level log line when checking if a datastream exists, but it includes the entire error even though it is caught and expected.

This results in long worrying looking log messages which are in fact not a problem (once you notice that they are info level) e.g. like this:

[info]: #0 Specified data stream does not exist. Will be created: <[404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [my.datastream.name]","resource.type":"index_or_alias","resource.id":"my.datastream.name","index_uuid":"na","index":"my.datastream.name"}],"type":"index_not_found_exception","reason":"no such index [my.datastream.name]","resource.type":"index_or_alias","resource.id":"my.datastream.name","index_uuid":"na","index":"my.datastream.name"},"status":404}>

We know what the error is going to be given it is being caught explicitly, so instead simplify and just log the name of the datastream which looks much nicer like this instead:

[info]: #0 Specified data stream does not exist. Will be created: <my.datastream.name>

I don't think any of the below checklist are relevant but please let me know if you think they are.
Thanks!

(check all that apply)

  • tests added
  • tests passing
  • README updated (if needed)
  • README Table of Contents updated (if needed)
  • History.md and version in gemspec are untouched
  • backward compatible
  • feature works in elasticsearch_dynamic (not required but recommended)

Currently there is an info level log line when checking if a datastream exists, but it includes the entire error even though it is caught and expected.

This results in long worrying looking log messages which are in fact not a problem (once you notice that they are info level) e.g. like this:
```
[info]: #0 Specified data stream does not exist. Will be created: <[404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [my.datastream.name]","resource.type":"index_or_alias","resource.id":"my.datastream.name","index_uuid":"_na_","index":"my.datastream.name"}],"type":"index_not_found_exception","reason":"no such index [my.datastream.name]","resource.type":"index_or_alias","resource.id":"my.datastream.name","index_uuid":"_na_","index":"my.datastream.name"},"status":404}>
```
so simplify it to instead just log the name of the datastream.

We know what the error is going to be given it is being caught explicitly.
@cosmo0920 cosmo0920 merged commit 96e1ec4 into uken:master Jan 20, 2024
9 checks passed
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.

2 participants