Skip to content

Change default level for deprecation logging#80167

Merged
jakelandis merged 16 commits intoelastic:masterfrom
jakelandis:change_default_level
Nov 4, 2021
Merged

Change default level for deprecation logging#80167
jakelandis merged 16 commits intoelastic:masterfrom
jakelandis:change_default_level

Conversation

@jakelandis
Copy link
Copy Markdown
Contributor

@jakelandis jakelandis commented Nov 1, 2021

This commit updates all deprecation message (except for REST
compatible API messages) in 8.0+ to be emit at warning level.
Currently none of these have been removed in future versions (yet) so they
should be logged at warning, not critical.

This commit also changes the default assertWarning to assert at warning level
and introduces a new assertCriticalWarning to assert critical warnings.

Copy link
Copy Markdown
Contributor

@pgomulka pgomulka left a comment

Choose a reason for hiding this comment

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

LGTM

@jakelandis
Copy link
Copy Markdown
Contributor Author

jakelandis commented Nov 2, 2021

@pgomulka - can you take another look ? I also drop the non-settings down to warn level, such that nothing only REST compatible warning will currently log to critical. It looks like like of changes, but the code change was just some creative use of Intellij's refactoring.

Copy link
Copy Markdown
Contributor

@pgomulka pgomulka left a comment

Choose a reason for hiding this comment

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

LGTM, I scrolled through the changes and all looks great

StructRemovalField parse = StructRemovalField.PARSER.parse(parser, null);

assertWarnings("The field old_name has been removed and is being ignored");
assertCriticalWarnings("The field old_name has been removed and is being ignored");
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

REST API compatibility still warns at critical level.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess it is ok? compatibility warns about a feature that was already removed

public void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws Exception {
if (compatibleVersionWarning == false) {
deprecationLogger.critical(DeprecationCategory.API, deprecationKey, deprecationMessage);
deprecationLogger.warn(DeprecationCategory.API, deprecationKey, deprecationMessage);
Copy link
Copy Markdown
Contributor Author

@jakelandis jakelandis Nov 2, 2021

Choose a reason for hiding this comment

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

We will still need a way to emit critical level deprecations when decalaring a REST handler. I will log a follow up issue.

/**
* Check that a deprecation message with CRITICAL level can be recorded to an index
*/
public void testDeprecationCriticalWarnMessagesCanBeIndexed() throws Exception {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now that the default is WARN, we needed to cover the case of a non-compat critical warning.

@jakelandis
Copy link
Copy Markdown
Contributor Author

@elasticmachine update branch

@masseyke
Copy link
Copy Markdown
Member

masseyke commented Nov 3, 2021

I believe all of your test failures are fixed by #80304 if we go that direction.

@jakelandis
Copy link
Copy Markdown
Contributor Author

@elasticmachine update branch

@jakelandis
Copy link
Copy Markdown
Contributor Author

@dakrone - can you take a look, this PR should be stable now. The initial (and primary change) was done with Intellij refactoring, however some the tests needed to updated to account for the new default warning level.

Copy link
Copy Markdown
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM

@jakelandis jakelandis added the auto-backport Automatically create backport pull requests when merged label Nov 4, 2021
@jakelandis jakelandis merged commit 255bf50 into elastic:master Nov 4, 2021
@jakelandis jakelandis deleted the change_default_level branch November 4, 2021 17:35
@jakelandis jakelandis removed the auto-backport Automatically create backport pull requests when merged label Nov 4, 2021
jakelandis added a commit to jakelandis/elasticsearch that referenced this pull request Nov 4, 2021
This commit updates all deprecation message (except for REST
compatible API messages) in 8.0+ to be emit at warning level.
Currently none of these have been removed in future versions (yet) so they
should be logged at warning, not critical.

This commit also changes the default assertWarning to assert at warning level
and introduces a new assertCriticalWarning to assert critical warnings.
jakelandis added a commit that referenced this pull request Nov 4, 2021
This commit updates all deprecation message (except for REST
compatible API messages) in 8.0+ to be emit at warning level.
Currently none of these have been removed in future versions (yet) so they
should be logged at warning, not critical.

This commit also changes the default assertWarning to assert at warning level
and introduces a new assertCriticalWarning to assert critical warnings.
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Nov 10, 2021
This allows specifying an optional level to be used for the deprecation handler registering a route.

Relates to elastic#80167
dakrone added a commit that referenced this pull request Nov 16, 2021
This allows specifying an optional level to be used for the deprecation handler registering a route.

The default remains if the level is unspecified.

Relates to #80167
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Nov 16, 2021
…tic#80629)

This allows specifying an optional level to be used for the deprecation handler registering a route.

The default remains if the level is unspecified.

Relates to elastic#80167
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Nov 16, 2021
…tic#80629)

This allows specifying an optional level to be used for the deprecation handler registering a route.

The default remains if the level is unspecified.

Relates to elastic#80167

# Conflicts:
#	server/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java
#	server/src/main/java/org/elasticsearch/rest/DeprecationRestHandler.java
#	server/src/main/java/org/elasticsearch/rest/RestController.java
#	server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java
#	server/src/test/java/org/elasticsearch/rest/DeprecationRestHandlerTests.java
#	server/src/test/java/org/elasticsearch/rest/RestControllerTests.java
elasticsearchmachine pushed a commit that referenced this pull request Nov 16, 2021
…) (#80776)

This allows specifying an optional level to be used for the deprecation handler registering a route.

The default remains if the level is unspecified.

Relates to #80167
elasticsearchmachine pushed a commit that referenced this pull request Nov 16, 2021
…) (#80779)

This allows specifying an optional level to be used for the deprecation handler registering a route.

The default remains if the level is unspecified.

Relates to #80167

# Conflicts:
#	server/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java
#	server/src/main/java/org/elasticsearch/rest/DeprecationRestHandler.java
#	server/src/main/java/org/elasticsearch/rest/RestController.java
#	server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java
#	server/src/test/java/org/elasticsearch/rest/DeprecationRestHandlerTests.java
#	server/src/test/java/org/elasticsearch/rest/RestControllerTests.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants