概要 トレーシングで重要なのがSamplingです。 単純に全データを計測するとコストが増えたりパフォーマンスに影響が出たりします。 OpenTelemetryではSamplingに対する仕様が決まっているので、それに基づいて具体的な実装を紹介します。 OpenTelemetry Specification - Sampling 環境 Go v1.20.2 go.opentelemetry.io/otel/trace v1.14.0 前提知識 サンプリング手法 サンプリングには大きく2つのタイプがあります。 Head basedとTail basedです。 ref: https://newrelic.com/jp/blog/best-practices/distributed-tracing-and-sampling Head based sampling シンプルでよく使われるのがHea
![OpenTelemetryでのSampling - Carpe Diem](https://cdn-ak-scissors.b.st-hatena.com/image/square/8ea6fddb812e8dae507d66436fc288b6183ead0a/height=288;version=1;width=512/https%3A%2F%2Fcdn-ak.f.st-hatena.com%2Fimages%2Ffotolife%2Fq%2Fquoll00%2F20230320%2F20230320064918.jpg)