searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

Grafana Tempo在Springboot应用下的实践

2024-05-20 09:57:33
12
0

在当今微服务架构和云原生应用盛行的时代,分布式跟踪系统的重要性日益凸显。Grafana Tempo作为一款开源、易于使用和大规模分布式跟踪后端,正逐渐崭露头角,成为开发者和运维团队的得力助手。

Grafana Tempo不仅与Jaeger、Zipkin等主流分布式跟踪系统无缝对接,还支持Kafka、OpenCensus和OpenTelemetry等多种数据格式。同时,Grafana Tempo实现了TraceQL查询语言,这是一种受到LogQL和PromQL启发、专为跟踪数据设计的查询语言。通过TraceQL,用户可以轻松构建精确而高效的查询,快速定位和分析分布式系统中的问题。

以下是一个典型的Grafana Tempo在Springboot应用下的部署实例:

1.采集

1.1 Maven导入依赖

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-spring-jaeger-cloud-starter</artifactId>
    <version>3.2.2</version>
</dependency>

1.2 配置文件配置jaeger相关参数

opentracing:
  jaeger:
    enabled: true
    const-sampler:
      decision: true
    http-sender:
      url: htt p://tempo:14268/api/traces

1.3 tempo组件接收配置

server:
  htt p_listen_port: 3200

distributor:
  receivers:                           
    jaeger:                            
      protocols:                      
        thrift_htt p:
          endpoint: 0.0.0.0:14268             
        grpc:
          endpoint: 0.0.0.0:14250                     
        thrift_binary:
          endpoint: 0.0.0.0:6832
        thrift_compact:
          endpoint: 0.0.0.0:6831

    otlp:
      protocols:
        grpc:
          endpoint: 0.0.0.0:4317 
        htt p:
          endpoint: 0.0.0.0:4318 

2.存储

tempo将接收到的数据存储至s3,tempo存储配置如下:

storage:
  trace:
    backend: s3
    s3:
      bucket: xxx
      endpoint: xxx
      access_key: xxx
      secret_key: xxx
      insecure: true

3.查询

3.1 Grafana数据源中集成了tempo数据源,直接配置即可查询:

htt p://tempo:3200

3.2 Tempo支持集成jaeger-query组件查询,部署tempo-query组件,配置如下:

backend: tempo:3200

直接通过如下路径访问:

htt p://tempo-query:16686
0条评论
0 / 1000