elastic / elastic/apm-agent-python
[Azure Python SDK] Implement tracing of Azure Python SDK using azure-core-tracing
- 主要言語
- Python
- スター
- 431
- フォーク
- 239
- 平均マージ
- 5日 10時間
- マージ済み PR(30日)
- 7
説明
**Is your feature request related to a problem? Please describe.**
Since whole Azure Python SDK is traced using azure-core-tracing abstract tracing, an ElasticAPM Span implementation could be generated so all Azure libraries would be traced in APM "for free"
This is already done with OpenTelemetry using this code:
```python
from azure.core.settings import settings
from azure.core.tracing.ext.opentelemetry_span import OpenTelemetrySpan
settings.tracing_implementation = OpenTelemetrySpan
```
An ElasticAPMSpan class that inherits from [`HttpSpanMixin`](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/azure/core/tracing/_abstract_span.py#L231) could be implemented. This could be based in current [`OpenTelemetrySpan`](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/ext/opentelemetry_span/__init__.py#L50)
I have seen that some Azure integrations are being done here: https://github.com/elastic/apm/issues/410. The enhancement I suggest would cover those integrations and many more, since the tracing is already implemented in the whole Azure Python SDK.
**Describe the solution you'd like**
I would like an Azure SDK tracing implementation that could allow me to do this:
```python
from azure.core.settings import settings
from elasticapm.contrib.serverless.azure import ElasticAPMSpan
settings.tracing_implementation = ElasticAPMSpan
```
So I could take advantage of the already traced Azure SDK code.
**Describe alternatives you've considered**
* I haved tried to set the [OpenTelemetry API Bridge](https://www.elastic.co/guide/en/apm/agent/python/6.x/opentelemetry-bridge.html) but it will not work in this case since OpenTelemetrySpan recovers the tracer from the global OpenTelemetry tracer which is not set in the bridge.
* Another option would be to use OpenTelemetry API and OTLP gRPC exporter to send traces to APM Server. That works and I have used it successfully in other projects, but there is no OpenTelemetry instrumentation of Azure Functions and `elasticapm.contrib.serverless.azure.ElasticAPMExtension` works best in my current use case.
コントリビューションガイド
調査の方向性
azure.core.tracing.ext.opentelemetry_span.OpenTelemetrySpan と azure.core.tracing._abstract_span.py の HttpSpanMixin から始め、次に elasticapm.contrib.serverless.azure エントリーポイントを調べてください。要求されている ElasticAPMSpan の動作を既存の OpenTelemetrySpan と比較し、これを settings.tracing_implementation に割り当てることで Azure SDK の操作が APM スパンを生成できることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- azure, python
- 領域
- observability-sre
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100