PHP-Monitoring: On the Datadog come

Alex Alex 23 October 2019
PHP-Monitoring: On the Datadog come

The Datadog-APM solution has Recently, about the possibility of PHP-based environments to monitors. Thus, application developers and administrators to monitor distributed Traces from endpoint to endpoint, and so the complete system to health your PHP infrastructure in the keep an eye on.

The boundaries between Testing and operations are blurred are rapidly Developing. Software developers during the programming of the big picture, not just the application, but also their Interaction with the surrounding elements and systems in the view, make it the colleagues from the Ops team it is certainly easier. With a smart monitoring tool, such as Datadog, you can Services and Workflows from the first day to clean the race and thus subsequent performance bottlenecks or Errors in the current operation to prevent it.

we See, for example, the requirements for a monitoring solution for PHP. The PHP-logic, supports a wide range of different web servers, databases, and operating systems. Developers use Frameworks like Laravel, Symfony or Zend in order to realize scalable sites and applications with a large volume of Traffic. Datadog developed with "APM & distributed tracing for PHP" specifically for this area of application, a variant of its monitoring tools, the developers in the PHP environment, the Performance of the keep track of, identify bottlenecks and the User Experience can be optimized. And the both during operation as well as parallel to the development of applications. Development Teams benefit from the Datadog-Tracing function and can identify possible performance bottlenecks in Test and fix, before the application goes live.

Traces and Span

The timing within which operations between PHP-play based applications will be considered during the monitoring process as a linear unit, which is called a "Trace" – to translate, for example, with "tracking on track". Every single request to a required Service within this Trace is called "Span". The term describes the margin between request dispatch and Request acceptance by a Service. Datadog APM across provides functions for distributed Tracing all the execution paths of any request visible, even across the borders of different PHP-processes. Thus, the solution creates maximum transparency when it comes to the visibility of processes and Workflows between Services and applications. In addition, the recorded metrics for each Service each endpoint and each database request detailed Performance and evaluated. Everything that is necessary in order to send the monitored paths to Datadog, the Installation of the PHP extension by precompiled packages. The package can be installed with the command to install the PHP extension:

# using RPM package (RHEL/Centos 6+, Fedora 20+) $ rpm -ivh datadog-php-tracer.rpm # using DEB package (Debian Jessie+ , Ubuntu 14.04+) $ dpkg-i datadog-php-tracer.deb # using APK package (Alpine) $ apk add datadog-php-tracer.apk --allow-untrusted

After the reboot of PHP (PHP-FPM or Apache SAPI) can be called a tracing-enabled endpoint of the application. About the APM-user surface, the individual Traces are visible. The Tracing itself is carried out automatically according to the default settings. As soon as the PHP extension is installed, the application tracing using the Datadog Library ddtrace. Captured Traces are forwarded to the Datadog-agent.

instrumentation assumes the monitoring tool

A manual instrumentation is only necessary in rare cases. Datadog logs generic requests and generated for these generic Traces. As a result, the PHP-Monitoring can also be applied to Frameworks that are not officially supported by Datadog. Working with systems that work by default with Datadog, also has a lot of advantages: behind Datadog allows for a significantly greater number of meta-data that facilitates Navigation through the individual Services. The automated instrumentation works easily. You can modified well-known PHP-Runtime-methods and ensuring Monitoring of critical areas, as well as all known interfaces to other Services. PHP-Tracer supports automatic instrumentation for the libraries cURL and Guzzle 5.x, and 6.x. The Support of the Beanstalkd and ReactPHP is currently in preparation.

The automatic instrumentation recorded the following points:

  • the duration of methods designs
  • relevant Trace data, such as, for example, URL, and Status-Response code for Web Requests or database queries via SQL
  • unhandled exceptions, including stack traces (if available)
  • the total number of Traces (e.g., Web Requests), by the System

Datadog we calculated APM values, created Flame Graphs, and automatically generates a map of the existing Services and their mutual dependencies, Abb are visualized (. 1). The Service Map provides the basis to identify Performance problems and fix it as quickly as possible. Problems within a PHP environment can have different causes, for example, are 'blind' to working Code, redundant database queries, Memory Leaks (memory leaks) or bottlenecks within the system architecture. It is important that Datadog recognizes such a cause, and before it comes to serious problems on the user side. The proactive monitoring capabilities help to eliminate distinctive sources of error from the beginning.

Fig. 1: The Service Map visualizes query paths between Services

Fig. 1: The Service Map visualizes query paths between Services

car instrumented Frameworks and libraries

The Open-Source library for PHP-Tracing of large Frameworks such as Laravel, Zend and Symfony instrumented automatically, and also makes use of common libraries such as cURL, Guzzle, and PDO. It also supports Memcached, MongoDB and MySQL. In the future, also the Integration with WordPress, Magento, Drupal, DynamoDB, RabbitMQ, Doctrine ORM, and numerous other systems will be possible. In addition to the automatic inclusion of PHP Code, it is also possible for manual Tracing settings. As well as becoming a PHP application is built, your performance indicators, with minimal configuration effort to optimize. The PHP-Tracing library for Datadog includes, among other things, the open tracing API, and uses it in a targeted manner. The great advantage of the open tracing interface: Traces can be viewed, without Vendor-specific Code is required.

Service Map

The Service Map visualizes the Services of individual components and the request paths between these components (Fig. 1 and 2). Since the map is generated automatically based on the APM data collected, a direct access without additional configurations are possible. This is in particular very useful, since dependencies based applications will be so in the overall context of complex, micro-services-visible. The Service Map helps to understand the complexity of an application architecture: The correlations between individual Services can be recognized at a glance. Specific processes, Workflows, Logs, and the underlying structure of individual Services can be observed down to the deepest Detail and checked. So a good starting point is to investigate problems and resolve relatively quickly.

Fig. 2: The Service Map provides detailed insights into individual Workflows

Fig. 2: The Service Map provides detailed insights into individual Workflows

The PHP-optimizing Performance

in addition to the Service Map provides Datadog APM a number of functions, with which the Performance of PHP-analyze applications and visualize it. On the surface of a Datadog account is an Overview of General performance metrics such as latency, distribution, data flow, or disorders of the System-Services is first of all to see. In addition, Chip-Level statistics, as well as irregularities in the distribution of resources can be viewed. Of the highest monitoring level, system analysts and administrators are able to detect whether your System is healthy, and what Services, problems could arise. the figure 3 shows how this High-Level views of all system can look like building blocks. The graphs on the left side to cause the number of Service requests and Errors over a given time course. In the diagrams the right side of the time course of the latency distribution is shown above; the lower visualisation tells you how much time a certain Service was followed by a period of post Requests was busy (for example, curl and pdo).

Fig. 3: The graphs visualize the total requests, and correlating latency

Fig. 3: The graphs visualize the total requests, and correlating latency

Watchdog identified deviations

the Watchdog is an algorithmic Feature that automatically identifies potential application and infrastructure problems. The Tool observed trends and patterns in the measured values of the application monitoring. From indicators such as the frequency of errors, the request rate or the recorded latency and recognizes Watchdog Deviate predicts the system behavior. The monitoring algorithm evaluates all Services and resources. The configuration of a separate control routine for each Service is not required.

International PHP Conference

Developer – the lost guide

by Stefan Priebsch (

My browser does what?

by Joel Lord (Red hat OpenShift)

By Clicking on an endpoint in the Service Overview page of the Datadog user interface is the Chip-Level statistics can be shown. This will be easy to recognize which function or which Service generates the largest latency per request. The Datadog-Dashboard with Overview of all Services displays a list of all the irregularities that were identified by the Watchdog. Watchdog observed and recorded completely Autonomous performance anomalies in all PHP applications – even if no Alerts have been defined. Watchdog should be noted, for example, an unusual change in the latency of a particular resource, you will see a history that lists the Details of the deviation and a more detailed investigation allowed.

Trace-tracking and Flame graphs

With Flame graphs request paths on your complete way by means of distributed Services to understand. The Service requests of the applications are visualized in Detail. Thus, the correlating can be in these special diagrams fast reactions, the Services recognize and whether this slows down or errors have been made. If the API-call to a PHP application is running into a Void, or a database query is slow, helps graphs of clicking on a particular Chip line within one Flame, the cause for such delays to find out.

in Addition to the time and Latency is the Flame-Graph in addition, the Details of each Service call that is involved in the processing of a request. In figure 4 of the neck from an area within the Flame-graphs, to see, to see in which a defective Chip with a rejected 503 Response is. On Clicking this Spans its meta data will be visible, which includes both the error message and the Trace-tracking of individual Stacks. So, it can be reconstructed in the case of an application failure, the call cascade, which has led to a specific Problem. Application developers can capture additional metadata, which will then be listed here.

Fig. 4: Flame graph of request paths clearly visualize

Fig. 4: Flame graph of query paths clearly visualize

Related Traces and Logs

On the Datadog-surface type additional navigation Tabs for further information on specific Traces. So, for example, in Host Info to set the Option, the Performance of Services in correlation to the underlying infrastructure. Under Errors all the error messages are aggregated. Behind the Tab Logs a function that displays all available Logs of the monitored Services is hidden. This comparison is option especially useful, since it saves on time-consuming log analysis. and directly to the core of an application problem leads. The linking of Logs and Traces, with trace_id returns for each negative deviation in the User Experience a quick response. The three main features of Datadog (Logs, infrastructure, and APM) are composed to form an overall picture of the application.

The exchange from the application to the customer's perspective

applications can send data continuously to the performance management tool of Datadog. Therefore, it is possible to use APM Trace Search & Analytics, to find all the Traces and to present for a specific analysis scenario makes sense. Yes, it is possible to filter Traces according to specific key words and aspects such as Host, environment, customer number, or the required period of time for compliance with a request. In the example of figure 5 the Filter is set to "Status Code". This individual Traces should be isolated from a specific Service and, ultimately, more accurate information to a specific 500 error message from an application obtained.

Fig. 5: Datadog APM Trace Search & Analytics has various filter functions

Fig. 5: Datadog APM Trace Search & Analytics has a variety of filter functions

All Tags that have been associated with an application or infrastructure, are automatically applied to the corresponding Traces, and are thus in the Trace-Search& Analytics interface configurable. This also includes the way the Tags that were automatically taken over by cloud providers. For an analysis of the desired Filter are called, can be visualized in the Trace-information on the button Analytics given as a time series. In addition, it is possible, samples are sorted according to users ' or to identify the Version of the application performance. In figure 6 the average latency over all the service per Customer is listed (org_id). As the graph shows, it does represent a Trace Search, the Performance in each Dimension with high cardinality in a comprehensible manner. After Troubleshooting with Trace Search user can define a monitoring sequence, to alert team members in the event of the recurrence of Errors via Slack, pagerduty, or with any other collaboration tool. All images were created with Trace Analytics, can easily be used in other Dashboards to be exported.

Fig. 6: The Graph illustrates latency per Customer

Fig. 6: The Graph illustrates latency per Customer

Flexible Dashboards for the combination of App Performance, infrastructure, and Logs

With more than 250 integrations, the Datadog offers, can be realized the Monitoring for each Layer of a PHP Service quickly. This includes web server such as NGINX or Apache and databases such as MySQL, PostgresSQL or MongoDB. With the above-mentioned integrations, the IT Team PHP can be monitored based web applications in the context of LAMP or LEMP stack. The example dashboard in figure 7 shows the infrastructure indicators, and APM metrics next to graph of the associated applications. Such a Dashboard allows you to view the latency of Services in correlation with the utilization of the host system, the web server or the database. With all this information at-a-glance Monitoring of the data on all components of the application stack is easily possible. Experts in addition to each monitored component further readings and Drill-down options.

Fig. 7: In the Dashboard correlations between Service-latency, Host load, Web servers, and databases will be visible

Fig. 7: In the Dashboard correlations between Service-latency, Host-utilisation, Web published servers and databases visible

PHP magazine

developer magazineThis article is PHP Magazin. The PHP magazine covers a wide range of topics that are essential for the successful web development is essential.

of Course you can, the PHP magazine, the developers.kiosk digital in the Browser or on their Android and iOS Devices read. In our Shop the developers magazine is also in the subscription or single issue available.


Comments (0)

    No comments yet

You must be logged in to comment.