Docker 部署
先决条件
- Docker
- Docker Compose v2.0.0+
- Make (可选)
- 6 GB 内存用于应用程序
- 14 GB 磁盘空间
获取并运行演示
克隆演示存储库
git clone https://github.com/open-telemetry/opentelemetry-demo.git切换到演示文件夹
cd opentelemetry-demo/启动演示1
make startdocker compose up --force-recreate --remove-orphans --detach(可选) 启用 API 可观测性驱动的测试1
make run-tracetestingdocker compose -f docker-compose-tests.yml run traceBasedTests
验证网店和遥测
构建完镜像并启动容器后,您可以通过以下方式访问:
- 网店: https://:8080/
- Grafana: https://:8080/grafana/
- Load Generator UI: https://:8080/loadgen/
- Jaeger UI: https://:8080/jaeger/ui/
- Tracetest UI: https://:11633/,仅在使用
make run-tracetesting时可用 - Flagd configurator UI: https://:8080/feature
更改演示的主要端口号
默认情况下,演示应用程序将启动一个代理,处理所有绑定到 8080 端口的浏览器流量。要更改端口号,请在启动演示之前设置 ENVOY_PORT 环境变量。
例如,要使用 8081 端口1
ENVOY_PORT=8081 make startENVOY_PORT=8081 docker compose up --force-recreate --remove-orphans --detach
自带后端
您很可能想将网店作为演示应用程序,用于您已有的可观测性后端(例如,现有的 Jaeger、Zipkin 实例,或者您选择的供应商之一)。
OpenTelemetry Collector 可用于将遥测数据导出到多个后端。默认情况下,演示应用程序中的 Collector 将合并两个文件的配置
otelcol-config.ymlotelcol-config-extras.yml
要添加您的后端,请使用编辑器打开文件 src/otel-collector/otelcol-config-extras.yml。
首先添加一个新的 exporter。例如,如果您的后端支持 OTLP over HTTP,请添加以下内容:
exporters: otlphttp/example: endpoint: <your-endpoint-url>然后,为您想用于后端的遥测管道重写
exporters。service: pipelines: traces: exporters: [spanmetrics, otlphttp/example]
在与 Collector 合并 YAML 值时,对象会被合并,而数组会被替换。如果重写了 traces 管道的 exporter 数组,则必须包含 spanmetrics exporter。不包含此 exporter 将导致错误。
供应商后端可能要求您添加额外的身份验证参数,请查阅其文档。某些后端需要不同的 exporter,您可以在 opentelemetry-collector-contrib/exporter 中找到它们及其文档。
更新 otelcol-config-extras.yml 后,运行 make start 来启动演示。过一会儿,您应该也能看到 traces 流入您的后端。
docker-compose已弃用。有关详细信息,请参阅 迁移到 Compose V2。 ↩︎ ↩︎ ↩︎