GithubHelp home page GithubHelp logo

isabella232 / datadog-agent-six Goto Github PK

View Code? Open in Web Editor NEW

This project forked from datadog/datadog-agent-six

0.0 0.0 0.0 1.63 MB

Datadog Agent Python backend

License: Apache License 2.0

CMake 5.56% Go 25.03% C 30.55% C++ 37.78% Dockerfile 0.69% Python 0.39%

datadog-agent-six's Introduction

Datadog Agent Six

Build status CircleCI

CPython embedding/extending backend with support for multiple Python versions.

Concepts

Six is a C++ wrapper around the CPython API with a C89-compatible public API that can be used by foreing languages like Go. In order to provide support for multiple Python versions, Six fully abstracts Python in order to decouple client applications and CPython. Which Python version to use can be decided at runtime, Six will dlopen the proper backend libraries accordingly.

Architecture

libdatadog-agent-six

Six exposes its C89-compatible API through include/datadog_agent_six.h. By using the make2 and make3 functions, the corresponding Python backend will be loaded at runtime. Under the hood the library provides Six, a C++ interface that must be implemented by any supported backend, see include/six.h for details.

Two and Three

libdatadog-agent-three and libdatadog-agent-two libraries provide Python support for extending and embedding by linking different versions of the CPython library.

Common

The common folder contains C/C++ modules that are compiled into both libdatadog-agent-three and libdatadog-agent-two to avoid code duplication. Most of the code used to extend the embedded interpreter is there.

Requirements

  • C/C++ compiler
  • Python 2.7.x development packages
  • Python 3.7.x development packages
  • Cmake version 3.12 or above
  • Go compiler with cgo capabilities to run the tests

Build

Six can be built using CMake. Run the configurator/generator first:

cmake .

Then just run make to build the project.

Demo

Examples about how to use Six are provided in form of a C application under demo. The application expects to find a few things installed in the Python env. To easy development, a virtualenv can be used: the base check and the Directory check have to be installed before running the demo, if you have a local clone of integrations-core that should be a matter of pip install /path_to_integrations_core/datadog_checks_base and pip install /path_to_integrations_core/directory. Then depending on which Python version your virtualenv provides, run:

OSX:

DYLD_LIBRARY_PATH=./three:./two ./demo/demo 2 $VIRTUAL_ENV

Unix

LD_LIBRARY_PATH=./three:./two ./demo/demo 2 $VIRTUAL_ENV

or

OSX

DYLD_LIBRARY_PATH=./three:./two ./demo/demo 3 $VIRTUAL_ENV

Unix

LD_LIBRARY_PATH=./three:./two ./demo/demo 3 $VIRTUAL_ENV

Test

Tests are written in Golang using cgo, run the testsuite from the root folder:

make -C test

datadog-agent-six's People

Contributors

derekwbrown avatar hush-hush avatar masci avatar olivielpeau avatar silvanocerza 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.