Skip to content

Commit

Permalink
feat: reconfigure ZipkinAutoConfiguration (#1728)
Browse files Browse the repository at this point in the history
* feat: reconfigure ZipkinAutoConfiguration

* configure zipkin after stackdriver
  • Loading branch information
JoeWang1127 authored Apr 14, 2023
1 parent d0c4589 commit 2fe61c4
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.actuate.autoconfigure.tracing.BraveAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand Down Expand Up @@ -68,7 +69,7 @@
value = {"spring.cloud.gcp.trace.enabled"},
matchIfMissing = true)
@ConditionalOnClass(StackdriverSender.class)
@AutoConfigureBefore(BraveAutoConfiguration.class)
@AutoConfigureBefore({BraveAutoConfiguration.class, ZipkinAutoConfiguration.class})
public class StackdriverTraceAutoConfiguration {

private static final Log LOGGER = LogFactory.getLog(StackdriverTraceAutoConfiguration.class);
Expand Down Expand Up @@ -168,7 +169,7 @@ public ManagedChannel stackdriverSenderChannel() {

@Bean(REPORTER_BEAN_NAME)
@ConditionalOnMissingBean(name = REPORTER_BEAN_NAME)
public Reporter<Span> stackdriverReporter(
public AsyncReporter<Span> stackdriverReporter(
ReporterMetrics reporterMetrics,
GcpTraceProperties trace,
@Qualifier(SENDER_BEAN_NAME) Sender sender) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ com.google.cloud.spring.autoconfigure.secretmanager.SecretManagerConfigDataLocat
# ConfigData Loaders
org.springframework.boot.context.config.ConfigDataLoader=\
com.google.cloud.spring.autoconfigure.secretmanager.SecretManagerConfigDataLoader

org.springframework.boot.autoconfigure.AutoConfigurationImportFilter=\
com.google.cloud.spring.autoconfigure.trace.TraceAutoConfigurationFilter
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.google.cloud.spring.autoconfigure.trace;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.awaitility.Awaitility.await;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
Expand Down Expand Up @@ -52,9 +51,7 @@
import org.apache.commons.lang3.reflect.FieldUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.actuate.autoconfigure.tracing.BraveAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
Expand Down Expand Up @@ -83,8 +80,7 @@ void init() {
StackdriverTraceAutoConfiguration.class,
GcpContextAutoConfiguration.class,
BraveAutoConfiguration.class,
RefreshAutoConfiguration.class,
TraceAutoConfigurationFilter.class))
RefreshAutoConfiguration.class))
.withUserConfiguration(MockConfiguration.class)
.withPropertyValues(
"spring.cloud.gcp.project-id=proj");
Expand All @@ -107,16 +103,6 @@ void test() {
});
}

@Test
void testDisableZipkinAutoConfiguration() {
this.contextRunner
.run(
context ->
assertThatThrownBy(() -> context.getBean(ZipkinAutoConfiguration.class))
.isExactlyInstanceOf(NoSuchBeanDefinitionException.class)
.hasMessageContaining("ZipkinAutoConfiguration"));
}

@Test
void testEncodingSchema() {
this.contextRunner
Expand Down

This file was deleted.

0 comments on commit 2fe61c4

Please sign in to comment.