用途:配置 OpenTelemetry Collector,通过 Sentry Exporter 把 traces 和 logs 发送到 Sentry,并支持多项目路由与自动创建项目。
主要能力:检查已有 Collector 配置;检查或安装 otelcol-contrib(要求 v0.145.0 或更高);配置 Sentry 项目自动创建;编写 Collector 配置;添加环境变量占位符;运行 Collector;验证设置;通过 OTLPIntegration 启用 trace connectedness(Python/Ruby/Node.js)。
使用方式:按清单逐步执行。先查找含 receivers: 的 YAML 及 otel-collector-config.、collector-config.、otelcol.* 文件,询问用户是修改现有配置还是新建。用 which otelcol-contrib 或 ./otelcol-contrib 检查版本,低于 0.145.0 或未安装时选择二进制或 Docker 安装。二进制安装示例:curl -LO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v<numeric_version>/otelcol-contrib_<numeric_version><os><arch>.tar.gz,随后 tar -xzf 并 chmod +x。Docker 安装:docker pull otel/opentelemetry-collector-contrib:<numeric_version>。配置模板取自 Sentry Exporter 文档的 example-config.yaml,凭据使用 ${env:SENTRY_ORG_SLUG}、${env:SENTRY_AUTH_TOKEN} 占位。验证: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>"。
适用场景:需要把 OTel 遥测接入 Sentry,并希望自动创建项目或关联 trace 与 Sentry 错误、日志、cron、指标。
限制:自动创建项目需至少一个团队,新项目归入首个团队,创建期间初始数据可能被丢弃;OTLPIntegration 目前仅支持 Python、Ruby、Node.js;使用 otlpIntegration 时不要设置 tracesSampleRate;Docker 卷挂载需绝对路径。缺失信息暂未提供。