Switch to using the published jar for zipkin server

Fixes gh-74
This commit is contained in:
Dave Syer
2018-04-23 09:39:29 +01:00
parent c3b2620ea8
commit 6176e80294
10 changed files with 3 additions and 227 deletions

View File

@@ -18,7 +18,7 @@
</parent>
<properties>
<thin-jar.version>1.0.7.RELEASE</thin-jar.version>
<thin-jar.version>1.0.10.RELEASE</thin-jar.version>
</properties>
<modules>
@@ -32,7 +32,6 @@
<module>spring-cloud-launcher-hystrixdashboard</module>
<module>spring-cloud-launcher-kafka</module>
<module>spring-cloud-launcher-stubrunner</module>
<module>spring-cloud-launcher-zipkin</module>
</modules>
<dependencies>

View File

@@ -18,7 +18,7 @@
<properties>
<spring-cloud-deployer.version>1.2.2.RELEASE</spring-cloud-deployer.version>
<spring-cloud-deployer-thin.version>1.0.7.RELEASE</spring-cloud-deployer-thin.version>
<spring-cloud-deployer-thin.version>1.0.10.RELEASE</spring-cloud-deployer-thin.version>
</properties>
<dependencyManagement>

View File

@@ -90,7 +90,7 @@ spring:
application-properties:
management.security.enabled: false
zipkin:
coordinates: ${dt.pre}zipkin:${dt.ver}
coordinates: io.zipkin.java:zipkin-server:jar:exec:2.7.1
port: 9411
order: 0
properties:

View File

@@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.cloud.launcher</groupId>
<artifactId>spring-cloud-launcher-zipkin</artifactId>
<packaging>jar</packaging>
<name>spring-cloud-launcher-zipkin</name>
<description>Spring Cloud Launcher ConfigServer</description>
<properties>
<java.version>1.8</java.version>
</properties>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-launcher</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,93 +0,0 @@
/*
* Copyright 2013-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.launcher.zipkin;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.type.AnnotatedTypeMetadata;
import zipkin.collector.CollectorMetrics;
import zipkin.collector.CollectorSampler;
import zipkin.internal.V2StorageComponent;
import zipkin.server.EnableZipkinServer;
import zipkin.storage.StorageComponent;
import zipkin2.storage.InMemoryStorage;
/**
* @author Spencer Gibb
*/
@EnableZipkinServer
@EnableDiscoveryClient
@SpringBootApplication
public class ZipkinServerApplication {
@Bean
@ConditionalOnMissingBean({CollectorSampler.class})
CollectorSampler traceIdSampler(@Value("${zipkin.collector.sample-rate:1.0}") float rate) {
return CollectorSampler.create(rate);
}
@Bean
CollectorMetrics metrics() {
return CollectorMetrics.NOOP_METRICS;
}
static final class StorageTypeMemAbsentOrEmpty implements Condition {
StorageTypeMemAbsentOrEmpty() {
}
public boolean matches(ConditionContext condition, AnnotatedTypeMetadata ignored) {
String storageType = condition.getEnvironment().getProperty("zipkin.storage.type");
if (storageType == null) {
return true;
} else {
storageType = storageType.trim();
return storageType.isEmpty() ? true : storageType.equals("mem");
}
}
}
@Configuration
@Conditional({ZipkinServerApplication.StorageTypeMemAbsentOrEmpty.class})
@ConditionalOnMissingBean({StorageComponent.class})
static class InMemoryConfiguration {
InMemoryConfiguration() {
}
@Bean
StorageComponent storage(@Value("${zipkin.storage.strict-trace-id:true}") boolean strictTraceId, @Value("${zipkin.storage.mem.max-spans:500000}") int maxSpans) {
return V2StorageComponent.create(InMemoryStorage.newBuilder().strictTraceId(strictTraceId).maxSpanCount(maxSpans).build());
}
@Bean
InMemoryStorage v2Storage(V2StorageComponent component) {
return (InMemoryStorage)component.delegate();
}
}
public static void main(String[] args) {
SpringApplication.run(ZipkinServerApplication.class, args);
}
}

View File

@@ -1,2 +0,0 @@
exclusions.spring-cloud-starter-bus-kafka: org.springframework.cloud:spring-cloud-starter-bus-kafka
dependencies.spring-cloud-starter-bus-amqp: org.springframework.cloud:spring-cloud-starter-bus-amqp

View File

@@ -1,11 +0,0 @@
spring:
application:
name: zipkin
server:
port: 9411
info:
artifactId: "@project.artifactId@"
description: "@project.description@"
version: "@project.version@"

View File

@@ -1,29 +0,0 @@
info:
description: Spring Cloud Launcher
eureka:
client:
instance-info-replication-interval-seconds: 5
initial-instance-info-replication-interval-seconds: 5
serviceUrl:
defaultZone: http://localhost:8761/eureka/
endpoints:
restart: enabled
ribbon:
ConnectTimeout: 3000
ReadTimeout: 60000
h2.datasource.url: jdbc:h2:tcp://localhost:9096/~/launcher
#spring:
# datasource:
# url: ${h2.datasource.url}
logging:
level:
kafka: WARN
org.apache.zookeeper: WARN
org.apache.zookeeper.ClientCnxn: ERROR
org.apache.kafka: WARN
org.I0Itec: WARN

View File

@@ -1,19 +0,0 @@
package org.springframework.cloud.launcher.zipkin;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest({ "spring.cloud.bus.enabled=false", "eureka.client.enabled=false" })
public class DeployerApplicationTests {
@Test
@Ignore
public void contextLoads() {
}
}