示例架构

OpenTelemetry 演示由使用不同编程语言编写的微服务组成,它们通过 gRPC 和 HTTP 相互通信;还有一个使用 Locust 模拟用户流量的负载生成器。

graph TD
subgraph 服务图示
accountingservice(会计服务):::golang
adservice(广告服务):::java
cache[(缓存<br/>&#40redis&#41)]
cartservice(购物车服务):::dotnet
checkoutservice(结账服务):::golang
currencyservice(货币服务):::cpp
emailservice(邮件服务):::ruby
frauddetectionservice(欺诈检测服务):::kotlin
frontend(前端):::typescript
frontendproxy(前端代理 <br/>&#40Envoy&#41):::cpp
loadgenerator([负载生成器]):::python
paymentservice(支付服务):::javascript
productcatalogservice(产品目录服务):::golang
quoteservice(报价服务):::php
recommendationservice(推荐服务):::python
shippingservice(配送服务):::rust
featureflagservice(功能标记服务):::erlang
featureflagstore[(功能标记存储<br/>&#40PostgreSQL DB&#41)]
queue[(队列<br/>&#40Kafka&#41)]

Internet -->|HTTP| frontendproxy
frontendproxy -->|HTTP| frontend
frontendproxy -->|HTTP| featureflagservice
loadgenerator -->|HTTP| frontendproxy

accountingservice -->|TCP| queue

cartservice --->|gRPC| featureflagservice

checkoutservice --->|gRPC| cartservice --> cache
checkoutservice --->|gRPC| productcatalogservice
checkoutservice --->|gRPC| currencyservice
checkoutservice --->|HTTP| emailservice
checkoutservice --->|gRPC| paymentservice
checkoutservice -->|gRPC| shippingservice
checkoutservice --->|TCP| queue

frontend -->|gRPC| adservice
frontend -->|gRPC| cartservice
frontend -->|gRPC| productcatalogservice
frontend -->|gRPC| checkoutservice
frontend -->|gRPC| currencyservice
frontend -->|gRPC| recommendationservice -->|gRPC| productcatalogservice
frontend -->|gRPC| shippingservice -->|HTTP| quoteservice

frauddetectionservice -->|TCP| queue

adservice --->|gRPC| featureflagservice

productcatalogservice -->|gRPC| featureflagservice

recommendationservice -->|gRPC| featureflagservice

shippingservice -->|gRPC| featureflagservice

featureflagservice --> featureflagstore

end

classDef dotnet fill:#178600,color:white;
classDef cpp fill:#f34b7d,color:white;
classDef erlang fill:#b83998,color:white;
classDef golang fill:#00add8,color:black;
classDef java fill:#b07219,color:white;
classDef javascript fill:#f1e05a,color:black;
classDef kotlin fill:#560ba1,color:white;
classDef php fill:#4f5d95,color:white;
classDef python fill:#3572A5,color:white;
classDef ruby fill:#701516,color:white;
classDef rust fill:#dea584,color:black;
classDef typescript fill:#e98516,color:black;
graph TD
subgraph 服务图例
  dotnetsvc(.NET):::dotnet
  cppsvc(C++):::cpp
  erlangsvc(Erlang/Elixir):::erlang
  golangsvc(Go):::golang
  javasvc(Java):::java
  javascriptsvc(JavaScript):::javascript
  kotlinsvc(Kotlin):::kotlin
  phpsvc(PHP):::php
  pythonsvc(Python):::python
  rubysvc(Ruby):::ruby
  rustsvc(Rust):::rust
  typescriptsvc(TypeScript):::typescript
end

classDef dotnet fill:#178600,color:white;
classDef cpp fill:#f34b7d,color:white;
classDef erlang fill:#b83998,color:white;
classDef golang fill:#00add8,color:black;
classDef java fill:#b07219,color:white;
classDef javascript fill:#f1e05a,color:black;
classDef kotlin fill:#560ba1,color:white;
classDef php fill:#4f5d95,color:white;
classDef python fill:#3572A5,color:white;
classDef ruby fill:#701516,color:white;
classDef rust fill:#dea584,color:black;
classDef typescript fill:#e98516,color:black;

点击以下链接查看演示应用的当前状态的指标追踪数据捕获情况。

配置收集器的方式请参考otelcol-config.yml,可以在此处配置其他导出器。

graph TB
subgraph 遥测数据流
    subgraph 填充子图 [ ]
        style 填充子图 fill:none,stroke:none;
        %% padding to stop the titles clashing
        subgraph od[OpenTelemetry 演示]
        ms(微服务)
        end

        ms -.->|"OTLP<br/>gRPC"| oc-grpc
        ms -.->|"OTLP<br/>HTTP POST"| oc-http

        subgraph oc[OTel Collector]
            style oc fill:#97aef3,color:black;
            oc-grpc[/"OTLP 接收器<br/>监听在<br/>grpc://localhost:4317/"/]
            oc-http[/"OTLP 接收器<br/>监听在<br/>http://localhost:4318/<br/>https://localhost:4318/"/]
            oc-proc(处理器)
            oc-prom[/"OTLP HTTP 导出器"/]
            oc-otlp[/"OTLP 导出器"/]

            oc-grpc --> oc-proc
            oc-http --> oc-proc

            oc-proc --> oc-prom
            oc-proc --> oc-otlp
        end

        oc-prom -->|"http://localhost:9090/api/v1/otlp"| pr-sc
        oc-otlp -->|gRPC| ja-col

        subgraph pr[Prometheus]
            style pr fill:#e75128,color:black;
            pr-sc[/"Prometheus OTLP 写入接收器"/]
            pr-tsdb(时序数据库)
            pr-http[/"Prometheus HTTP<br/>监听在<br/>http://localhost:9090"/]

            pr-sc --> pr-tsdb
            pr-tsdb --> pr-http
        end

        pr-b{{"浏览器<br/>Prometheus UI"}}
        pr-http ---->|"http://localhost:9090/graph"| pr-b

        subgraph ja[Jaeger]
            style ja fill:#60d0e4,color:black;
            ja-col[/"Jaeger 收集器<br/>监听在<br/>grpc://jaeger:4317/"/]
            ja-db(Jaeger 数据库)
            ja-http[/"Jaeger HTTP<br/>监听在<br/>http://localhost:16686"/]

            ja-col --> ja-db
            ja-db --> ja-http
        end

        subgraph gr[Grafana]
            style gr fill:#f8b91e,color:black;
            gr-srv[Grafana 服务器]
            gr-http[/"Grafana HTTP<br/>监听在<br/>http://localhost:3000"/]

            gr-srv --> gr-http
        end

        pr-http --> |"http://localhost:9090/api"| gr-srv
        ja-http --> |"http://localhost:16686/api"| gr-srv

        ja-b{{"浏览器<br/>Jaeger UI"}}
        ja-http ---->|"http://localhost:16686/search"| ja-b

        gr-b{{"浏览器<br/>Grafana UI"}}
        gr-http -->|"http://localhost:3000/dashboard"| gr-b
    end
end

/pb/ 目录中找到 Protocol Buffer 定义

最后修改 December 10, 2023: translate (a4350d6e)