Introduce deprecation categories#68061
Conversation
The JSON logs that Elasticsearch produces are roughly in an ECS shape. This PR improves that alignment.
Sort-of backport of elastic#67443. Closes elastic#64824. Introduce the concept of categories to deprecation logging. Every location where we log a deprecation message must now include a deprecation category.
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
williamrandolph
left a comment
There was a problem hiding this comment.
Whew, that's a lot of deprecations. I had a few idle thoughts but nothing blocking, so LGTM.
| "this option is deprecated and non-functional and should be removed from Java configuration.", | ||
| BootstrapInfo.getSystemProperties().get("es.xcontent.strict_duplicate_detection")); | ||
| DeprecationLogger.getLogger(Bootstrap.class).deprecate("strict_duplicate_detection_setting_removed", message); | ||
| DeprecationLogger.getLogger(Bootstrap.class).deprecate(DeprecationCategory.OTHER, "strict_duplicate_detection_setting_removed", |
There was a problem hiding this comment.
Arguably this could be SETTINGS, although it's a JVM setting and not an Elasticsearch setting.
| } catch (Exception e) { | ||
| DEPRECATION_LOGGER.deprecate("date_mapper_null_field", "Error parsing [" + nullValue.getValue() | ||
| DEPRECATION_LOGGER.deprecate(DeprecationCategory.MAPPINGS, "date_mapper_null_field", | ||
| "Error parsing [" + nullValue.getValue() |
There was a problem hiding this comment.
extreme, probably-shouldn't-even-write-this-comment nitpick: putting the line break after field [" might be slightly more visually appealing
(I hope these tiny nitpicks give you confidence in the thoroughness of my review, rather than just annoying you.)
| @Override | ||
| public Void run() { | ||
| deprecationLogger.deprecate(key, message, params); | ||
| deprecationLogger.deprecate(category, key, message, params); |
There was a problem hiding this comment.
Consider just passing in DeprecationCategory.PARSING here instead of altering the methods below. Since this method is private I think it's safe to say it'll be used for parsing issues within this class.
|
Thank you @williamrandolph! |
Deprecation logs in 7.x are using ESJsonLayout and it requires additional fields to be declared in a log4j config in order to emit values to logs. This commit adds category field to deprecation log pattern context: in 8.0 we use ECSLayout which do not require to declare additional fields upfront. In 7.x we have to declare them in the logging config. The PR introducing categories in master #67443. A backport to 7.x which missed this field #68061
Sort-of backport of #67443.
Closes #64824. Introduce the concept of categories to deprecation
logging. Every location where we log a deprecation message must now
include a deprecation category.