summaryrefslogtreecommitdiffstats
path: root/include/opentracing/noop.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:44:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:44:33 +0000
commitb196c6498d22e47bb9d0da0153068ec54eac7956 (patch)
tree1a994a492581e93224a7ee6455f5d4e9d2ec8e59 /include/opentracing/noop.h
parentInitial commit. (diff)
downloadopentracing-cpp-b196c6498d22e47bb9d0da0153068ec54eac7956.tar.xz
opentracing-cpp-b196c6498d22e47bb9d0da0153068ec54eac7956.zip
Adding upstream version 1.6.0.upstream/1.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--include/opentracing/noop.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/opentracing/noop.h b/include/opentracing/noop.h
new file mode 100644
index 0000000..5313489
--- /dev/null
+++ b/include/opentracing/noop.h
@@ -0,0 +1,28 @@
+#ifndef OPENTRACING_NOOP_H
+#define OPENTRACING_NOOP_H
+
+#include <opentracing/symbols.h>
+#include <opentracing/tracer.h>
+#include <opentracing/version.h>
+#include <memory>
+
+namespace opentracing {
+BEGIN_OPENTRACING_ABI_NAMESPACE
+// A NoopTracer is a trivial, minimum overhead implementation of Tracer
+// for which all operations are no-ops.
+//
+// The primary use of this implementation is in libraries, such as RPC
+// frameworks, that make tracing an optional feature controlled by the
+// end user. A no-op implementation allows said libraries to use it
+// as the default Tracer and to write instrumentation that does
+// not need to keep checking if the tracer instance is nil.
+//
+// For the same reason, the NoopTracer is the default "global" tracer
+// (see Tracer::Global and Tracer::InitGlobal functions).
+//
+// WARNING: NoopTracer does not support baggage propagation.
+OPENTRACING_API std::shared_ptr<Tracer> MakeNoopTracer() noexcept;
+END_OPENTRACING_ABI_NAMESPACE
+} // namespace opentracing
+
+#endif // OPENTRACING_NOOP_H