Documentation for tracelibcpp

Change-Id: Idcfa5e514525c8ef3a6be5c5d34ace5f14b8c95f
Signed-off-by: wahidw <abdulwahid.w@nokia.com>
2 files changed
tree: 425e84d6155956cbb5876b9d3dbee1464e413f83
  1. ci/
  2. cmake/
  3. docs/
  4. include/
  5. releases/
  6. src/
  7. tst/
  8. .gitignore
  9. .gitreview
  10. .readthedocs.yaml
  11. CMakeLists.txt
  12. INFO.yaml
  13. LICENSES.txt
  14. README.md
  15. tox.ini
README.md

RIC tracing helper library

The library includes a function for creating a configured tracer instance. It hides the underlaying tracer implementation from the application.

Usage

Create a global tracer

    #include <opentracing/tracer.h>
    #include <tracelibcpp/tracelibcpp.hpp>

    opentracing::Tracer::InitGlobal(tracelibcpp::createTracer("my-service-name"));

Span context propagation between different software components in RIC is using a TextMap carrier and JSON format serialization. The opentracing C++ Readme gives examples how span context inject and extract with textmap can be done. Serialization to JSON can be done with any JSON library.

Configuration

The trace library currently supports only Jaeger C++ client tracer implementation. The configuration is done using environment variables:

environment variablevaluesdefault
TRACING_ENABLED1, true, 0, falsefalse
TRACING_JAEGER_SAMPLER_TYPEconst, propabilistic, ratelimitingconst
TRACING_JAEGER_SAMPLER_PARAMfloat0.001
TRACING_JAEGER_AGENT_ADDRIP addr + port127.0.0.1:6831
TRACING_JAEGER_LOG_LEVELall, error, nonenone

Meaning of the configuration variables is described in Jaeger web pages. By default a no-op tracer is created.

Requires

cmake gcc/c++ opentracing-cpp version 1.5.0

Build

mkdir build cd build cmake .. make

Unit testing

To run unit tests the project needs to be configured with testing option cmake -DWITH_TESTING=ON .. make check Or with output CTEST_OUTPUT_ON_FAILURE=1 make check

Coverage

Unit testing generates also coverage data. To get that in html format run commands, assuming you are building in build dir under the tracelibcpp

lcov -c --no-external --base-directory $(dirname $PWD)  --directory . --output-file cov.info
genhtml cov.info

Binary package support

Binary packages of the libary can be created with make package target, or with the Dockerfile in the ci directory.

The Docker build executes unit tests and compiles binary packages which can then be exported from the container by running it and giving the target directory as a command line argument. The target directory must mounted to the container.

# Build the container
docker build -t tracelibcpp -f ci/Dockerfile .
# Export binary packages to /tmp
docker run -v /tmp:/tmp tracelibcpp /tmp

License

See LICENSES.txt file.