2 .. Copyright (c) 2019 AT&T Intellectual Property.
\r
4 .. Copyright (c) 2019 Nokia.
\r
7 .. Licensed under the Creative Commons Attribution 4.0 International
\r
9 .. Public License (the "License"); you may not use this file except
\r
11 .. in compliance with the License. You may obtain a copy of the License at
\r
14 .. https://creativecommons.org/licenses/by/4.0/
\r
17 .. Unless required by applicable law or agreed to in writing, documentation
\r
19 .. distributed under the License is distributed on an "AS IS" BASIS,
\r
21 .. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
23 .. See the License for the specific language governing permissions and
\r
25 .. limitations under the License.
\r
27 .. This source code is part of the near-RT RIC (RAN Intelligent Controller)
\r
28 .. platform project (RICP).
\r
33 The library includes a function for creating a configured tracer instance.
\r
34 It hides the underlaying tracer implementation from the application.
\r
41 git clone "https://gerrit.o-ran-sc.org/r/ric-plt/tracelibcpp"
\r
46 Create a global tracer
\r
50 #include <opentracing/tracer.h>
\r
51 #include <tracelibcpp/tracelibcpp.hpp>
\r
53 opentracing::Tracer::InitGlobal(tracelibcpp::createTracer("my-service-name"));
\r
55 Span context propagation between different software components in RIC is using a TextMap carrier and JSON format serialization. The [opentracing C++](https://github.com/opentracing/opentracing-cpp) Readme gives examples
\r
56 how span context **inject** and **extract** with textmap can be done.
\r
57 Serialization to JSON can be done with any JSON library.
\r
62 The trace library currently supports only [Jaeger](https://www.jaegertracing.io/) [C++ client](https://github.com/jaegertracing/jaeger-client-cpp) tracer implementation.
\r
63 The configuration is done using environment variables:
\r
66 +------------------------------+-------------------------------------+----------------+
\r
67 | **environment variable** | **values** | **default** |
\r
69 +------------------------------+-------------------------------------+----------------+
\r
70 | TRACING_ENABLED | 1, true, 0, false | false |
\r
72 +------------------------------+-------------------------------------+----------------+
\r
73 | TRACING_JAEGER_SAMPLER_TYPE | const, propabilistic, ratelimiting | const |
\r
75 +------------------------------+-------------------------------------+----------------+
\r
76 | TRACING_JAEGER_SAMPLER_PARAM | float | 0.001 |
\r
78 +------------------------------+-------------------------------------+----------------+
\r
79 | TRACING_JAEGER_AGENT_ADDR | IP addr + port | 127.0.0.1:6831 |
\r
81 +------------------------------+-------------------------------------+----------------+
\r
82 | TRACING_JAEGER_LOG_LEVEL | all, error, none | none |
\r
84 +------------------------------+-------------------------------------+----------------+
\r
86 Meaning of the configuration variables is described in Jaeger web pages.
\r
87 By default a no-op tracer is created.
\r
94 * opentracing-cpp version 1.5.0
\r
108 To run unit tests the project needs to be configured with testing option
\r
112 cmake -DWITH_TESTING=ON ..
\r
119 CTEST_OUTPUT_ON_FAILURE=1 make check
\r
125 Unit testing generates also coverage data. To get that in html format run commands, assuming
\r
126 you are building in `build` dir under the tracelibcpp
\r
130 lcov -c --no-external --base-directory $(dirname $PWD) --directory . --output-file cov.info
\r
133 Binary package support
\r
134 ----------------------
\r
135 Binary packages of the libary can be created with `make package` target, or with
\r
136 the Dockerfile in the `ci` directory.
\r
138 The Docker build executes unit tests and compiles binary packages which can then be
\r
139 exported from the container by running it and giving the target directory as a command line
\r
140 argument. The target directory must mounted to the container.
\r
144 docker build -t tracelibcpp -f ci/Dockerfile .
\r
145 # Export binary packages to /tmp
\r
146 docker run -v /tmp:/tmp tracelibcpp /tmp
\r