lidavidm commented on a change in pull request #10260:
URL: https://github.com/apache/arrow/pull/10260#discussion_r738754458



##########
File path: cpp/src/arrow/util/tracing_internal.cc
##########
@@ -0,0 +1,252 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "arrow/util/tracing_internal.h"
+
+#include <iostream>
+#include <sstream>
+#include <thread>
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4522)
+#endif
+#ifdef ARROW_WITH_OPENTELEMETRY
+#include <opentelemetry/sdk/trace/batch_span_processor.h>
+#include <opentelemetry/sdk/trace/recordable.h>
+#include <opentelemetry/sdk/trace/span_data.h>
+#include <opentelemetry/sdk/trace/tracer_provider.h>
+#include <opentelemetry/trace/noop.h>
+#include <opentelemetry/trace/provider.h>
+#endif
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+#include "arrow/util/config.h"
+#include "arrow/util/io_util.h"
+#include "arrow/util/logging.h"
+#include "arrow/util/make_unique.h"
+#ifdef ARROW_JSON
+#include "arrow/json/rapidjson_defs.h"
+#include "rapidjson/ostreamwrapper.h"
+#include "rapidjson/writer.h"
+#endif
+
+namespace arrow {
+namespace internal {
+namespace tracing {
+
+namespace nostd = opentelemetry::nostd;
+namespace otel = opentelemetry;
+
+constexpr char kTracingBackendEnvVar[] = "ARROW_TRACING_BACKEND";
+
+namespace {
+
+#ifdef ARROW_WITH_OPENTELEMETRY
+namespace sdktrace = opentelemetry::sdk::trace;
+#ifdef ARROW_JSON
+struct OwnedAttributeValueVisitor {
+  OwnedAttributeValueVisitor(
+      arrow::rapidjson::Writer<arrow::rapidjson::OStreamWrapper>& writer_)
+      : writer(writer_) {}
+
+  void operator()(const std::string& arg) { writer.String(arg); }
+
+  void operator()(const int32_t& arg) { writer.Int(arg); }
+
+  void operator()(const uint32_t& arg) { writer.Uint(arg); }
+
+  void operator()(const int64_t& arg) { writer.Int64(arg); }
+
+  void operator()(const uint64_t& arg) { writer.Uint64(arg); }
+
+  template <typename T>
+  void operator()(T&& arg) {
+    writer.Null();
+  }
+
+  arrow::rapidjson::Writer<arrow::rapidjson::OStreamWrapper>& writer;
+};
+
+/// Export spans as newline-delimited JSON.
+class OStreamJsonSpanExporter : public sdktrace::SpanExporter {

Review comment:
       I would guess that most Python libraries with exporters would be using 
the Python library, but yeah - we should ship Arrow without the exporter by 
default. (I think it should be possible to eventually ship a second package 
with only the exporters, perhaps? At least on Conda, maybe not as a wheel.)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to