Skip to content
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
wants to merge 2 commits into
base: 8.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}
Expand All @@ -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 Logstash 9.0");
return new PipelineBusV1();
case "v2": return new PipelineBusV2();
default:
LOGGER.warn("unknown pipeline-bus implementation: {}", pipelineBusImplementation);
Expand Down
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());
}
}
Loading