dqminh / jaeger-client-cpp

C++ OpenTracing binding for Jaeger

Home Page:https://jaegertracing.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Coverage Status Appveyor Build OpenTracing 1.0 Enabled

jaeger-client-cpp

C++ OpenTracing binding for Jaeger

Contributing

Please see CONTRIBUTING.md.

Building

jaeger-client-cpp is built using CMake. It will automatically download needed dependencies using Hunter.

To build:

    mkdir build
    cd build
    cmake ..
    make

After building, the example program can be run with:

    ./app ../examples/config.yml

To run tests:

    make test

To install the library:

    make install

Generated files

This project uses Apache Thrift for wire-format protocol support code generation. It currently requires Thrift 0.11.0.

The code can be re-generated with

    $ git submodule update --init
    $ find idl/thrift/ -type f -name \*.thrift -exec thrift -gen cpp -out src/jaegertracing/thrift-gen {} \;
    $ git apply scripts/thrift-gen.patch

Updating Agent Host and Port

The default host and port for Jaeger Agent is 127.0.0.1:6831. When the application and Jaeger Agent are running in different containers on the same host, the application's notion of localhost/127.0.0.1 it restriced to its own container, so in this case it's usually necessary to override the Agent's host/port by updating your reporter configuration:

YAML configuration:

repoter:
  localAgentHostPort: jaeger-agent:6831

NOTE: It is not recommended to use a remote host for UDP connections.

Connecting directly to the Collector

In case the client should connect directly to the collector instead of going through an agent, it's necessary update the reporter configuration

repoter:
  endpoint: http://${collectorhost}:${collectorport}/api/traces

Note that if both localAgentHostPort and endpoint are specified, the endpoint will be used.

Updating Sampling Server URL

The default sampling collector URL is http://127.0.0.1:5778/sampling. Similar to UDP address above, you can use a different URL by updating the sampler configuration.

sampler:
  samplingServerURL: http://jaeger-agent.local:5778

Configuration via Environment

It's possible to populate the tracer configuration from the environement variables by calling jaegertracing::Config::fromEnv.

The following property names are currently available:

Property Description
JAEGER_SERVICE_NAME The service name
JAEGER_DISABLED (not recommended) Instructs the Configuration to return a no-op tracer
JAEGER_AGENT_HOST The hostname for communicating with agent via UDP
JAEGER_AGENT_PORT The port for communicating with agent via UDP
JAEGER_ENDPOINT The traces endpoint, in case the client should connect directly to the Collector, like http://jaeger-collector:14268/api/traces
JAEGER_REPORTER_LOG_SPANS Whether the reporter should also log the spans
JAEGER_REPORTER_MAX_QUEUE_SIZE The reporter's maximum queue size
JAEGER_REPORTER_FLUSH_INTERVAL The reporter's flush interval (ms)
JAEGER_SAMPLER_TYPE The sampler type
JAEGER_SAMPLER_PARAM The sampler parameter (number)
JAEGER_SAMPLER_MANAGER_HOST_PORT The host name and port when using the remote controlled sampler
JAEGER_TAGS A comma separated list of name = value tracer level tags, which get added to all reported spans. The value can also refer to an environment variable using the format ${envVarName:default}, where the :default is optional, and identifies a value to be used if the environment variable cannot be found

License

Apache 2.0 License.

About

C++ OpenTracing binding for Jaeger

https://jaegertracing.io/

License:Apache License 2.0


Languages

Language:C++ 89.4%Language:CMake 8.8%Language:Python 1.1%Language:Shell 0.7%Language:Dockerfile 0.0%