Skip to content

Commit

Permalink
initial effort to mount storage service on zipkin-server
Browse files Browse the repository at this point in the history
  • Loading branch information
jeqo committed Oct 22, 2019
1 parent a8c0e8e commit 1e12af0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
1 change: 0 additions & 1 deletion module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
<dependency>
<groupId>${armeria.groupId}</groupId>
<artifactId>armeria</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,29 @@
*/
package zipkin2.module.storage.kafka;

import com.linecorp.armeria.server.ServerBuilder;
import java.util.function.Consumer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import zipkin2.storage.StorageComponent;
import zipkin2.storage.kafka.KafkaStorage;
import zipkin2.storage.kafka.KafkaStorageHttpService;

@Configuration
@EnableConfigurationProperties(ZipkinKafkaStorageProperties.class)
@ConditionalOnProperty(name = "zipkin.storage.type", havingValue = "kafka")
@ConditionalOnMissingBean(StorageComponent.class)
class ZipkinKafkaStorageModule {

@Bean
@ConditionalOnMissingBean
StorageComponent storage(ZipkinKafkaStorageProperties properties) {
@Bean StorageComponent storage(ZipkinKafkaStorageProperties properties) {
return properties.toBuilder().build();
}

@Bean public Consumer<ServerBuilder> storageHttpService(StorageComponent storage) {
return new KafkaStorageHttpService((KafkaStorage) storage);
}
}
1 change: 1 addition & 0 deletions storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<properties>
<main.basedir>${project.basedir}/..</main.basedir>
<kafka.version>2.3.0</kafka.version>
<spring.version>5.1.9.RELEASE</spring.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
/**
* Span store backed by Kafka Stream distributed state stores built by {@link
* TraceStoreTopologySupplier} and {@link DependencyStoreTopologySupplier}, and made accessible by
* {@link KafkaStoreHttpService}.
* {@link KafkaStorageHttpService}.
*/
final class KafkaSpanStore implements SpanStore, Traces, ServiceAndSpanNames {
static final ObjectMapper MAPPER = new ObjectMapper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ Server getServer() {
try {
server = Server.builder()
.http(httpPort)
.annotatedService(new KafkaStoreHttpService(this))
.annotatedService(new KafkaStorageHttpService(this))
.build();
server.start();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@
* distributed state. This component exposes access to local state via Http call from {@link
* KafkaSpanStore}
*/
final class KafkaStoreHttpService implements Consumer<ServerBuilder> {
public final class KafkaStorageHttpService implements Consumer<ServerBuilder> {
static final Logger LOG = LogManager.getLogger();
static final ObjectMapper MAPPER = new ObjectMapper();

final KafkaStorage storage;
final long minTracesStored;

KafkaStoreHttpService(KafkaStorage storage) {
public KafkaStorageHttpService(KafkaStorage storage) {
this.storage = storage;
this.minTracesStored = storage.minTracesStored;
}

@Override public void accept(ServerBuilder serverBuilder) {
serverBuilder.annotatedService("/zipkin/storage/kafka", this);
@Override public void accept(ServerBuilder builder) {
builder.annotatedService("/storage/kafka", this);
}

@Get("/dependencies")
Expand Down

0 comments on commit 1e12af0

Please sign in to comment.