-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Introduce error reporting in schema #3790
Conversation
logp.Err("%s", err) | ||
errs := multierror.Errors{} | ||
errs = append(errs, err) | ||
return errs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could these lines be written as return multierror.Errors{err}
? Would be nicer if it works.
I like the idea. Generally I'd suggest making this be the |
metricbeat/schema/error.go
Outdated
type Error struct { | ||
key string | ||
message string | ||
errorType int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to make ErrorType a type so that it's restricted to the consts above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
3fddd75
to
6dd996a
Compare
Currently in schema errors are only reported through logging which makes testing difficult. This PR introduces the collection of errors during applying the schema. Now Apply returns a list of errors. Currently these are ignored to keep the same implementation as before. Over time this should be adjusted to handle errors correctly. Logging in the schema should be remove and moved up to the Metricsets itself. This change should also simplify testing of different versions in unit tests, as `schema.Apply` will return errors. Currently this check is done in the system tests checking the log itself which is not very efficient. ApplyNoError was introduced as a temporary workaround for the processors implementation. This is part of elastic#3807
6dd996a
to
1a53e73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Currently in schema errors are only reported through logging which makes testing difficult. This PR introduces the collection of errors during applying the schema.
Now Apply returns a list of errors. Currently these are ignored to keep the same implementation as before. Over time this should be adjusted to handle errors correctly. Logging in the schema should be remove and moved up to the Metricsets itself.
This change should also simplify testing of different versions in unit tests, as
schema.Apply
will return errors. Currently this check is done in the system tests checking the log itself which is not very efficient.ApplyNoError was introduced as a temporary workaround for the processors implementation.
This is part of #3807