我们正在尝试在我们的项目中使用Zipkin实现Spring cloud sleuth,并想知道Spring cloud sleuth是否将支持Spring数据JPA的数据库调用。
我想跟踪数据库调用所花费的时间,就像服务调用一样
当我使用RestTemplate进行服务呼叫时,该呼叫被发送到zipkin,并且能够在仪表板上看到它
但是DB与Spring数据jpa的交互未在Zipkin中显示
是否可以向 Elastic APM 提供 Spring Cloud Sleuth(针对 Webflux 项目)的 Tracers 和 Spans?
我已经在 Spring Webflux 的上下文中看到了对该问题的讨论。这里是 Spring Cloud Sleuth 的背景。
spring elasticsearch project-reactor spring-cloud-sleuth elastic-apm
我只是在迈出第一步,spring-cloud-sleuth它适用于各种 http 调用。
现在我也在尝试覆盖消息传递部分。我看到它spring-cloud-sleuth与spring-integration开箱即用的集成。我目前只使用spring-amqp. 有没有办法让这个工作。有没有人有一些见解甚至代码示例?
有没有办法在OpenTracing中使用Spring Cloud Sleuth?我想将Spring客户与Jaeger连接
即使Zipkin运行正常,Sleuth也不会将跟踪信息发送到Zipkin。我正在使用Spring 1.5.8.RELEASE,Spring Cloud Dalston.SR4,并且在我的微服务中添加了以下依赖项:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我的日志总是错误的:[FOOMS,2e740f33c26e286d,2e740f33c26e286d,false]
我的Zipkin依赖项是:
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<scope>runtime</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
为什么我在懒惰的陈述中变得虚假而不是真实?虽然为所有调用正确生成了traceId和SpanId。我的Zipkin在端口9411中运行
我们正在建立微服务框架。
我们使用以下堆栈进行分布式跟踪。
以下是配置的完成方式
在gradle.build(或 pom.xml)下面添加了启动依赖项
compile 'org.springframework.cloud:spring-cloud-starter-sleuth'
compile 'org.springframework.cloud:spring-cloud-sleuth-zipkin'
compile 'org.springframework.cloud:spring-cloud-starter-bus-kafka'
Run Code Online (Sandbox Code Playgroud)
添加一个 AlwaysSampler bean
@Bean
public Sampler defaultSampler() {
return Sampler.ALWAYS_SAMPLE;
}
Run Code Online (Sandbox Code Playgroud)
如果我们kafka运行,事情会自动运行。
但是如果 kafka 没有运行,服务器不会启动 - 这主要是开发环境的情况。
如果我想停止这个,我必须注释掉这里提到的所有代码(因为我们在spring boot中使用starter依赖,它会按照我的理解自动配置)。
我们可以只对属性(或 yaml)文件进行一些更改,这样我就不需要去注释掉所有这些代码了吗?
或者可能是另一种禁用此功能而不做一些评论等的方法。
zipkin spring-boot microservices spring-cloud-sleuth distributed-tracing
我有一个现有的 Spring boot (2.2.0) 应用程序,并尝试集成 Spring cloud sleuth 以获取自动跟踪和跨度 ID。logback文件如下-
<configuration>
<property name="LOGS" value="./logs" />
<appender name="Console"
class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
</Pattern>
</layout>
</appender>
<appender name="RollingFile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOGS}/spring-boot-logger.log</file>
<encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
</encoder>
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily and when the file reaches 100 MegaBytes -->
<fileNamePattern>${LOGS}/archived/spring-boot-logger-%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
<!-- LOG everything at specified level level -->
<root level="info">
<appender-ref ref="RollingFile" />
<appender-ref ref="Console" />
</root>
Run Code Online (Sandbox Code Playgroud)
这个 …
关于 Zipkin 与 Prometheus 集成的可能性的小问题。
目前,我们已经有一个完全可用的 Zipkin 实例及其 Web UI。Zipkin 超级酷,一切都很好。
我们能够让所有微服务向 Zipkin 发送跟踪,并让 Zipkin 聚合它们。
我们还可以在UI等中搜索痕迹,超级酷。
另一方面,我们还有一个经过非常成熟的实战测试的 Prometheus Grafana,其中容器级别指标、应用程序级别指标和许多其他观察结果都已经存在于其中。
因此,目前我们必须在两个地方进行生产。我们的一切都集中在一个地方 Prometheus,还有这个超酷的 Zipkin。
我想知道,是否可以将 Prometheus 作为后端,或者使用某种 Prometheus 消耗 Zipkin 数据来在 Grafana 中显示,这样我们真的可以将所有内容集中在一个地方吗?
谢谢
我正在使用 Sleuth 和 Zipkin 进行分布式跟踪并遇到问题。
问题:使用 3.0.0 版本的 Spring Boot,TraceID 和 SpanID 不会打印在微服务日志中(并传递给 Zipkin)。
以下是我正在使用的版本:
应用程序属性:
spring.application.name=sleuthpoc2
spring.zipkin.base-url=http://localhost:9411/
spring.sleuth.sampler.probability=1.0
spring.zipkin.sender.type=WEB
Run Code Online (Sandbox Code Playgroud) 首先我对这门课有一个小问题 brave.sampler.Sampler
无法导入此类,仅在添加此依赖项时导入
<dependency>
<groupId>io.zipkin.brave</groupId>
<artifactId>brave</artifactId>
<version>4.0.5</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我的大问题是,当我尝试使用 zipkin 进行干扰跟踪时,我添加了所需的依赖项,但每当我启动应用程序时,它都会在启动时出现异常。
这是堆栈跟踪。
java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.sleuth.zipkin2.sender.ZipkinRabbitSenderConfiguration] from ClassLoader [sun.misc.Launcher$AppClassLoader@764c12b6]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:659) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:556) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:541) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:599) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:718) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:659) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:627) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1489) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:419) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:389) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:510) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:502) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1198) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
at org.springframework.boot.SpringApplication.getExitCodeFromMappedException(SpringApplication.java:892) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.getExitCodeFromException(SpringApplication.java:878) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:864) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:813) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:341) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) …Run Code Online (Sandbox Code Playgroud) spring-boot ×6
spring ×5
zipkin ×5
java ×2
opentracing ×2
spring-cloud ×2
cloud ×1
elastic-apm ×1
logback ×1
prometheus ×1
spring-amqp ×1