MCPcopy Create free account
hub / github.com/apache/arrow / SetUp

Method SetUp

cpp/src/arrow/flight/flight_test.cc:99–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97class OtelEnvironment : public ::testing::Environment {
98 public:
99 void SetUp() override {
100// When running with OTel, ASAN reports false-positives that can't be easily suppressed.
101// Disable OTel for ASAN. See GH-46509.
102#if defined(ARROW_WITH_OPENTELEMETRY) && !defined(ADDRESS_SANITIZER)
103 // The default tracer always generates no-op spans which have no
104 // span/trace ID. Set up a different tracer. Note, this needs to be run
105 // before Arrow uses OTel as GetTracer() gets a tracer once and keeps it
106 // in a static. Also, arrow::Future may GetTracer(). So this has to be
107 // done as a Googletest environment, which runs before any tests.
108 std::vector<std::unique_ptr<opentelemetry::sdk::trace::SpanProcessor>> processors;
109 auto provider =
110 opentelemetry::nostd::shared_ptr<opentelemetry::sdk::trace::TracerProvider>(
111 new opentelemetry::sdk::trace::TracerProvider(std::move(processors)));
112 opentelemetry::trace::Provider::SetTracerProvider(std::move(provider));
113
114 opentelemetry::context::propagation::GlobalTextMapPropagator::SetGlobalPropagator(
115 opentelemetry::nostd::shared_ptr<
116 opentelemetry::context::propagation::TextMapPropagator>(
117 new opentelemetry::trace::propagation::HttpTraceContext()));
118#endif
119 }
120};
121
122static ::testing::Environment* kOtelEnvironment =

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected