observability-edot-python-migrate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEDOT Python Migration
EDOT Python迁移
Read the migration guide before making changes:
在进行更改前,请先阅读迁移指南:
Guidelines
操作准则
- Remove ALL classic APM references: from requirements,
elastic-apm/ElasticAPM(app)from application code,elasticapm.contrib.*blocks, and allapp.config['ELASTIC_APM']env varsELASTIC_APM_* - Install via pip (add to
elastic-opentelemetryor equivalent)requirements.txt - Run during image build to install auto-instrumentation packages for detected libraries
edot-bootstrap --action=install - Wrap the application entrypoint with — e.g.
opentelemetry-instrument. Without this, no telemetry is collectedopentelemetry-instrument gunicorn app:app - Set exactly three required environment variables:
- (replaces
OTEL_SERVICE_NAME)ELASTIC_APM_SERVICE_NAME - — must be the managed OTLP endpoint or EDOT Collector URL. Do NOT reuse the old
OTEL_EXPORTER_OTLP_ENDPOINTvalue. Never use an APM Server URL (noELASTIC_APM_SERVER_URL, noapm-server, no:8200)/intake/v2/events - —
OTEL_EXPORTER_OTLP_HEADERSor"Authorization=ApiKey <key>"(replaces"Authorization=Bearer <token>")ELASTIC_APM_SECRET_TOKEN
- Do NOT set ,
OTEL_TRACES_EXPORTER, orOTEL_METRICS_EXPORTER— the defaults are already correctOTEL_LOGS_EXPORTER - Never run both classic and EDOT on the same application
elastic-apm
- 移除所有经典APM相关引用:从requirements中移除,从应用代码中移除
elastic-apm/ElasticAPM(app),删除elasticapm.contrib.*配置块,以及所有app.config['ELASTIC_APM']环境变量ELASTIC_APM_* - 通过pip安装(添加至
elastic-opentelemetry或等效文件中)requirements.txt - 在镜像构建期间运行,为检测到的库安装自动插装包
edot-bootstrap --action=install - 使用包裹应用入口点 —— 例如
opentelemetry-instrument。如果不执行此步骤,将不会收集任何遥测数据opentelemetry-instrument gunicorn app:app - 准确设置三个必填环境变量:
- (替代
OTEL_SERVICE_NAME)ELASTIC_APM_SERVICE_NAME - —— 必须是托管式OTLP端点或EDOT Collector的URL。请勿复用旧的
OTEL_EXPORTER_OTLP_ENDPOINT值。绝对不要使用APM Server URL(不包含ELASTIC_APM_SERVER_URL、apm-server或:8200)/intake/v2/events - ——
OTEL_EXPORTER_OTLP_HEADERS或"Authorization=ApiKey <key>"(替代"Authorization=Bearer <token>")ELASTIC_APM_SECRET_TOKEN
- 请勿设置、
OTEL_TRACES_EXPORTER或OTEL_METRICS_EXPORTER—— 默认值已为正确配置OTEL_LOGS_EXPORTER - 切勿在同一应用中同时运行经典的和EDOT
elastic-apm
Examples
示例
See the EDOT Python migration guide
for complete examples.
完整示例请查看EDOT Python迁移指南