DataKit トレースのデータ構造
概要
この記事は、主流の Telemetry プラットフォームのデータ構造と、DataKit プラットフォームのデータ構造とのマッピング関係を説明するために使用されます。
現在サポートされているデータ構造: DataDog/Jaeger/OpenTelemetry/SkyWalking/Zipkin/PinPoint
データ変換手順:
- 外部トレース データ アクセス。複数のデータ プロトコルを通じてデータを受信した後、データを逆シリアル化します。
- 逆シリアル化されたオブジェクトは、
Line Protocol (ラインプロトコル形式) に変換されます。
- スパンデータ操作には、サンプリング、フィルタリング、特定のタグの追加、その他の操作が含まれます。
DataKit Point Protocol のデータ構造
| Tag |
Description |
container_host |
Host name of container |
endpoint |
End point of resource |
env |
Environment arguments |
http_host |
HTTP host |
http_method |
HTTP method |
http_route |
HTTP route |
http_status_code |
HTTP status code |
http_url |
HTTP URL |
operation |
Operation of resource |
pid |
Process id |
project |
Project name |
service |
Service name |
source_type |
Source types [app/framework/cache/message_queue/custom/db/web/...] |
span_type |
Span types |
status |
Span status |
| Metric |
Description |
Type |
Unit |
create_time |
storage create timestamp |
int |
s |
duration |
Span duration |
int |
us |
message |
Raw data content |
string |
|
parent_id |
Parent ID of span |
string |
|
priority |
priority rules |
string |
|
resource |
Resource of service |
string |
|
span_id |
Span ID |
string |
|
start |
Span start timestamp |
int |
us |
time |
DataKit received timestamp |
int |
ns |
trace_id |
Trace ID |
string |
|
span_type は、トレース内の現在のスパンの相対位置です。その値は次のように説明されます。
entry: 現在の API は入り口であり、トレースがサービスに入った後の最初の呼び出しです。
local: 現在の API は、開始後終了前の API です。
exit: 現在の API は、トレースに対するサービスの最後の呼び出しです
unknown: 現在の API の相対位置ステータスが不明です
priority クライアントの優先順位ルールの例:
PRIORITY_USER_REJECT = -1 ユーザーは報告を拒否することを選択しました
PRIORITY_AUTO_REJECT = 0 クライアント サンプラーはレポートの拒否を選択しました
PRIORITY_AUTO_KEEP = 1 クライアント サンプラー選択レポート
PRIORITY_USER_KEEP = 2 ユーザーがレポートを選択しました
OpenTelemetry Tracing のデータ構造
DataKit が OpenTelemetry Exporter (OTLP) から送信されたデータを収集すると、単純な生データが次のように JSON を通じてシリアル化されます。
resource_spans:{
resource:{
attributes:{key:"message.type" value:{string_value:"message-name"}}
attributes:{key:"service.name" value:{string_value:"test-name"}}
}
instrumentation_library_spans:{instrumentation_library:{name:"test-tracer"}
spans:{
trace_id:"\x94<\xdf\x00zx\x82\xe7Wy\xfe\x93\xab\x19\x95a"
span_id:".\xbd\x06c\x10ɫ*"
parent_span_id:"\xa7*\x80Z#\xbeL\xf6"
name:"Sample-0"
kind:SPAN_KIND_INTERNAL
start_time_unix_nano:1644312397453313100
end_time_unix_nano:1644312398464865900
status:{}
}
spans:{
...
}
}
OpenTelemetry における resource_spans と DKProto の対応関係は次のとおりです。
| Field Name |
Data Type |
Unit |
Description |
Correspond To |
| trace_id |
[16]byte |
|
Trace ID |
DKProto.TraceID |
| span_id |
[8]byte |
|
Span ID |
DKProto.SpanID |
| parent_span_id |
[8]byte |
|
Parent Span ID |
DKProto.ParentID |
| name |
string |
|
Span Name |
DKProto.Operation |
| kind |
string |
|
Span Type |
DKProto.SpanType |
| start_time_unix_nano |
int64 |
ナノ秒 |
スパン開始時間 |
DKProto.Start |
| end_time_unix_nano |
int64 |
ナノ秒 |
スパンの有効期限 |
DKProto.Duration = end - start |
| status |
string |
|
Span Status |
DKProto.Status |
| name |
string |
|
resource Name |
DKProto.Resource |
| resource.attributes |
map[string]string |
|
リsourceタグ |
DKProto.tags.service, DKProto.tags.project, DKProto.tags.env, DKProto.tags.version, DKProto.tags.container_host, DKProto.tags.http_method, DKProto.tags.http_status_code |
| span.attributes |
map[string]string |
|
スパンタグ |
DKProto.tags |
OpenTelemetry には独自のフィールドがいくつかありますが、DKProto にはそれらに対応するフィールドがないため、ラベルに配置されます。これらの値は、次のように 0 以外の場合にのみ表示されます。
| Field |
Date Type |
Uint |
Description |
Correspond |
| span.dropped_attributes_count |
int |
|
スパン 削除されたタグの数 |
DKProto.tags.dropped_attributes_count |
| span.dropped_events_count |
int |
|
削除されたイベントのスパン数 |
DKProto.tags.dropped_events_count |
| span.dropped_links_count |
int |
|
スパン 削除された接続の数 |
DKProto.tags.dropped_links_count |
| span.events_count |
int |
|
スパン関連イベント数 |
DKProto.tags.events_count |
| span.links_count |
int |
|
スパンに関連付けられたスパンの数 |
DKProto.tags.links_count |
Jaeger Tracing のデータ構造
Jaeger Thrift Protocol の Batch データ構造
| Field Name |
Data Type |
Unit |
Description |
Correspond to |
| Process |
struct pointer |
|
プロセス関連のデータ構造 |
DKProto.Service |
| SeqNo |
int64 pointer |
|
シリアル番号 |
対応関係DKProtoに接続しないでください |
| Spans |
array |
|
スパンアレイ構造 |
以下の表を参照してください |
| Stats |
struct pointer |
|
クライアント統計構造 |
DKProto には直接対応しません |
Jaeger Thrift Protocol の Span データ構造
| Field Name |
Data Type |
Unit |
Description |
Correspond To |
| TraceIdHigh |
int64 |
|
トレース ID と TraceIdLow の上位ビットがトレース ID を形成します |
DKProto.TraceID |
| TraceIdLow |
int64 |
|
トレース ID の下位ビットと TraceIdHigh はトレース ID を形成します |
DKProto.TraceID |
| ParentSpanId |
int64 |
|
Parent Span ID |
DKProto.ParentID |
| SpanId |
int64 |
|
Span ID |
DKProto.SpanID |
| OperationName |
string |
|
このスパンを生成するメソッド名 |
DKProto.Operation |
| Flags |
int32 |
|
Span Flags |
DKProto には直接対応しません |
| Logs |
array |
|
Span Logs |
DKProto には直接対応しません |
| References |
array |
|
Span References |
DKProto には直接対応しません |
| StartTime |
int64 |
ナノ秒 |
スパン開始時間 |
DKProto.Start |
| Duration |
int64 |
ナノ秒 |
時間がかかる |
DKProto.Duration |
| Tags |
array |
|
現在、スパン タグはスパン ステータス フィールドのみを取得します |
DKProto.Status |
SkyWalking Tracing Data のデータ構造
Segment Object Generated By Protobuf Protocol V3
| Field Name |
Data Type |
Unit |
Description |
Correspond To |
| TraceId |
string |
|
Trace ID |
DKProto.TraceID |
| TraceSegmentId |
string |
|
セグメント ID とスパン ID は、スパンを一意に識別するために一緒に使用されます。 |
DKProto.SpanID 上位ビット |
| Service |
string |
|
サービス名 |
DKProto.Service |
| ServiceInstance |
string |
|
ノードの論理関係名 |
未使用フィールド |
| Spans |
array |
|
スパン配列のトレース |
以下の表を参照してください |
| IsSizeLimited |
bool |
|
トレースにすべてのスパンを含めるかどうか |
未使用フィールド |
Segment Object 内の SkyWalking Span Object のデータ構造
| Field Name |
Data Type |
Unit |
Description |
Correspond To |
| ComponentId |
int32 |
|
サードパーティフレームワークの数値定義 |
未使用フィールド |
| Refs |
array |
|
スレッドとプロセス全体で親セグメントを保存する |
DKProto.ParentID 上位ビット |
| ParentSpanId |
int32 |
|
親スパン ID は、親スパンを一意に識別するためにセグメント ID とともに使用されます。 |
DKProto.ParentID 下位ビット |
| SpanId |
int32 |
|
スパン ID とセグメント ID は、スパンを一意に識別するために一緒に使用されます。 |
DKProto.SpanID 下位ビット |
| OperationName |
string |
|
Span Operation Name |
DKProto.Operation |
| Peer |
string |
|
通信ピア |
DKProto.Endpoint |
| IsError |
bool |
|
スパンステータスフィールド |
DKProto.Status |
| SpanType |
int32 |
|
スパンタイプの数値定義 |
DKProto.SpanType |
| StartTime |
int64 |
ミリ秒 |
スパン開始時間 |
DKProto.Start |
| EndTime |
int64 |
ミリ秒 |
スパン終了時間と開始時間の減算は、かかった時間を表します |
DKProto.Duration |
| Logs |
array |
|
Span Logs |
未使用フィールド |
| SkipAnalysis |
bool |
|
バックエンド分析をスキップする |
未使用フィールド |
| SpanLayer |
int32 |
|
Spanテクノロジースタックの数値定義 |
未使用フィールド |
| Tags |
array |
|
Span Tags |
未使用フィールド |
Zipkin Tracing Data のデータ構造
Zipkin Thrift Protocol の Span V1 データ構造
| Field Name |
Data Type |
Unit |
Description |
Correspond To |
| TraceIDHigh |
uint64 |
|
トレースIDの上位ビット |
直接のやり取りはありません |
| TraceID |
uint64 |
|
Trace ID |
DKProto.TraceID |
| ID |
uint64 |
|
Span ID |
DKProto.SpanID |
| ParentID |
uint64 |
|
Parent Span ID |
DKProto.ParentID |
| Annotations |
array |
|
サービス名の取得 |
DKProto.Service |
| Name |
string |
|
Span Operation Name |
DKProto.Operation |
| BinaryAnnotations |
array |
|
スパンステータスフィールドの取得 |
DKProto.Status |
| Timestamp |
uint64 |
マイクロ秒 |
スパン開始時間 |
DKProto.Start |
| Duration |
uint64 |
マイクロ秒 |
スパンに時間がかかる |
DKProto.Duration |
| Debug |
bool |
|
デバッグステータスフィールド |
未使用フィールド |
Zipkin Span V2 のデータ構造
| Field Name |
Data Type |
Unit |
Description |
Correspond To |
| TraceID |
struct |
|
Trace ID |
DKProto.TraceID |
| ID |
uint64 |
|
Span ID |
DKProto.SpanID |
| ParentID |
uint64 |
|
Parent Span ID |
DKProto.ParentID |
| Name |
string |
|
Span Operation Name |
DKProto.Operation |
| Debug |
bool |
|
デバッグステータス |
未使用フィールド |
| Sampled |
bool |
|
サンプリングステータスフィールド |
未使用フィールド |
| Err |
string |
|
Error Message |
DKProto には直接対応しません |
| Kind |
string |
|
Span Type |
DKProto.SpanType |
| Timestamp |
struct |
マイクロ秒 |
マイクロ秒の時間構造はスパンの開始時間を表します |
DKProto.Start |
| Duration |
int64 |
マイクロ秒 |
スパンに時間がかかる |
DKProto.Duration |
| Shared |
bool |
|
共有ステータス |
未使用フィールド |
| LocalEndpoint |
struct |
|
サービス名を取得するために使用されます |
DKProto.Service |
| RemoteEndpoint |
struct |
|
通信ピア |
DKProto.Endpoint |
| Annotations |
array |
|
レイテンシ関連のイベントを説明するために使用されます |
未使用フィールド |
| Tags |
map |
|
スパンステータスを取得するために使用されます |
DKProto.Status |