A realtime consumer of LTTNG traces via the BabelTrace framework
Перейти к файлу
microsoft-github-policy-service[bot] 8846cbadc7
Microsoft mandatory file (#28)
Co-authored-by: microsoft-github-policy-service[bot] <77245923+microsoft-github-policy-service[bot]@users.noreply.github.com>
2023-06-12 12:04:37 -07:00
cmake/modules Improve dependencies and install (#22) 2020-01-30 14:19:55 -08:00
external Improve dependencies and install (#22) 2020-01-30 14:19:55 -08:00
include/lttng-consume Improve dependencies and install (#22) 2020-01-30 14:19:55 -08:00
src Fix missing include (#27) 2020-10-25 22:01:57 -07:00
test Improve dependencies and install (#22) 2020-01-30 14:19:55 -08:00
.clang-format Initial port 2019-04-30 18:03:39 -07:00
.gitignore Initial port 2019-04-30 18:03:39 -07:00
.gitmodules Improve dependencies and install (#22) 2020-01-30 14:19:55 -08:00
CMakeLists.txt Update CMakeLists.txt 2020-02-12 13:24:31 -08:00
CONTRIBUTING.md More OSS work (#13) 2019-05-28 10:42:38 -07:00
LICENSE Fix line endings (#26) 2020-03-02 13:15:32 -08:00
README.md Fix line endings (#26) 2020-03-02 13:15:32 -08:00
SECURITY.md Microsoft mandatory file (#28) 2023-06-12 12:04:37 -07:00
azure-pipelines.yml Update to babeltrace v2.0.0 (#21) 2020-01-23 17:16:58 -08:00

README.md

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 <secure@microsoft.com>. 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 opencode@microsoft.com 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.