Welcome to TeiaCarePrometheus!
TeiaCarePrometheus is a C++ client library that implements the Prometheus Data Model.
This project uses git submodules so it is required to clone it using the --recursive flag in order to retrive the required submodules.
git clone https://github.com/TeiaCare/TeiaCarePrometheus.git --recursiveThis project relies on venvpp2 (included as the scripts submodule) to manage the development environment based on Conan v2 and CMake v4 with CMakePresets as first class citizens.
Run the venvpp2 setup script from the project root. It creates a .venv at the project root, pins CONAN_HOME to ./.conan2 and installs the Python requirements (Conan, CMake, Ninja, pre-commit, etc.).
# Linux/MacOS
scripts/scripts/env/setup.sh
# Windows
scripts\scripts\env\setup.batOn subsequent sessions just re-activate the virtual environment created above.
# Linux/MacOS
source .venv/bin/activate
# Windows
.venv\Scripts\activate.batWhen building from command line on Windows it is necessary to activate the Visual Studio Developer Command Prompt.
Depending on the version of Visual Studio compiler and on its install location it is required to run vcvars64.bat script the set the development environment properly.
Note: using Visual Studio IDE or the CMake extension for VSCode this step is already managed in the background, so no action is required.
Examples:
# Visual Studio 2022 - Build Tools
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
# Visual Studio 2019 - Enterprise
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"Configure the TeiaCare Artifactory remote to fetch 3rd party dependencies (only required for unit tests and examples).
conan remote add teiacare https://artifactory.app.teiacare.com/artifactory/api/conan/teiacare --index 0 --force
conan remote login teiacare <ARTIFACTORY_USERNAME> -p <ARTIFACTORY_PASSWORD>Install Conan packages and generate CMakePresets.json together with the CMake toolchain file. Pick the profile that matches your platform (available profiles are under scripts/profiles/): linux-clang, linux-gcc, macos-arm64, macos-x64, windows-msvc.
# Linux (clang) - Debug
conan install prometheus_client -b=missing -pr:a=scripts/profiles/linux-clang -s build_type=Debug
# Linux (gcc) - Release
conan install prometheus_client -b=missing -pr:a=scripts/profiles/linux-gcc -s build_type=Release
# Windows (msvc) - Release
conan install prometheus_client -b=missing -pr:a=scripts/profiles/windows-msvc -s build_type=ReleaseUse the CMake presets generated by Conan to configure, build and install the library.
# CMake configure
cmake --preset conan-debug
# CMake build
cmake --build build/Debug
# CMake install
cmake --install build/DebugReplace conan-debug / build/Debug with conan-release / build/Release when building the Release configuration.
# Run all the examples
python scripts/tools/run_examples.py install/examplesExamples are installed in $PWD/install/examples.
# Run Unit Tests
python scripts/tools/run_unit_tests.py <Debug|Release|RelWithDebInfo>
# Run Code Coverage
python scripts/tools/run_coverage.py <COMPILER_NAME> <COMPILER_VERSION> prometheus_clientNote that code coverage is not available on Windows.
Unit tests results are available in $PWD/results/unit_tests. Coverage results are available in $PWD/results/coverage.
# Run Unit Tests with Address Sanitizer
python scripts/tools/run_sanitizer.py --address_sanitizer install/unit_tests/teiacare_prometheus_client_unit_testsNote that Address Sanitizer is supported only on Linux.
# Run Unit Tests with Thread Sanitizer
python scripts/tools/run_sanitizer.py --thread_sanitizer install/unit_tests/teiacare_prometheus_client_unit_testsNote that Thread Sanitizer is supported only on Linux.