How to start trace with custom trace-id and parent-id?
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- java, kafka
調査の方向性
例に示されている Java のエントリポイント—GlobalTracer.get()、buildSpan(...).asChildOf()、CustomSpanContext—から始め、保存された Kafka ヘッダーが outbox コンテナでどのように利用されているかを比較します。分散トレーシングを維持しながら trace-id と parent-id を受け取れるサポート対象 API が存在するかどうかを特定します。publishFromOutbox からの span が相関したログとともに既存の trace に現れれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Library Name
micronaut
Library Version(s)
dd-trace:1.50.1
Describe the feature you'd like
Hi,
We are storing outbox events for Kafka in the database with current span context headers:
headers={
x-datadog-parent-id=1425649086485655485,
x-datadog-sampling-priority=1,
tracestate=dd=s:1;
o:rum;
p:13c8ec4a6e566fbd,
x-datadog-origin=rum,
traceparent=00-000000000000000024fefac4c68ae928-13c8ec4a6e566fbd-01,
x-datadog-trace-id=2665843752501438760
}
and when these outbox events are picked (by a different container), we want to trace that operation but attach those spans to an already existing trace so that we can have support for:
- distributed tracing
- distributed logs
Is your feature request related to a problem?
No response
Describe alternatives you've considered
This is what we tried
void publishFromOutbox(final Outbox outboxEvent) {
final var tracer = GlobalTracer.get();
final Span span = tracer.buildSpan(JOBS)
.withTag(DDTags.RESOURCE_NAME, OUTBOX_SCHEDULER_PUBLISH)
.ignoreActiveSpan()
.asChildOf(new CustomSpanContext(
outboxEvent.headers().get(X_DATADOG_TRACE_ID), outboxEvent.headers().get(X_DATADOG_PARENT_ID)))
.start();
tracer.activateSpan(span);
publish(outboxEvent);
tracer.activeSpan().finish();
}
but we can see this doesn't work. Trace is not created or attached to any existing trace.
How can we accomplish starting trace with custom trace-id and parent-id? For PHP services we are using this handy method that you provide
/**
* Apply the distributed tracing information on the current and future spans. That API can be called if there is no
* other currently active span.
*
* The distributed tracing context can be reset by calling 'set_distributed_tracing_context("0", "0")'
*
* @param string $traceId The unique integer (128-bit unsigned) ID of the trace containing this span
* @param string $parentId The span integer ID of the parent span
* @param string|null $origin The distributed tracing origin
* @param array|string|null $propagated_tags If provided, propagated tags from the root span will be cleared and
* replaced by the given tags and applied to existing spans
* @return bool 'true' if the distributed tracing context was properly set, else 'false' if an error occurred
*/
function set_distributed_tracing_context(
string $traceId,
string $parentId,
?string $origin = null,
array|string|null $propagated_tags = null
): bool {}
Additional context
No response
- 主要言語
- Java
- スター
- 737
- フォーク
- 361
- 平均マージ
- 3日 20時間
- マージ済み PR(30日)
- 173
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DataDog/dd-trace-java のほかの issue
-
type: feature request
難易度 1/5 1〜3時間 初心者へのやさしさ 70/100
DataDog/dd-trace-java#10245 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 62/100
DataDog/dd-trace-java#12608 ·
-
type: bug report
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
DataDog/dd-trace-java#12597 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
DataDog/dd-trace-java#12540 · コメント 3 件 · 担当者 1 名 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
DataDog/dd-trace-java#12480 ·
DataDog/dd-trace-java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
elastic/gradle-plugins#157 ·
-
enhancement Tools
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
apache/rocketmq-dashboard#5008 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
DETECT_PARAMETER_NAMES=false silently disables @ConstructorProperties-based Creator detection too オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
FasterXML/jackson-databind#6229 ·