用途:配置 OpenTelemetry Collector,通过 Sentry Exporter 将 traces 和 logs 发送到 Sentry,并支持多项目路由与自动创建项目。
主要能力:检查现有 Collector 配置与版本;安装 otelcol-contrib(要求 v0.145.0 或更高,支持二进制或 Docker);配置 Sentry 项目自动创建(auto_create_projects: true,按 service.name 创建,需至少一个团队,新项目归入首个团队,创建期间数据可能被丢弃);编写 Collector 配置并加入 sentry exporter 与 pipelines;使用环境变量占位符 ${env:SENTRY_ORG_SLUG}、${env:SENTRY_AUTH_TOKEN};校验并运行 Collector;验证 traces/logs 是否在 60 秒内出现在 Sentry;为 Python、Ruby、Node.js 启用 OTLPIntegration 实现 trace connectedness。
使用方式:按清单执行——检查现有配置、检查版本、配置项目创建、写配置、加环境变量占位符、运行、验证、启用 OTLPIntegration。二进制安装示例:curl -LO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v<numeric_version>/otelcol-contrib_<numeric_version><os><arch>.tar.gz;Docker 拉取:docker pull otel/opentelemetry-collector-contrib:<numeric_version>。校验:set -a && source "<env_file>" && set +a && "<collector_path>" validate --config "<config_file>"。运行:set -a && source "<env_file>" && set +a && "<collector_path>" --config "<config_file>"。Docker 运行需映射 4317、4318、13133 端口并挂载配置。
适用场景:需要将 OTel 遥测接入 Sentry、按服务自动建项目、或打通 OTel traces 与 Sentry 错误/日志/定时任务/指标的场景。
限制:Sentry Exporter 需 otelcol-contrib v0.145.0 及以上;自动创建项目需 Project:Write 权限且组织内至少有一个团队;OTLPIntegration 目前仅支持 Python、Ruby、Node.js;使用 otlpIntegration 时不要设置 tracesSampleRate;Docker 卷挂载需绝对路径;凭据需用户自行填写,工具只添加占位符。