Open9

Jaeger v2 リリースの変更点について

zenogawazenogawa

OSS の分散 tracing プラットフォームの jaeger は今までメジャーバージョンが 1 だったが、2024/11/12 にバージョン 2.0.0 がリリースされた記事が CNCF ブログで公開された。

https://www.cncf.io/blog/2024/11/12/jaeger-v2-released-opentelemetry-in-the-core/

主な変更点はブログ内で言及されている。What’s in v2 では以下の項目が挙げられている。

  • ✅ A single binary & Docker image configurable to run in different roles, such as collector, ingester, query, and a collection of configuration file templates for these roles.
  • ✅ Support for all official storage backends with full backwards compatibility with Jaeger v1.
  • ✅ Support for Kafka as intermediate queue, in both OTLP and Jaeger legacy data formats.
  • ✅ Support for primary and archive storage.
  • ✅ Support for remote and adaptive head sampling.
  • ✅ Support for tail sampling .
  • ✅ Service Performance Management (SPM).
  • ✅ Internal observability integrated with OpenTelemetry Collector configuration.
  • ✅ Refreshed documentation and v1→v2 migration guide.

ただ一見しただけではどのような変更があったのか分かりづらい項目もあるので、具体的な変更や追加された点について見ていく。

CNCF の記事の元になっている jaeger のブログは以下。内容はだいたい同じだが Third Time a Charm などの記述が異なっている。

https://medium.com/jaegertracing/towards-jaeger-v2-moar-opentelemetry-2f8239bee48e

バージョン 2.0.0 (以下 v2) での変更点は github release でもある程度まとまっている。
https://github.com/jaegertracing/jaeger/releases/tag/v1.63.0

zenogawazenogawa

✅ A single binary & Docker image configurable to run in different roles, such as collector, ingester, query, and a collection of configuration file templates for these roles.

v1 では collector, query, ingester など用途ごとにバイナリやコンテナイメージが分けられていた。

https://www.jaegertracing.io/docs/1.63/deployment/

v2 ではこれがシングルバイナリになったとのこと。用途毎にイメージを分ける必要がなくなったので v2 ドキュメントの構成も大きく変わっている。

https://www.jaegertracing.io/docs/2.0/deployment/

zenogawazenogawa

✅ Support for all official storage backends with full backwards compatibility with Jaeger v1.

v2 では v1 で使用可能だった trace データを永続化するためのストレージバックエンドをすべてサポートしている。一覧は以下。

https://www.jaegertracing.io/docs/2.0/storage/

v1 ドキュメントで storage backend 一覧の独立したページがなかったのでドキュメントとしても見やすくなった。

zenogawazenogawa

✅ Support for Kafka as intermediate queue, in both OTLP and Jaeger legacy data formats.

データを永続化するために trace データを jaeger → ストレージバックエンドに流す構成で、データの損失を防ぐ、負荷分散する目的で間に intermediate queue として kafka を挟む構成が可能。これ自体は v1 のときから対応していた。

https://www.jaegertracing.io/docs/2.0/architecture/#via-kafka
https://www.jaegertracing.io/docs/2.0/performance-tuning/#consider-using-apache-kafka-as-intermediate-buffer

legacy data format という部分がよくわからないが、以下のアーキテクチャに legacy というワードがいくつか使われているのでこのあたりに対応してそう。

https://docs.google.com/document/d/1karnc_XxGfnAHPyAP8Uf3Kun_T5xfOaktcSYqFuWoFw/edit?tab=t.0

zenogawazenogawa

✅ Support for primary and archive storage.

v2 系のドキュメントでは archive storage というワードが見当たらない。
v1 系では deployment で言及されている。

Initialize
The following command prepares Elasticsearch for rollover deployment by creating index aliases, indices, and index templates:

docker run -it --rm --net=host jaegertracing/jaeger-es-rollover:latest init http://localhost:9200 # <1>
If you need to initialize archive storage, add -e ARCHIVE=true.

After the initialization Jaeger can be deployed with --es.use-aliases=true.

v2 では以下のように jaeger_query に対して tracetrace_archive でそれぞれ storage backend を定義できるのでこれに対応してそう。

https://github.com/jaegertracing/jaeger/blob/c00931f0a1c5f7f03905e6c8902ca70ae683f49f/cmd/jaeger/config-elasticsearch.yaml#L24-L60

archive storage は文字通り長期的な archive data を保存する用途で使用するっぽい。

https://github.com/jaegertracing/jaeger/issues/6225
https://github.com/jaegertracing/jaeger/pull/6156

zenogawazenogawa

✅ Support for tail sampling

otel-collector contrlib の tail-based sampling processor をサポートするようになった。

https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/tailsamplingprocessor/README.md

以下に tail-based sampling を利用する jaeger 構成ファイルのサンプルがある。
jaeger v2 では以下のように tail_sampling を指定する。
https://github.com/jaegertracing/jaeger/tree/main/docker-compose/tail-sampling

jaeger-v2-config.yml
service:
  pipelines:
    traces:
      processors: [tail_sampling]
processors:
  tail_sampling:
    decision_wait: 5s
    policies:
      [
        {
          name: filter-by-attribute,
          type: string_attribute,
          string_attribute:
            { key: service.name, values: [tracegen-02, tracegen-04] },
        },
      ]
zenogawazenogawa

✅ Service Performance Management (SPM).

https://www.jaegertracing.io/docs/2.0/spm/

SPM 自体は v1 から存在する。v1 と v2 ドキュメントの内容を比較すると記述がいくつか変わっている。

https://github.com/jaegertracing/jaeger/issues/5632
https://github.com/jaegertracing/jaeger/pull/5681

Jaeger-v1 implements a functionality known as SPM, but it requires a separately running OpenTelemetry Collector to produce metrics out of spans using SpanMetrics Connector. Since Jaeger-v2 is built on top of OTEL Collector, we can run SpanMetrics Connector directly in the Jaeger binary and simplify the setup for the users.
Expected Outcome: Achieve parity in SPM of jaeger-v2 compared to jaeger-v1. Implement integration tests. Update documentation accordingly.
Extra credit: implement metrics reader directly on top of Elasticsearch/Opensearch and bypass the need for Prometheus.

v1 では SpanMetrics collector を外部で定義していたが、v2 では jaeger binary の中で直接実行されるようになっている。

SPM のデモ
https://github.com/jaegertracing/jaeger/tree/main/docker-compose/monitor

jaeger v1, v2 の docker-compose や config を比較すると、v1 では 別途 opentelemetry-collector-contrib コンテナを立てているが、v2 では立てなくなっている。

v1
https://github.com/jaegertracing/jaeger/blob/main/docker-compose/monitor/docker-compose.yml

v2
https://github.com/jaegertracing/jaeger/blob/main/docker-compose/monitor/docker-compose-v2.yml

v2 では jaeger 用の config で connector.spanmetrics を指定して有効化している。

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [jaeger_storage_exporter, spanmetrics]
    metrics/spanmetrics:
      receivers: [spanmetrics]
      exporters: [prometheus]

connectors:
  spanmetrics:
zenogawazenogawa

その他の変更

jaeger agent の廃止

jaeger agent は otel と機能が被っていたので非推奨となっていたが v2 で削除された。

otel との整合性

otel 側との設定を合わせるようにいろいろな部分が refactoring されている。

https://github.com/jaegertracing/jaeger/issues/5229

例えば Cassandra バックエンドに設定する場合、auth や tls などのクションが設定されている。

https://github.com/jaegertracing/jaeger/pull/5949/files

ElasticSearch でも tls の設定が変更されている。

https://github.com/jaegertracing/jaeger/issues/6059
https://github.com/jaegertracing/jaeger/pull/6079/files

zenogawazenogawa

Demo アプリケーション

docker で jaeger v2 を動かす場合は以下のイメージを使用する。v2 でシングルバイナリになったのでイメージも一新されたらしい。

https://hub.docker.com/r/jaegertracing/jaeger

動作を学ぶための hotrod デモアプリケーションは以下。

https://github.com/jaegertracing/jaeger/tree/main/examples/hotrod

v1 は docker-compose.yml, v2 は docker-compose-v2.yml で動かせる。v1 では all-in-one イメージを使用しているが、v2 では上記の jaeger イメージが使用される。
v2 の構成は以下を参照。

https://github.com/jaegertracing/jaeger/tree/main/cmd/jaeger