Issues with OTLP exporter with None values
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- python
調査の方向性
exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/init.py の OTLP encoder から始め、CeleryInstrumentor() が task results と log values をどのように export するかを追跡します。提供された Celery task を使って値が None の result を再現し、その後、exporter が warnings や errors なしで処理できること、また SDK/API の非互換性が解消されているか、明確に切り分けられていることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Describe your environment
OS: Ubuntu
Python version: 3.12
SDK version: opentelemetry-sdk==1.36.0
API version: opentelemetry-api==1.36.0
Celery: opentelemetry-instrumentation-celery==0.57b0
What happened?
I am using CeleryInstrumentor() to get logs of celery into Grafana/Loki
First of the issues I get is that I see an incompatibility with the latest opentelemetry-sdk (1.41) version with opentelemetry-api (it does not allow me to install).
Second issue is with None values in the celery results exported to Grafana. I am seeing a warning like:
Invalid type <class 'dict'> of value {'id': 'b2f12a15-b57d-4e9a-a439-345a323e7c1b', 'name': 'app.tasks.tasks.say_hello', 'args': '()', 'kwargs': '{}', 'eta': None}
I noticed that in opentelemetry 1.41 you already updated the encoder: https://github.com/open-telemetry/opentelemetry-python/blob/main/exporter/opentelemetry-exporter-otlp-proto-common/src/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py
But I am uncapable of setting allow_null to True for CeleryInstrumentor().
Steps to Reproduce
Setup CeleryInstrumentor() and have a task that retuns None values somewhere.
In my case:
# API route to trigger the task
@bp.route('/long_task', methods=['GET'])
def trigger_task():
task = say_hello.delay()
return jsonify({"task_id": task.id, "status": "Task has been submitted"}), 202
@celery.task
def say_hello():
sleep(10)
logger.info(f"[HEALTHCHECK] say_hello config_class={type(Config).__name__} service_name={Config.SERVICE_NAME}")
return "Hello, World!"
I also have a custom logger setup, which might be the one causing None to get inserted over the values.
Expected Result
No errors or warning escalated to Loki/Grafana
Actual Result
I monkey patched _encode_key_value:
def _encode_key_value(key: str, value: _Any, allow_null: bool = False) -> _PB2KeyValue:
if value is None:
return _PB2KeyValue(key=key, value=_encode_value(value, allow_null=True))
return _PB2KeyValue(key=key, value=_encode_value(value, allow_null=allow_null))
Additional context
I am unsure if this is a proper solution, I guess not and that it should be configured and CeleryInstrumentor some setting that allows to pass the allow_none=True, but I do not know how to do it.
Would you like to implement a fix?
None
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
- 主要言語
- Python
- スター
- 2.7k
- フォーク
- 1.1k
- 平均マージ
- 3日 12時間
- マージ済み PR(30日)
- 16
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
open-telemetry/opentelemetry-python のほかの issue
-
References to Archived open-telemetry/oteps対応中かも @RjyavardhanSingh が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
open-telemetry/opentelemetry-python#5984 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Autoconfiguration rejects OTEL_EXPORTER_OTLP_PROTOCOL=http/json対応中かも @WendeelMarinho が 2 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
open-telemetry/opentelemetry-python#5981 ·
メンテナーはふだん 2 日以内に返信
-
MeterProvider raises ValueError on empty or uppercase OTEL_METRICS_EXEMPLAR_FILTER対応中かも @bishalde が 8 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
open-telemetry/opentelemetry-python#5948 · コメント 3 件 ·
メンテナーはふだん 2 日以内に返信
-
W3CBaggagePropagator drops a list-member over 4096 bytes that W3C Baggage requires it to propagate対応中かも @codedbyadiiii が 20 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
open-telemetry/opentelemetry-python#5913 ·
メンテナーはふだん 2 日以内に返信
-
otel.sdk.processor.{span,log}.queue.capacity uses synchronous UpDownCounter recorded once in __init__再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
open-telemetry/opentelemetry-python#5891 ·
メンテナーはふだん 2 日以内に返信
open-telemetry/opentelemetry-python の issue をすべて見る
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
Bforartists/Manual#1916 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
JdeRobot/PerceptionMetrics#698 ·
メンテナーはふだん 6 日以内に返信
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
rootsiemen/seo-agent-tools#70 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
stephrobert/dsoxlab#413 ·
メンテナーはふだん 1 日以内に返信
-
format:line_indent keeps the second of two consecutive blank lines, so valid stairs fail対応中かも @albertlieyingadrian が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100