-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Issue 34488:Remove Abstract Component #35898
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
Conversation
Pinging @elastic/es-core-infra |
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.
@ricardojaferreira I left two comments, also please note that this change in its current form doesn't compile and there are PRs that are still not merged that are necessary to go in before we are actually able to remove this class entirely (e.g. #35394)
|
||
protected final String actionName; | ||
private final ActionFilter[] filters; | ||
protected final TaskManager taskManager; | ||
private static final Logger logger = LogManager.getLogger(TransportAction.class); |
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.
I'm not sure that we want every action extending this to use the same logger. Also the visivility won't work, this leaves a lot of compile errors for me in "server".
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.
I think we should do the same thing here as we do for BaseRestHandler
.
|
||
public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX = | ||
Setting.boolSetting("rest.action.multi.allow_explicit_index", true, Property.NodeScope); | ||
|
||
private final LongAdder usageCount = new LongAdder(); | ||
private static final Logger logger = LogManager.getLogger(BaseRestHandler.class); |
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.
This logger appears to be unused.
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.
I was thinking of having something like:
@Deprecated
protected static Logger logger = LogMangaer.getLogger(getClass());
in 6.x and master and then removing it entirely from master in a follow up change.
|
||
protected final String actionName; | ||
private final ActionFilter[] filters; | ||
protected final TaskManager taskManager; | ||
@Deprecated |
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.
Why is this logger deprecated?
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.
I think that subclasses of TransportAction
should declare their own logger. But I think it'd be kinder that that were only a hard requirement for 7.0 so making a deprecated logger here is nice, so long as we follow up to zap it.
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.
@ricardojaferreira great effort, thank you. I left some comments. Make sure the build passes to you locally. Definitely ./gradlew assemble precommit. Consider running ./gradlew check to see all tests passing
|
||
public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX = | ||
Setting.boolSetting("rest.action.multi.allow_explicit_index", true, Property.NodeScope); | ||
|
||
private final LongAdder usageCount = new LongAdder(); | ||
@Deprecated | ||
protected static Logger logger = LogManager.getLogger(BaseRestHandler.class); |
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.
why is this logger deprecated?
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.
should this be for getClass() instead of BaseRestHandler.class?
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.
Yeah, getClass()
I think.
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.
Hi, Thanks for the comments. I am still understanding how the project works. Anyway, to use getClass()
the logger cannot be static. Is that ok? (Or am I seeing something wrong here)
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.
Hi, Thanks for the comments. I am still understanding how the project works. Anyway, to use getClass()
the logger cannot be static. Is that ok? (Or am I seeing something wrong here)
@@ -18,24 +18,26 @@ | |||
*/ | |||
|
|||
package org.elasticsearch.action.support; | |||
|
|||
import org.apache.logging.log4j.LogManager; | |||
import org.apache.logging.log4j.message.ParameterizedMessage; |
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.
that seems to be unused, do we need that? (won't pass the build)
|
||
protected final String actionName; | ||
private final ActionFilter[] filters; | ||
protected final TaskManager taskManager; | ||
@Deprecated | ||
protected static Logger logger = LogManager.getLogger(TransportAction.class); |
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.
should this be for getClass() instead of TransportAction.class?
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.
Same has above, use getClass with static?
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.
Hi @ricardojaferreira, as far as I see your last commit only changed the visibility of the loggers in TransportAction and BaseRestHandler but their would still share the same logger with all inheriting classes. I left a comment along those lines. I might not be totally up to date with the current state of the final works on #34488 so I ask @nik9000 and @pgomulka to also take a look because they will know the remaining other work that needs to get done around it.
|
||
protected final String actionName; | ||
private final ActionFilter[] filters; | ||
protected final TaskManager taskManager; | ||
@Deprecated | ||
protected static Logger logger = LogManager.getLogger(TransportAction.class); |
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.
Using "LogManager.getLogger(TransportAction.class)" would still mean all inheriting classes using this would share the same logger. I don't think this is what we want. Something like "LogManager.getLogger(getClass())" might work for now. Also: why did you add the "@deprecated" annotation? The loggers themselves are not ment to be deprecated as far as I understand #34488 .
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.
I like deprecating them because I think everything that wants a logger should declare one. That way we don't have a zillion loggers we don't use. I do think that if you deprecate something you should add javadoc explaining what to do instead. Something like:
/**
* @deprecated declare your own logger.
*/
@Deprecated
protected static Logger logger = LogManager.getLogger(TransportAction.class);
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.
I will add the comment on deprecated loggers.
|
||
public static final Setting<Boolean> MULTI_ALLOW_EXPLICIT_INDEX = | ||
Setting.boolSetting("rest.action.multi.allow_explicit_index", true, Property.NodeScope); | ||
|
||
private final LongAdder usageCount = new LongAdder(); | ||
@Deprecated | ||
protected static Logger logger = LogManager.getLogger(BaseRestHandler.class); |
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.
same here as 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.
Thanks for the update, LGTM
@ricardojaferreira could you please merge upstream master into this PR? (as it is failing backwards compatibility tests at the moment) |
@elasticmachine run packaging-sample |
@elasticmachine run elasticsearch-ci/packaging-sample |
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. Build passes
@ricardojaferreira the PR now passed the build and I have merged your change. Thank you once again for you contribution! |
TransportAction and BaseRestHandler now no longer extends AbstractComponent. The AbstractComponent no longer has usages so it was deleted.
Relates to #34488