diff --git a/CMakeLists.txt b/CMakeLists.txt index ee6dcbe3802..9fbfc1c059c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,9 +23,9 @@ include(CTest) find_package(Threads) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - # Options for Visual C++ compiler: - # /Zc:__cplusplus - report an updated value for recent C++ language standards. - # Without this option MSVC returns the value of __cplusplus="199711L" + # Options for Visual C++ compiler: /Zc:__cplusplus - report an updated value + # for recent C++ language standards. Without this option MSVC returns the + # value of __cplusplus="199711L" set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus") endif() diff --git a/examples/simple/README.md b/examples/simple/README.md new file mode 100644 index 00000000000..d59a1423cd5 --- /dev/null +++ b/examples/simple/README.md @@ -0,0 +1,10 @@ + +# Simple Trace Example + +In this example, the application in `main.cc` initializes and registers a tracer +provider from the [OpenTelemetry SDK](https://github.com/open-telemetry/opentelemetry-cpp). +The application then calls a `foo_library` which has been instrumented using +the [OpenTelemetry API](https://github.com/open-telemetry/opentelemetry-cpp/tree/master/api). +Resulting telemetry is directed to stdout through a custom exporter. + +See [CONTRIBUTING.md](../../CONTRIBUTING.md) for instructions on building and running the example. \ No newline at end of file diff --git a/examples/simple/main.cc b/examples/simple/main.cc index af03d2e6db0..756c764e899 100644 --- a/examples/simple/main.cc +++ b/examples/simple/main.cc @@ -15,14 +15,14 @@ void initTracer() auto processor = std::shared_ptr( new sdktrace::SimpleSpanProcessor(std::move(exporter))); auto provider = nostd::shared_ptr(new sdktrace::TracerProvider(processor)); + // Set the global trace provider trace::Provider::SetTracerProvider(provider); } } // namespace int main() { - // Removing this line will leave OT initialized with the default noop - // tracer, thus being effectively deactivated. + // Removing this line will leave the default noop TracerProvider in place. initTracer(); foo_library();