Skip to content

ananyaarun/Jaeger-Tracing

Repository files navigation

Jaeger client examples in C++

This repo has example projects as a proof of concept for tracing of modules written in C++ using jaeger. In order to instrument the program with jaeger and run it, we need the various jaeger dependencies made available. We also need the jaeger backend setup and running to see the traces on the jaeger UI.

A few examples I forked and built to visualize Traces can be found here:

The jaeger backend

We setup and run the all-in-one jaeger docker image (https://www.jaegertracing.io/docs/1.6/getting-started/)

  docker run -d --name jaeger \
  -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 \
  -p 5775:5775/udp \
  -p 6831:6831/udp \
  -p 6832:6832/udp \
  -p 5778:5778 \
  -p 16686:16686 \
  -p 14268:14268 \
  -p 9411:9411 \
  jaegertracing/all-in-one:1.6

This makes available the jaeger backend on standard ports. In particular the jaeger UI is available at https://localhost:16686

Quicksort

This program traces the quicksort algorithm and its helper functions like partitioning the array and swapping

To build:

    mkdir build
    cd build
    cmake ..
    make

After building, the quicksort program can be run with:

    ./app ../examples/config.yml

The traces show 3 spans: quicksort, partition, and swap

quicksort1

quicksort2

Socket programming

This program implements a client and server and interprocess communication using sockets. Since this is a distributed program, we need to implement distributed tracing. This is done using Inject and Extract operations which transmit the span context across process boundaries.

To build:

    mkdir build
    cd build
    cmake ..
    make

The Server and Client need to be started on different terminals. The Server needs to be started before the Client.

After building, the Server program can be run with:

    ./server ../examples/config.yml

The Client program can be run with:

    ./client

Some screenshots of traces seen

socket1

socket2

NOTE : Building of the repository needs to be done just once after which Traces of both quicksort program and socket programming can be seen in Jaeger UI under sorting-service and socketservice respectively.

About

Example projects as a proof of concept for tracing of modules written in C++ using jaeger UI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published