Giter Site home page Giter Site logo

dd-prof-php's Introduction

Datadog Continuous Profiler for PHP

The Datadog PHP profiler is a Zend Extension for PHP 7.1+. Debug and ZTS builds are not currently supported.

Supported platforms (all x86-64):

  • CentOS 7+ GNU/Linux. This works for most glibc based Linux versions that have glibc 2.17 or newer.
  • Alpine 3.13+ with musl.

Additionally, it has been developed and tested on MacOS Big Sur (11.6).

The plan for this code is to be eventually merged into Datadog/dd-trace-php.

Installing

See enabling the profiler.

Configuring

The profiler uses these environment variables. If the tracer is already set up, then you may not need to adjust any of them:

  • DD_PROFILING_ENABLED: defaults to false.
  • DD_PROFILING_LOG_LEVEL: defaults to off. Acceptable values are off, error, warn, info, and debug. Log message are printed to stderr, not to the PHP error_log.
  • DD_PROFILING_EXPERIMENTAL_CPU_TIME_ENABLED: defaults to false, as it is experimental. It has low overhead, but is biased towards functions that do I/O.
  • DD_ENV: defaults to the empty string.
  • DD_SERVICE: defaults to the empty string. If not set, this will become unnamed-php-service in the Datadog UI.
  • DD_VERSION: defaults to the empty string.
  • DD_AGENT_HOST: defaults to localhost.
  • DD_TRACE_AGENT_PORT: defaults to 8126.
  • DD_TRACE_AGENT_URL: defaults to the empty string. If set, this will override DD_AGENT_HOST and DD_TRACE_AGENT_PORT.

Building From Source

For people who really want to build from source, like other Datadog Engineers, you will need:

  • CMake 3.19 or newer to generate the build
  • Make or Ninja
  • C11 compiler
  • pkg-config
  • PHP 7.1+
  • libuv (todo: min version?) and its headers
  • libddprof v0.6 for your platform. This is a Rust library, so I recommend using the pre-built artifacts available at Datadog/libddprof so you don't need a Rust toolchain.

Here's an example of how to build it, based on my own development machine:

# Set up environment so cmake can find libuv and libddprof
LIBUV_ROOT="$(readlink -e $(brew --prefix libuv))"
export DDProf_ROOT="/opt/libddprof"

export PKG_CONFIG_PATH="$(find ${LIBUV_ROOT?} -name pkgconfig -type d):$PKG_CONFIG_PATH"

# Build profiler in Release configuration
cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -G Ninja
cmake --build cmake-build-release

# Run diagnostics
DD_PROFILING_ENABLED=yes php \
    -dzend_extension=cmake-build-release/datadog-profiling.so \
    --ri datadog-profiling

# Optional: Install the profiler
export PHP_INI_DIR="$(php-config --ini-dir)"
export PHP_EXTENSION_DIR="$(php-config --extension-dir)"
cp -v cmake-build-release/datadog-profiling.so "${PHP_EXTENSION_DIR?}/"
echo 'zend_extension = datadog-profiling.so' > "${PHP_INI_DIR?}/datadog-profiling.ini"

dd-prof-php's People

Contributors

dbenamydd avatar morrisonlevi avatar r1viollet avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ganeshkumarsv

dd-prof-php's Issues

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.