Giter VIP home page Giter VIP logo

lttng-consume's Introduction

Build Status

lttng-consume

lttng-consume is a helper library that allows realtime consumption of LTTNG traces through the JsonBuilder interface.

Examples

Consuming LTTNG events via lttng-consume

void RunConsumerTraceLogging(LttngConsume::LttngConsumer& consumer)
{
    consumer.StartConsuming([](JsonBuilder&& jsonBuilder) {
        JsonRenderer renderer;
        renderer.Pretty(true);

        std::string_view jsonString = renderer.Render(jsonBuilder);
        std::cout << jsonString << std::endl;
    });
}

void RunSample()
{
    constexpr auto hostName = "<host name goes here>";
    constexpr auto sessionName = "<lttng session name goes here>";

    std::string connectionString = "net://localhost/host/";
    connectionString += hostName;
    connectionString += "/";
    connectionString += sessionName;

    std::chrono::milliseconds pollInterval(50);

    LttngConsume::LttngConsumer consumer{ connectionString,
                                          pollInterval };

    std::thread consumptionThread{ RunConsumerTraceLogging,
                                   std::ref(consumer) };

    // Emit events here, wait, etc.

    consumer.StopConsuming();
    consumptionThread.join();
}

Dependencies

This project carries on the following libraries:

  1. JsonBuilder
  2. uuid
  3. babeltrace2 (Tested against 2.0.0 release)

Number 1 can be gotten at the URL above and Number 2 is available via apt:

sudo apt install uuid-dev

For #3, there is no package release, so it needs to be built from source. There are large breaking changes across different pre-release versions here. lttng-consume currently build against the v2.0.0-pre5 tag:

git clone -b v2.0.0-pre5 https://github.com/efficios/babeltrace/
sudo apt install autoconf autoheader libtool flex bison libglib2.0-dev libpopt-dev
./bootstrap
./configure --disable-debug-info --disable-man-pages --prefix=~/install/babeltrace
make
make install

Integration

lttng-consume builds as a static or shared library and requires C++11. The project creates a CMake compatible 'lttng-consume' target which you can use for linking against the library.

  1. Add this project as a subdirectory in your project, either as a git submodule or copying the code directly.
  2. Add that directory to your top-level CMakeLists.txt with 'add_subdirectory'. This will make the target 'lttng-consume' available.
  3. Add the 'lttng-consume' target to the target_link_libraries of any target that will use lttng-consume.

Reporting Security Issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at <[email protected]>. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct.

For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Contributing

Want to contribute? The team encourages community feedback and contributions. Please follow our contributing guidelines.

We also welcome issues submitted on GitHub.

Project Status

This project is currently in active development.

Contact

The easiest way to contact us is via the Issues page.

lttng-consume's People

Contributors

nickbopp avatar jsmrcina avatar bfulper avatar microsoftopensource avatar aholeinmyhead avatar msftgits avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.