Issue 34488:Remove Abstract Component#35898
Conversation
|
Pinging @elastic/es-core-infra |
cbuescher
left a comment
There was a problem hiding this comment.
@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.
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.
I think we should do the same thing here as we do for BaseRestHandler.
| 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.
This logger appears to be unused.
There was a problem hiding this comment.
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.
Why is this logger deprecated?
There was a problem hiding this comment.
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.
pgomulka
left a comment
There was a problem hiding this comment.
@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
|
|
||
| private final LongAdder usageCount = new LongAdder(); | ||
| @Deprecated | ||
| protected static Logger logger = LogManager.getLogger(BaseRestHandler.class); |
There was a problem hiding this comment.
why is this logger deprecated?
There was a problem hiding this comment.
should this be for getClass() instead of BaseRestHandler.class?
There was a problem hiding this comment.
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.
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)
| 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.
that seems to be unused, do we need that? (won't pass the build)
| private final ActionFilter[] filters; | ||
| protected final TaskManager taskManager; | ||
| @Deprecated | ||
| protected static Logger logger = LogManager.getLogger(TransportAction.class); |
There was a problem hiding this comment.
should this be for getClass() instead of TransportAction.class?
There was a problem hiding this comment.
Same has above, use getClass with static?
cbuescher
left a comment
There was a problem hiding this comment.
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.
| private final ActionFilter[] filters; | ||
| protected final TaskManager taskManager; | ||
| @Deprecated | ||
| protected static Logger logger = LogManager.getLogger(TransportAction.class); |
There was a problem hiding this comment.
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.
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.
I will add the comment on deprecated loggers.
|
|
||
| private final LongAdder usageCount = new LongAdder(); | ||
| @Deprecated | ||
| protected static Logger logger = LogManager.getLogger(BaseRestHandler.class); |
cbuescher
left a comment
There was a problem hiding this comment.
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 |
|
@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