out_opentelemetry: add header_tag / headers_key dynamic header support (like out_http)

オープン
#12,722 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c
領域
api, backend

調査の方向性

Start with the out_opentelemetry output implementation and its configuration definitions, then read plugins/out_http/http.c for the existing header_tag and headers_key behavior. Check how OTLP requests are batched, especially the batching discussion in issue #7206, before deciding how record derived headers apply per chunk. Done means both options work with the documented semantics and tests cover them, including the chosen batching behavior.

索引モデルが issue の本文から書いたものです。

説明

Problem

out_opentelemetry only supports a static header option
(FLB_CONFIG_MAP_SLIST_1). There is no way to set a per-request or tag-derived
HTTP header.

Users who need to route OTLP data by tag are forced to write one complete
[OUTPUT] block per tag, where the outputs differ only in a single header
value. This does not scale when there are many services/tags.

Use case

OpenObserve selects the destination stream for OTLP logs using the
stream-name HTTP header (defaults to default). To send each Fluent Bit tag
to its own OpenObserve stream today you must duplicate the output once per tag:

[OUTPUT]  name opentelemetry  match app_a  header stream-name app_a  ...
[OUTPUT]  name opentelemetry  match app_b  header stream-name app_b  ...

This is the same problem out_http already solves with header_tag (a header
whose value is the tag) and headers_key (a header map read from a record
field).

Proposal

Add the same two options to out_opentelemetry:

  • header_tag <NAME> — add an HTTP header named <NAME> whose value is the
    current tag. Example: header_tag stream-name.
  • headers_key <KEY> — read a map of headers from record field <KEY> and
    apply them per request (same semantics as out_http).

With header_tag, the OpenObserve case above becomes a single output:

[OUTPUT]
    name        opentelemetry
    match       *
    header_tag  stream-name

Reference

out_http already implements both:

  • header_tag — plugins/out_http/http.c
  • headers_key — plugins/out_http/http.c (extract_headers reads
    record[<key>])

Notes

  • header_tag maps naturally to OTLP batching (the tag is constant per chunk).
  • headers_key may require batching/grouping records by header value (see
    https://github.com/fluent/fluent-bit/issues/7206 for how out_http handled
    batching), or limiting it to per-chunk semantics.

Current workaround

  1. One [OUTPUT] per tag (N duplicated outputs), or
  2. Carry the identity in OTLP resource attributes (e.g. service.name) and
    split on the backend side (e.g. OpenObserve pipeline with a {service.name}
    dynamic stream).
主要言語
C
スター
8.2k
フォーク
2k
平均マージ
3日 20時間
マージ済み PR(30日)
99

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fluent/fluent-bit のほかの issue

fluent/fluent-bit の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。