-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
deprecate pipeline bus v1 #16643
Open
yaauie
wants to merge
2
commits into
elastic:8.x
Choose a base branch
from
yaauie:deprecate-pipeline-bus-v1
base: 8.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
deprecate pipeline bus v1 #16643
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,10 +19,12 @@ | |
|
||
package org.logstash.plugins.pipeline; | ||
|
||
import co.elastic.logstash.api.DeprecationLogger; | ||
import com.google.common.annotations.VisibleForTesting; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.logstash.ext.JrubyEventExtLibrary; | ||
import org.logstash.log.DefaultDeprecationLogger; | ||
|
||
import java.util.Collection; | ||
import java.util.Optional; | ||
|
@@ -37,6 +39,7 @@ | |
public interface PipelineBus { | ||
|
||
Logger LOGGER = LogManager.getLogger(PipelineBus.class); | ||
DeprecationLogger DEPRECATION_LOGGER = new DefaultDeprecationLogger(LOGGER); | ||
|
||
/** | ||
* API-stable entry-point for creating a {@link PipelineBus} | ||
|
@@ -45,7 +48,9 @@ public interface PipelineBus { | |
static PipelineBus create() { | ||
final String pipelineBusImplementation = System.getProperty("logstash.pipelinebus.implementation", "v2"); | ||
switch (pipelineBusImplementation) { | ||
case "v1": return new PipelineBusV1(); | ||
case "v1": | ||
DEPRECATION_LOGGER.deprecated("The legacy pipeline bus selected with `logstash.pipelinebus.implementation=v1` is deprecated, and will be removed in a future release of Logstash"); | ||
return new PipelineBusV1(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like in the case we have an "unknown" configuration setting we "default" to v1 still. Maybe as part of calling out v1 is deprecated we can also change that fallback to also be v2. diff --git a/logstash-core/src/main/java/org/logstash/plugins/pipeline/PipelineBus.java b/logstash-core/src/main/java/org/logstash/plugins/pipeline/PipelineBus.java
index 487793d62..b10fa6729 100644
--- a/logstash-core/src/main/java/org/logstash/plugins/pipeline/PipelineBus.java
+++ b/logstash-core/src/main/java/org/logstash/plugins/pipeline/PipelineBus.java
@@ -54,7 +54,7 @@ public interface PipelineBus {
case "v2": return new PipelineBusV2();
default:
LOGGER.warn("unknown pipeline-bus implementation: {}", pipelineBusImplementation);
- return new PipelineBusV1();
+ return new PipelineBusV2();
}
} |
||
case "v2": return new PipelineBusV2(); | ||
default: | ||
LOGGER.warn("unknown pipeline-bus implementation: {}", pipelineBusImplementation); | ||
|
34 changes: 34 additions & 0 deletions
34
logstash-core/src/test/java/org/logstash/log/LoggingSpyResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.logstash.log; | ||
|
||
import org.apache.logging.log4j.core.*; | ||
import org.apache.logging.log4j.test.appender.ListAppender; | ||
import org.junit.rules.ExternalResource; | ||
|
||
import java.util.List; | ||
|
||
public class LoggingSpyResource extends ExternalResource { | ||
|
||
private static final String APPENDER_NAME = "spyAppender"; | ||
|
||
private final Logger loggerToSpyOn; | ||
private final ListAppender appender = new ListAppender(APPENDER_NAME); | ||
|
||
public LoggingSpyResource(final org.apache.logging.log4j.Logger loggerToSpyOn) { | ||
this.loggerToSpyOn = (Logger) loggerToSpyOn; | ||
} | ||
|
||
@Override | ||
protected void before() throws Throwable { | ||
appender.start(); | ||
loggerToSpyOn.addAppender(appender); | ||
} | ||
|
||
@Override | ||
protected void after() { | ||
loggerToSpyOn.removeAppender(appender); | ||
} | ||
|
||
public List<LogEvent> getLogEvents() { | ||
return List.copyOf(appender.getEvents()); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It seems like configuring pipeline bus implementation setting itself is or should be deprecated. Maybe the deprecation should be focused on removing that setting rather than the value it is set to.