Skip to content

Commit

Permalink
[ja] fix 軽装 to 計装 (open-telemetry#4733)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshi Yamaguchi authored and jaydeluca committed Jun 24, 2024
1 parent 313e391 commit 72b1efa
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
57 changes: 54 additions & 3 deletions content/en/docs/languages/java/sampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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.
2 changes: 1 addition & 1 deletion content/ja/docs/what-is-opentelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)を出力しなければなりません。
計装されたデータは、オブザーバビリティバックエンドに送信されなければなりません。

Expand Down

0 comments on commit 72b1efa

Please sign in to comment.