5

application.ymlMySQL を使用してトレース データを永続化するために、Spring Boot/Cloud Zipkin サーバー (潜在的に Zipkin Stream サーバー) に必要な正確な依存関係と構成はどれですか?

4

1 に答える 1

8

公式ドキュメントは役に立ちましたが、すべての依存関係が明示的に含まれていなかったと思います (少なくとも現時点では)。必要なすべての依存関係と構成をまとめるために、サンプルについて追加の調査を行う必要がありました。誰かの参考になればいいなと思ったのでシェアしたいと思います。

スプリング ブート バージョン: 1.4.0.RELEASE

スプリング クラウドのバージョン: Brixton.SR4

POM:

    ...
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>io.zipkin.java</groupId>
        <artifactId>zipkin-server</artifactId>
    </dependency>
    <dependency>
        <groupId>io.zipkin.java</groupId>
        <artifactId>zipkin-autoconfigure-storage-mysql</artifactId>
    </dependency>

    <dependency>
        <groupId>io.zipkin.java</groupId>
        <artifactId>zipkin-autoconfigure-ui</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
   ...
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Brixton.SR4</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

ジャワ:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import zipkin.server.EnableZipkinServer;

@SpringBootApplication
@EnableZipkinServer
public class ZipkinServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ZipkinServerApplication.class, args);
    }
}

アプリケーション.yml:

spring:
  datasource:
    schema: classpath:/mysql.sql
    url: jdbc:mysql://localhost:3306/zipkin?autoReconnect=true
    username: root
    password: admin
    driver-class-name: com.mysql.jdbc.Driver
    initialize: true
    continue-on-error: true
  sleuth:
    enabled: false
zipkin:
  storage:
    type: mysql

参考文献:

https://cloud.spring.io/spring-cloud-sleuth/

于 2016-08-26T21:02:27.543 に答える