Skip to content

Commit

Permalink
pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sydney-munro committed Jan 10, 2025
1 parent 2292dce commit 6ed185b
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// [START storage_enable_otel_tracing]
public class QuickstartOpenTelemetrySample {
public static void main(String... args) throws Exception {
SpanExporter exporter = TraceExporter.createWithDefaultConfiguration();
SpanExporter spanExporter = TraceExporter.createWithDefaultConfiguration();
TextMapPropagator propagators = TextMapPropagator.composite(
W3CTraceContextPropagator.getInstance(),
new XCloudTraceContextPropagator(/*oneway=*/true));
Expand All @@ -44,9 +44,11 @@ public static void main(String... args) throws Exception {
.setPropagators(ContextPropagators.create(propagators))
.setTracerProvider(
SdkTracerProvider.builder()
// Sample Rate set to always
// Sample Rate is set to alwaysOn
// It is recommended to sample based on a ratio for standard use ie.
// .setSampler(Sampler.traceIdRatioBased(0.2)) // sample only 20% of trace ids
.setSampler(Sampler.alwaysOn())
.addSpanProcessor(BatchSpanProcessor.builder(exporter).build())
.addSpanProcessor(BatchSpanProcessor.builder(spanExporter).build())
.build())
.build();
StorageOptions options = StorageOptions.newBuilder().setOpenTelemetry(openTelemetry).build();
Expand Down

0 comments on commit 6ed185b

Please sign in to comment.