點擊通用配置 (proto)

config.tap.v3.TapConfig

[config.tap.v3.TapConfig proto]

點擊配置。

{
  "match_config": {...},
  "match": {...},
  "output_config": {...}
}
match_config

(config.tap.v3.MatchPredicate) 比對配置。如果配置與正在被點擊的資料來源相符,則會發生點擊,結果會寫入配置的輸出。必須設定 matchmatch_config 其中之一。如果兩者都設定,則會使用 match

match

(config.common.matcher.v3.MatchPredicate) 比對配置。如果配置與正在被點擊的資料來源相符,則會發生點擊,結果會寫入配置的輸出。必須設定 matchmatch_config 其中之一。如果兩者都設定,則會使用 match

output_config

(config.tap.v3.OutputConfig, 必要) 點擊輸出配置。如果比對配置與正在被點擊的資料來源相符,則會發生點擊,而且資料會寫入配置的輸出。

config.tap.v3.MatchPredicate

[config.tap.v3.MatchPredicate proto]

點擊比對配置。這是一個遞迴結構,可使用各種邏輯運算子建構複雜的巢狀比對配置。

{
  "or_match": {...},
  "and_match": {...},
  "not_match": {...},
  "any_match": ...,
  "http_request_headers_match": {...},
  "http_request_trailers_match": {...},
  "http_response_headers_match": {...},
  "http_response_trailers_match": {...},
  "http_request_generic_body_match": {...},
  "http_response_generic_body_match": {...}
}
or_match

(config.tap.v3.MatchPredicate.MatchSet) 描述邏輯 OR 的集合。如果集合的任何成員相符,則比對配置相符。

必須設定 or_matchand_matchnot_matchany_matchhttp_request_headers_matchhttp_request_trailers_matchhttp_response_headers_matchhttp_response_trailers_matchhttp_request_generic_body_matchhttp_response_generic_body_match 其中之一。

and_match

(config.tap.v3.MatchPredicate.MatchSet) 描述邏輯 AND 的集合。如果集合的所有成員相符,則比對配置相符。

必須設定 or_matchand_matchnot_matchany_matchhttp_request_headers_matchhttp_request_trailers_matchhttp_response_headers_matchhttp_response_trailers_matchhttp_request_generic_body_matchhttp_response_generic_body_match 其中之一。

not_match

(config.tap.v3.MatchPredicate) 否定比對。如果否定比對條件相符,則比對配置相符。

必須設定 or_matchand_matchnot_matchany_matchhttp_request_headers_matchhttp_request_trailers_matchhttp_response_headers_matchhttp_response_trailers_matchhttp_request_generic_body_matchhttp_response_generic_body_match 其中之一。

any_match

(bool) 比對配置一律相符。

必須設定 or_matchand_matchnot_matchany_matchhttp_request_headers_matchhttp_request_trailers_matchhttp_response_headers_matchhttp_response_trailers_matchhttp_request_generic_body_matchhttp_response_generic_body_match 其中之一。

http_request_headers_match

(config.tap.v3.HttpHeadersMatch) HTTP 請求標頭比對配置。

必須設定 or_matchand_matchnot_matchany_matchhttp_request_headers_matchhttp_request_trailers_matchhttp_response_headers_matchhttp_response_trailers_matchhttp_request_generic_body_matchhttp_response_generic_body_match 其中之一。

http_request_trailers_match

(config.tap.v3.HttpHeadersMatch) HTTP 請求尾端標頭比對配置。

必須設定 or_matchand_matchnot_matchany_matchhttp_request_headers_matchhttp_request_trailers_matchhttp_response_headers_matchhttp_response_trailers_matchhttp_request_generic_body_matchhttp_response_generic_body_match 其中之一。

http_response_headers_match

(config.tap.v3.HttpHeadersMatch) HTTP 回應標頭比對配置。

必須設定 or_matchand_matchnot_matchany_matchhttp_request_headers_matchhttp_request_trailers_matchhttp_response_headers_matchhttp_response_trailers_matchhttp_request_generic_body_matchhttp_response_generic_body_match 其中之一。

http_response_trailers_match

(config.tap.v3.HttpHeadersMatch) HTTP 回應尾端標頭比對配置。

必須設定 or_matchand_matchnot_matchany_matchhttp_request_headers_matchhttp_request_trailers_matchhttp_response_headers_matchhttp_response_trailers_matchhttp_request_generic_body_matchhttp_response_generic_body_match 其中之一。

http_request_generic_body_match

(config.tap.v3.HttpGenericBodyMatch) HTTP 請求通用主體比對配置。

必須設定 or_matchand_matchnot_matchany_matchhttp_request_headers_matchhttp_request_trailers_matchhttp_response_headers_matchhttp_response_trailers_matchhttp_request_generic_body_matchhttp_response_generic_body_match 其中之一。

http_response_generic_body_match

(config.tap.v3.HttpGenericBodyMatch) HTTP 回應通用主體比對配置。

必須設定 or_matchand_matchnot_matchany_matchhttp_request_headers_matchhttp_request_trailers_matchhttp_response_headers_matchhttp_response_trailers_matchhttp_request_generic_body_matchhttp_response_generic_body_match 其中之一。

config.tap.v3.MatchPredicate.MatchSet

[config.tap.v3.MatchPredicate.MatchSet proto]

用於邏輯運算的一組比對配置。

{
  "rules": []
}
rules

(重複 config.tap.v3.MatchPredicate, 必要) 組成集合的規則清單。

config.tap.v3.HttpHeadersMatch

[config.tap.v3.HttpHeadersMatch proto]

HTTP 標頭比對配置。

{
  "headers": []
}
headers

(重複 config.route.v3.HeaderMatcher) 要比對的 HTTP 標頭。

config.tap.v3.HttpGenericBodyMatch

[config.tap.v3.HttpGenericBodyMatch proto]

HTTP 通用主體比對配置。要位於 HTTP 主體中的文字字串和十六進位字串清單。必須在 HTTP 主體中找到所有指定的字串,才算正向比對。搜尋可能會限制在從主體開頭起指定的位元組數目內。

注意

在 HTTP 主體中搜尋模式可能會耗用大量 CPU。對於每個指定的模式,會逐位元組掃描 HTTP 主體以尋找比對。如果指定多個模式,則會針對每個模式重複此程序。如果知道模式的位置,則應指定 bytes_limit 來僅掃描部分 HTTP 主體。

{
  "bytes_limit": ...,
  "patterns": []
}
bytes_limit

(uint32) 將搜尋限制為指定的位元組數目 - 預設為零 (無限制 - 比對整個擷取的緩衝區)。

patterns

(重複 config.tap.v3.HttpGenericBodyMatch.GenericTextMatch, 必要) 要比對的模式清單。

config.tap.v3.HttpGenericBodyMatch.GenericTextMatch

[config.tap.v3.HttpGenericBodyMatch.GenericTextMatch proto]

{
  "string_match": ...,
  "binary_match": ...
}
string_match

(string) 要位於 HTTP 主體中的文字字串。

必須設定 string_matchbinary_match 其中之一。

binary_match

(bytes) 要位於 HTTP 主體中的位元組序列。

必須設定 string_matchbinary_match 其中之一。

config.tap.v3.OutputConfig

[config.tap.v3.OutputConfig proto]

點擊輸出配置。

{
  "sinks": [],
  "max_buffered_rx_bytes": {...},
  "max_buffered_tx_bytes": {...},
  "streaming": ...
}
sinks

(重複 config.tap.v3.OutputSink, 必要) 點擊資料的輸出接收器。目前清單中只允許單一接收器。一旦支援多個接收器類型,此限制就會放寬。

max_buffered_rx_bytes

(UInt32Value) 對於緩衝點擊,將在截斷之前緩衝的最大接收主體量。如果發生截斷,則會設定 truncated 欄位。如果未指定,則預設值為 1KiB。

max_buffered_tx_bytes

(UInt32Value) 對於緩衝點擊,將在截斷之前緩衝的最大傳輸主體量。如果發生截斷,則會設定 truncated 欄位。如果未指定,則預設值為 1KiB。

streaming

(bool) 指示點擊是產生每個點擊的單一緩衝訊息,還是在發出的 TraceWrapper 訊息中產生每個點擊的多個串流訊息。請注意,串流點擊並不表示不會發生緩衝。如果在決定比對之前處理資料,則可能需要緩衝。如需詳細資訊,請參閱 HTTP 點擊篩選器 streaming 文件。

config.tap.v3.OutputSink

[config.tap.v3.OutputSink proto]

點擊輸出接收器配置。

{
  "format": ...,
  "streaming_admin": {...},
  "file_per_tap": {...},
  "buffered_admin": {...},
  "custom_sink": {...}
}
format

(config.tap.v3.OutputSink.Format) 接收器輸出格式。

streaming_admin

(config.tap.v3.StreamingAdminSink) 點擊輸出將透過 POST /tap 管理端點串流輸出。

注意

只有在透過 POST /tap 管理介面設定 tap 時,才允許指定串流管理輸出接收器。因此,如果擴充功能已設定為從其他來源 (例如,靜態檔案、XDS 等) 接收 tap 設定,則設定串流管理輸出類型將會失敗。

必須設定 streaming_adminfile_per_tapbuffered_admincustom_sink 其中之一,且只能設定一個。

file_per_tap

(config.tap.v3.FilePerTapSink) Tap 輸出將會寫入每個 tap 接收器的一個檔案。

必須設定 streaming_adminfile_per_tapbuffered_admincustom_sink 其中之一,且只能設定一個。

buffered_admin

(config.tap.v3.BufferedAdminSink) Tap 輸出將會緩衝在單一區塊中,然後刷新到 POST /tap 管理介面。

注意

只有在透過 POST /tap 管理介面設定 tap 時,才允許指定緩衝管理輸出接收器。因此,如果擴充功能已設定為從其他來源 (例如,靜態檔案、XDS 等) 接收 tap 設定,則設定緩衝管理輸出類型將會失敗。

必須設定 streaming_adminfile_per_tapbuffered_admincustom_sink 其中之一,且只能設定一個。

custom_sink

(config.core.v3.TypedExtensionConfig) Tap 輸出篩選器將由擴充類型定義。

必須設定 streaming_adminfile_per_tapbuffered_admincustom_sink 其中之一,且只能設定一個。

列舉 config.tap.v3.OutputSink.Format

[config.tap.v3.OutputSink.Format proto]

輸出格式。所有輸出均採用一個或多個 TraceWrapper 訊息的形式。此列舉表示這些訊息的寫入方式。請注意,並非所有接收器都支援所有輸出格式。請參閱個別接收器文件以了解更多資訊。

JSON_BODY_AS_BYTES

(預設) 每個訊息都將以 JSON 格式寫入。任何 body 資料都將出現在 as_bytes 欄位中。這表示主體資料將根據 proto3 JSON 映射進行 base64 編碼。

JSON_BODY_AS_STRING

每個訊息都將以 JSON 格式寫入。任何 body 資料都將出現在 as_string 欄位中。這表示主體資料將根據 proto3 JSON 映射進行字串編碼。當已知主體是人類可讀的 (例如,HTTP 上的 JSON) 並且使用者希望直接檢視它而無需強制 base64 解碼主體時,此格式類型非常有用。

PROTO_BINARY

二進位 proto 格式。請注意,二進位 proto 不是自我分隔的。如果接收器在沒有任何長度資訊的情況下寫入多個二進位訊息,則資料流將無法使用。但是,對於某些自我分隔的接收器 (例如,每個檔案一個訊息),此輸出格式可以簡化使用。

PROTO_BINARY_LENGTH_DELIMITED

訊息會以序列元組的形式寫入,其中每個元組都是訊息長度,以 protobuf 32 位元 varint 編碼,後接二進位訊息。可以使用特定於語言的 protobuf 編碼流實作來讀回訊息,以取得訊息長度和訊息。

PROTO_TEXT

文字 proto 格式。

config.tap.v3.StreamingAdminSink

[config.tap.v3.StreamingAdminSink proto]

串流管理接收器設定。

config.tap.v3.BufferedAdminSink

[config.tap.v3.BufferedAdminSink proto]

BufferedAdminSink 設定 tap 輸出,以收集追蹤資料,直到滿足多個條件之一才會傳回它們。與 StreamingAdminSink 類似,只有在透過 /tap 管理介面設定 tap 時,才允許指定緩衝管理輸出接收器。

{
  "max_traces": ...,
  "timeout": {...}
}
max_traces

(uint64) 當收集到指定數量的追蹤資料時,停止收集追蹤資料。如果首先達到其他結束收集的條件,則不會使用此值。

timeout

(Duration) 作為後備方案,以防止用戶端等待很長時間。發生逾時後,將觸發緩衝區刷新,傳回目前已緩衝的追蹤資料。這可能會導致傳回的追蹤資料少於請求的數量,並且如果在此期間沒有緩衝追蹤資料,則不會傳回任何追蹤資料。為逾時值指定 0 (或根本不指定值) 表示無限逾時。

config.tap.v3.FilePerTapSink

[config.tap.v3.FilePerTapSink proto]

每個 tap 接收器檔案會為每個已點擊的串流輸出一個離散檔案。

{
  "path_prefix": ...
}
path_prefix

(string, 必要) 路徑前置詞。輸出檔案的形式為 <path_prefix>_<id>.pb,其中 <id> 是一個識別碼,用於區分串流執行個體的已記錄追蹤資料 (Envoy 連線 ID、HTTP 串流 ID 等)。