-
Notifications
You must be signed in to change notification settings - Fork 330
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
chore: Spring Boot 3.3 updates #2923
Changes from 9 commits
ed354e9
820a946
f440d9c
25ba0b0
9927df1
a6f1f09
2ffd7e0
dee61ba
4906971
81d9ec8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,9 +39,9 @@ | |
<spring-cloud-dependencies.version>2023.0.1</spring-cloud-dependencies.version> | ||
<spring-boot-dependencies.version>3.3.0</spring-boot-dependencies.version> | ||
<spring-cloud-gcp-dependencies.version>${project.parent.version}</spring-cloud-gcp-dependencies.version> | ||
<zipkin-gcp.version>1.1.1</zipkin-gcp.version> | ||
<zipkin-gcp.version>2.2.4</zipkin-gcp.version> | ||
<java-cfenv.version>2.5.0</java-cfenv.version> | ||
<micrometer-tracing.verison>1.2.5</micrometer-tracing.verison> | ||
<micrometer-tracing.version>1.2.5</micrometer-tracing.version> | ||
|
||
<!-- Plugin versions --> | ||
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version> | ||
|
@@ -111,6 +111,18 @@ | |
<version>0.1.5</version> | ||
</dependency> | ||
|
||
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.
|
||
<dependency> | ||
<groupId>io.zipkin.gcp</groupId> | ||
<artifactId>zipkin-encoder-stackdriver</artifactId> | ||
<version>${zipkin-gcp.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.zipkin.gcp</groupId> | ||
<artifactId>brave-encoder-stackdriver</artifactId> | ||
<version>${zipkin-gcp.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.zipkin.gcp</groupId> | ||
<artifactId>zipkin-sender-stackdriver</artifactId> | ||
|
@@ -150,7 +162,7 @@ | |
<dependency> | ||
<groupId>io.micrometer</groupId> | ||
<artifactId>micrometer-tracing-bom</artifactId> | ||
<version>${micrometer-tracing.verison}</version> | ||
<version>${micrometer-tracing.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,10 @@ | |
|
||
package com.google.cloud.spring.autoconfigure.trace; | ||
|
||
import brave.Tags; | ||
import brave.TracingCustomizer; | ||
import brave.baggage.BaggagePropagation; | ||
import brave.handler.MutableSpan; | ||
import brave.handler.SpanHandler; | ||
import brave.propagation.B3Propagation; | ||
import brave.propagation.Propagation; | ||
|
@@ -49,18 +51,12 @@ | |
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; | ||
import zipkin2.CheckResult; | ||
import zipkin2.Span; | ||
import zipkin2.codec.BytesEncoder; | ||
import zipkin2.codec.SpanBytesEncoder; | ||
import zipkin2.reporter.AsyncReporter; | ||
import zipkin2.reporter.Reporter; | ||
import zipkin2.reporter.BytesEncoder; | ||
import zipkin2.reporter.ReporterMetrics; | ||
import zipkin2.reporter.Sender; | ||
import zipkin2.reporter.brave.ZipkinSpanHandler; | ||
import zipkin2.reporter.stackdriver.StackdriverEncoder; | ||
import zipkin2.reporter.brave.AsyncZipkinSpanHandler; | ||
import zipkin2.reporter.stackdriver.StackdriverSender; | ||
import zipkin2.reporter.stackdriver.StackdriverSender.Builder; | ||
import zipkin2.reporter.stackdriver.brave.StackdriverV2Encoder; | ||
|
||
/** Config for Stackdriver Trace. */ | ||
@AutoConfiguration | ||
|
@@ -75,10 +71,9 @@ public class StackdriverTraceAutoConfiguration { | |
private static final Log LOGGER = LogFactory.getLog(StackdriverTraceAutoConfiguration.class); | ||
|
||
/** | ||
* Stackdriver reporter bean name. Name of the bean matters for supporting multiple tracing | ||
* systems. | ||
* Stackdriver encoder bean name. Name of the bean matters for supporting multiple tracing systems. | ||
*/ | ||
public static final String REPORTER_BEAN_NAME = "stackdriverReporter"; | ||
public static final String ENCODER_BEAN_NAME = "stackdriverEncoder"; | ||
|
||
/** | ||
* Stackdriver sender bean name. Name of the bean matters for supporting multiple tracing systems. | ||
|
@@ -129,9 +124,16 @@ public TracingCustomizer stackdriverTracingCustomizer( | |
|
||
@Bean(SPAN_HANDLER_BEAN_NAME) | ||
@ConditionalOnMissingBean(name = SPAN_HANDLER_BEAN_NAME) | ||
public SpanHandler stackdriverSpanHandler( | ||
@Qualifier(REPORTER_BEAN_NAME) Reporter<Span> stackdriverReporter) { | ||
return ZipkinSpanHandler.create(stackdriverReporter); | ||
public AsyncZipkinSpanHandler stackdriverSpanHandler( | ||
@Qualifier(SENDER_BEAN_NAME) StackdriverSender sender, | ||
@Qualifier(ENCODER_BEAN_NAME) BytesEncoder<MutableSpan> encoder, | ||
ReporterMetrics reporterMetrics, | ||
GcpTraceProperties trace) { | ||
return AsyncZipkinSpanHandler.newBuilder(sender) | ||
.metrics(reporterMetrics) | ||
.queuedMaxSpans(1000) | ||
.messageTimeout(trace.getMessageTimeout(), TimeUnit.SECONDS) | ||
.build(encoder); | ||
} | ||
|
||
@Bean | ||
|
@@ -167,33 +169,9 @@ public ManagedChannel stackdriverSenderChannel() { | |
.build(); | ||
} | ||
|
||
@Bean(REPORTER_BEAN_NAME) | ||
@ConditionalOnMissingBean(name = REPORTER_BEAN_NAME) | ||
public AsyncReporter<Span> stackdriverReporter( | ||
ReporterMetrics reporterMetrics, | ||
GcpTraceProperties trace, | ||
@Qualifier(SENDER_BEAN_NAME) Sender sender) { | ||
|
||
AsyncReporter<Span> asyncReporter = | ||
AsyncReporter.builder(sender) | ||
// historical constraint. Note: AsyncReporter supports memory bounds | ||
.queuedMaxSpans(1000) | ||
.messageTimeout(trace.getMessageTimeout(), TimeUnit.SECONDS) | ||
.metrics(reporterMetrics) | ||
.build(StackdriverEncoder.V2); | ||
|
||
CheckResult checkResult = asyncReporter.check(); | ||
if (!checkResult.ok()) { | ||
LOGGER.warn( | ||
"Error when performing Stackdriver AsyncReporter health check.", checkResult.error()); | ||
} | ||
|
||
return asyncReporter; | ||
} | ||
|
||
@Bean(SENDER_BEAN_NAME) | ||
@ConditionalOnMissingBean(name = SENDER_BEAN_NAME) | ||
public Sender stackdriverSender( | ||
public StackdriverSender stackdriverSender( | ||
GcpTraceProperties traceProperties, | ||
@Qualifier("traceExecutorProvider") ExecutorProvider executorProvider, | ||
@Qualifier("stackdriverSenderChannel") ManagedChannel channel) | ||
|
@@ -253,11 +231,10 @@ public BaggagePropagation.FactoryBuilder baggagePropagationFactoryBuilder() { | |
return BaggagePropagation.newFactoryBuilder(StackdriverTracePropagation.newFactory(primary)); | ||
} | ||
|
||
// Add this bean to suppress other encoding schema, e.g., JSON. | ||
@Bean | ||
@ConditionalOnMissingBean | ||
public BytesEncoder<Span> spanBytesEncoder() { | ||
return SpanBytesEncoder.PROTO3; | ||
@Bean(ENCODER_BEAN_NAME) | ||
@ConditionalOnMissingBean(name = ENCODER_BEAN_NAME) | ||
public BytesEncoder<MutableSpan> spanBytesEncoder() { | ||
return new StackdriverV2Encoder(Tags.ERROR); | ||
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. When running
The AttributesExtractor logic: if (braveSpan.localServiceName() != null && braveSpan.kind() == Span.Kind.SERVER) {
// Create an IP without querying DNS
InetAddress ip = InetAddresses.forString(braveSpan.localIp()); // Note: localIp() is null at this point.
Perhaps of note... traveling up the stacktrace @ |
||
} | ||
|
||
@PreDestroy | ||
|
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.