diff --git a/content/en/tracing/trace_pipeline/ingestion_mechanisms.md b/content/en/tracing/trace_pipeline/ingestion_mechanisms.md index 75e56e4137c..419a4a4347d 100644 --- a/content/en/tracing/trace_pipeline/ingestion_mechanisms.md +++ b/content/en/tracing/trace_pipeline/ingestion_mechanisms.md @@ -282,6 +282,23 @@ C++ does not provide integrations for automatic instrumentation, but it's used b [1]: https://github.com/DataDog/dd-trace-cpp/releases/tag/v0.1.0 [2]: /tracing/trace_collection/proxy_setup {{% /tab %}} +{{% tab "Rust" %}} +**Local configuration** + +For Rust applications, set by-service sampling rates with the `DD_TRACE_SAMPLING_RULES` environment variable. + +For example, to send 50% of the traces for the service named `my-service` and 10% for the rest of the traces: + +``` +export DD_TRACE_SAMPLING_RULES='[{"service": "my-service", "sample_rate": 0.5},{"sample_rate": 0.1}]' +``` + +Configure a rate limit by setting the `DD_TRACE_RATE_LIMIT` environment variable to the maximum traces per second per service instance. If no `DD_TRACE_RATE_LIMIT` value is set, a limit of 100 traces per second is applied. + +Read more about sampling controls in the [Rust SDK documentation][1]. + +[1]: /tracing/trace_collection/dd_libraries/rust +{{% /tab %}} {{% tab ".NET" %}} For .NET applications, set a global sampling rate for the library using the `DD_TRACE_SAMPLE_RATE` environment variable. Set by-service sampling rates with the `DD_TRACE_SAMPLING_RULES` environment variable. @@ -400,7 +417,7 @@ The head-based sampling mechanism can be overridden at the SDK level. For exampl - Set Manual Drop on a span to make sure that **no** child span is ingested. The [error and rare samplers](#error-and-rare-traces) are ignored in the Agent. -{{< programming-lang-wrapper langs="java,python,ruby,go,nodejs,.NET,php,cpp" >}} +{{< programming-lang-wrapper langs="java,python,ruby,go,nodejs,.NET,php,cpp,rust" >}} {{< programming-lang lang="java" >}} Manually keep a trace: @@ -685,6 +702,11 @@ span.trace_segment().override_sampling_priority(int(dd::SamplingPriority::USER_D //method impl follows ``` +{{< /programming-lang >}} +{{< programming-lang lang="rust" >}} + +
The Rust SDK uses the OpenTelemetry API and does not support the Datadog ManualKeep/ManualDrop tags. To force keep or drop a trace in Rust, set the OpenTelemetry sampling.priority attribute on the root span using custom instrumentation.
+ {{< /programming-lang >}} {{< /programming-lang-wrapper >}} @@ -805,6 +827,15 @@ For example, to collect `100%` of the spans from the service named `my-service`, [1]: https://github.com/DataDog/dd-trace-cpp/releases/tag/v0.1.0 {{% /tab %}} +{{% tab "Rust" %}} +For Rust applications, set by-service and by-operation name **span** sampling rules with the `DD_SPAN_SAMPLING_RULES` environment variable. + +For example, to collect `100%` of the spans from the service named `my-service`, for the operation `http.request`, up to `50` spans per second: + +``` +@env DD_SPAN_SAMPLING_RULES=[{"service": "my-service", "name": "http.request", "sample_rate":1.0, "max_per_second": 50}] +``` +{{% /tab %}} {{% tab ".NET" %}} Starting from version [v2.18.0][1], for .NET applications, set by-service and by-operation name **span** sampling rules with the `DD_SPAN_SAMPLING_RULES` environment variable.