From 72b1efa5896c51e6009236fc334a95d3f202bf11 Mon Sep 17 00:00:00 2001 From: Yoshi Yamaguchi Date: Mon, 24 Jun 2024 16:14:50 +0900 Subject: [PATCH] =?UTF-8?q?[ja]=20fix=20=E8=BB=BD=E8=A3=85=20to=20?= =?UTF-8?q?=E8=A8=88=E8=A3=85=20(#4733)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/en/docs/languages/java/sampling.md | 57 ++++++++++++++++++++-- content/ja/docs/what-is-opentelemetry.md | 2 +- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/content/en/docs/languages/java/sampling.md b/content/en/docs/languages/java/sampling.md index 4f6d2ff58be2..3b56e6fa9570 100644 --- a/content/en/docs/languages/java/sampling.md +++ b/content/en/docs/languages/java/sampling.md @@ -8,6 +8,57 @@ spans that are generated by a system. Which sampler to use depends on your needs. In general, decide which sampler to use at the start of a trace and allow the sampling decision to propagate to other services. +## Default behavior + +By default, all spans are sampled, and thus, 100% of traces are sampled. If you +do not need to manage data volume, don't bother setting a sampler. + +## Environment variables + +You can configure the sampler with environment variables or system properties. +Reference the [configuration](/docs/languages/java/configuration/) documentation +for the available options. + +For example, to configure the SDK to sample spans such that only 10% of traces +get created: + +```shell +export OTEL_TRACES_SAMPLER="traceidratio" +export OTEL_TRACES_SAMPLER_ARG="0.1" +``` + +## Samplers + +### ParentBasedSampler + +When sampling, the ParentBasedSampler is most often used for +[head sampling](/docs/concepts/sampling/#head-sampling). It uses the sampling +decision of the Span’s parent, or the fact that there is no parent, to know +which secondary sampler to use. + +If the parent span is sampled, the child span will also be sampled. Conversely, +if the parent span is not sampled, the child span will not be sampled either. +This ensures consistency in sampling decisions within a trace. + +### TraceIDRatioBasedSampler + +The TraceIdRatioBasedSampler deterministically samples a percentage of traces +that you pass in as a parameter. + +This sampler is useful when you want to control the overall sampling rate across +all traces, regardless of their parent spans. It provides a consistent rate of +sampling for all traces initiated. + +## Configuration in code + +{{% alert title="Note" %}} The use of the +[Java agent](/docs/zero-code/java/agent/), +[Spring Boot Starter](/docs/zero-code/java/spring-boot-starter/), or +[SDK autoconfigure](/docs/languages/java/instrumentation/#autoconfiguration) is +generally recommended for controlling sampling, rather than setting it directly +in the code. Most users should find the default settings sufficient for their +needs. {{% /alert %}} + A sampler can be set on the tracer provider using the `setSampler` method, as follows: @@ -37,9 +88,9 @@ Other samplers include: - `traceIdRatioBased`, which samples a fraction of spans, based on the fraction given to the sampler. If you set `0.5`, half of all the spans are sampled. + Currently, only the ratio of traces that are sampled can be relied on, not how + the sampled traces are determined. As such, it is recommended to only use this + sampler for root spans using `parentBased`. - `parentBased`, which uses the parent span to make sampling decisions, if present. By default, the tracer provider uses a parentBased sampler with the `alwaysOn` sampler. - -When in a production environment, consider using the `parentBased` sampler with -the `traceIdRatioBased` sampler. diff --git a/content/ja/docs/what-is-opentelemetry.md b/content/ja/docs/what-is-opentelemetry.md index e6a7fb23693c..141a8a215f97 100644 --- a/content/ja/docs/what-is-opentelemetry.md +++ b/content/ja/docs/what-is-opentelemetry.md @@ -19,7 +19,7 @@ OpenTelemetryの主な目的は、あなたのアプリケーションやシス [オブザーバビリティ](/docs/concepts/observability-primer/#what-is-observability)とは、システムの出力を調べることによって、システムの内部状態を理解する能力のことです。 ソフトウェアの文脈では、これは、トレース、メトリクス、ログを含むテレメトリーデータを調べることによって、システムの内部状態を理解できることを意味します。 -システムをオブザーバビリティがある状態にするには、[軽装されて](/docs/concepts/instrumentation)いなければなりません。 +システムをオブザーバビリティがある状態にするには、[計装されて](/docs/concepts/instrumentation)いなければなりません。 つまり、コードが[トレース](/docs/concepts/signals/traces/)、[メトリクス](/docs/concepts/signals/metrics/)、または[ログ](/docs/concepts/signals/logs/)を出力しなければなりません。 計装されたデータは、オブザーバビリティバックエンドに送信されなければなりません。