| 146 | } |
| 147 | |
| 148 | std::unique_ptr<otel::sdk::logs::LogRecordExporter> MakeExporterFromEnv( |
| 149 | const OtelLogExporterOptions& exporter_options) { |
| 150 | auto maybe_env_var = arrow::internal::GetEnvVar(kLoggingBackendEnvVar); |
| 151 | if (maybe_env_var.ok()) { |
| 152 | auto env_var = maybe_env_var.ValueOrDie(); |
| 153 | auto* default_ostream = |
| 154 | exporter_options.default_stream ? exporter_options.default_stream : &std::cerr; |
| 155 | if (env_var == "ostream") { |
| 156 | // TODO: Currently disabled as the log records returned by otel's ostream exporter |
| 157 | // don't maintain copies of their attributes, leading to lifetime issues. If/when |
| 158 | // this is addressed, we can enable it. See: |
| 159 | // https://github.com/open-telemetry/opentelemetry-cpp/issues/2402 |
| 160 | #if 0 |
| 161 | return MakeExporter(ExporterKind::OSTREAM, default_ostream); |
| 162 | #else |
| 163 | ARROW_LOG(WARNING) << "Requested unimplemented backend " << kLoggingBackendEnvVar |
| 164 | << "=" << env_var << ". Falling back to arrow_otlp_ostream"; |
| 165 | return MakeExporter(ExporterKind::OTLP_OSTREAM, default_ostream); |
| 166 | #endif |
| 167 | } else if (env_var == "otlp_http") { |
| 168 | return MakeExporter(ExporterKind::OTLP_HTTP); |
| 169 | } else if (env_var == "arrow_otlp_stdout") { |
| 170 | return MakeExporter(ExporterKind::OTLP_OSTREAM, &std::cout); |
| 171 | } else if (env_var == "arrow_otlp_stderr") { |
| 172 | return MakeExporter(ExporterKind::OTLP_OSTREAM, &std::cerr); |
| 173 | } else if (env_var == "arrow_otlp_ostream") { |
| 174 | return MakeExporter(ExporterKind::OTLP_OSTREAM, default_ostream); |
| 175 | } else if (!env_var.empty()) { |
| 176 | ARROW_LOG(WARNING) << "Requested unknown backend " << kLoggingBackendEnvVar << "=" |
| 177 | << env_var; |
| 178 | } |
| 179 | } |
| 180 | return nullptr; |
| 181 | } |
| 182 | |
| 183 | std::unique_ptr<otel::sdk::logs::LogRecordProcessor> MakeLogRecordProcessor( |
| 184 | std::unique_ptr<otel::sdk::logs::LogRecordExporter> exporter) { |
no test coverage detected