elastic / elastic/apm-agent-python
Add instrumentation and distributed tracing for RabbitMQ (pika)
- 主要言語
- Python
- スター
- 431
- フォーク
- 239
- 平均マージ
- 5日 10時間
- マージ済み PR(30日)
- 7
説明
**Context**
One common way to integrate services is using RabbitMQ as a message broker. Currently, the Elastic APM agent only supports distributed tracing for HTTP calls. It would be of high value to add instrumentation and distributed tracing for message brokers and, in particular, [RabbitMQ](
https://www.rabbitmq.com/) - one of the most deployed open source message brokers. Not having this integration could be a show-stopper for users of competitor solutions ([New Relic already sports this integration](https://docs.newrelic.com/docs/agents/python-agent/getting-started/instrumented-python-packages#message-broker-clients)) when considering migrating to Elastic APM.
**Solution**
The ideal solution would be to instrument message publishing and include tracing data in message headers, interpreting those headers when consuming messages to continue the tracing.
To support the maximum number of projects using RabbitMQ, I would recommend to start by adding support for [Pika](https://pypi.org/project/pika/) - a widely-used AMQP client library having support for both Python 2.7 and +3.4.
**Alternatives**
A flexible alternative to a library-specific integration could be to provide APIs to create and interpret a distributed tracing payload for use in custom instrumentation of any type of communication between services. New Relic, for example, does offer these APIs in [`create_distributed_trace_payload()`](https://docs.newrelic.com/docs/agents/python-agent/python-agent-api/createdistributedtracepayload-python-agent-api) and [`accept_distributed_trace_payload()`](https://docs.newrelic.com/docs/agents/python-agent/python-agent-api/acceptdistributedtracepayload-python-agent-api)
I'm willing to contribute with code if this is of general interest.
/ Hampus
コントリビューションガイド
調査の方向性
ファイル、テスト、エントリポイントは指定されていません。まず、agent に既存の HTTP distributed-tracing サポートと、Pika の publishing および consuming のパスを確認し、そのうえで、この作業を Pika 固有にするべきか、汎用的な payload APIs を提供するべきかを判断してください。公開されたメッセージのヘッダーに trace context が追加され、メッセージの consuming 時に引き継がれれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python, rabbitmq
- 領域
- backend, distributed-systems
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100