-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makes brave-spring-beans Spring 2.5 compatible
- Loading branch information
1 parent
372d8fa
commit 47eb60c
Showing
14 changed files
with
58 additions
and
297 deletions.
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
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
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
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
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
75 changes: 3 additions & 72 deletions
75
spring-beans/src/main/java/brave/spring/beans/AsyncReporterFactoryBean.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 |
---|---|---|
@@ -1,75 +1,6 @@ | ||
package brave.spring.beans; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import org.springframework.beans.factory.config.AbstractFactoryBean; | ||
import zipkin2.codec.SpanBytesEncoder; | ||
import zipkin2.reporter.AsyncReporter; | ||
import zipkin2.reporter.ReporterMetrics; | ||
import zipkin2.reporter.Sender; | ||
|
||
/** Spring XML config does not support chained builders. This converts accordingly */ | ||
public class AsyncReporterFactoryBean extends AbstractFactoryBean<AsyncReporter> { | ||
Sender sender; | ||
SpanBytesEncoder encoder = SpanBytesEncoder.JSON_V1; | ||
ReporterMetrics metrics; | ||
Integer messageMaxBytes; | ||
Integer messageTimeout; | ||
Integer closeTimeout; | ||
Integer queuedMaxSpans; | ||
Integer queuedMaxBytes; | ||
|
||
@Override public Class<? extends AsyncReporter> getObjectType() { | ||
return AsyncReporter.class; | ||
} | ||
|
||
@Override protected AsyncReporter createInstance() throws Exception { | ||
AsyncReporter.Builder builder = AsyncReporter.builder(sender); | ||
if (metrics != null) builder.metrics(metrics); | ||
if (messageMaxBytes != null) builder.messageMaxBytes(messageMaxBytes); | ||
if (messageTimeout != null) builder.messageTimeout(messageTimeout, TimeUnit.MILLISECONDS); | ||
if (closeTimeout != null) builder.closeTimeout(closeTimeout, TimeUnit.MILLISECONDS); | ||
if (queuedMaxSpans != null) builder.queuedMaxSpans(queuedMaxSpans); | ||
if (queuedMaxBytes != null) builder.queuedMaxBytes(queuedMaxBytes); | ||
return builder.build(encoder); | ||
} | ||
|
||
@Override protected void destroyInstance(AsyncReporter instance) throws Exception { | ||
instance.close(); | ||
} | ||
|
||
@Override public boolean isSingleton() { | ||
return true; | ||
} | ||
|
||
public void setSender(Sender sender) { | ||
this.sender = sender; | ||
} | ||
|
||
public void setEncoder(SpanBytesEncoder encoder) { | ||
this.encoder = encoder; | ||
} | ||
|
||
public void setMetrics(ReporterMetrics metrics) { | ||
this.metrics = metrics; | ||
} | ||
|
||
public void setMessageMaxBytes(Integer messageMaxBytes) { | ||
this.messageMaxBytes = messageMaxBytes; | ||
} | ||
|
||
public void setMessageTimeout(Integer messageTimeout) { | ||
this.messageTimeout = messageTimeout; | ||
} | ||
|
||
public void setCloseTimeout(Integer closeTimeout) { | ||
this.closeTimeout = closeTimeout; | ||
} | ||
|
||
public void setQueuedMaxSpans(Integer queuedMaxSpans) { | ||
this.queuedMaxSpans = queuedMaxSpans; | ||
} | ||
|
||
public void setQueuedMaxBytes(Integer queuedMaxBytes) { | ||
this.queuedMaxBytes = queuedMaxBytes; | ||
} | ||
/** @deprecated use {@link zipkin2.reporter.beans.AsyncReporterFactoryBean} */ | ||
@Deprecated | ||
public class AsyncReporterFactoryBean extends zipkin2.reporter.beans.AsyncReporterFactoryBean { | ||
} |
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
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
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
160 changes: 0 additions & 160 deletions
160
spring-beans/src/test/java/brave/spring/beans/AsyncReporterFactoryBeanTest.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.