megaease / easeagent-sdk-php
A Easeagent instrumentation for PHP
0.0.2
2023-03-29 08:11 UTC
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- monolog/monolog: ^1.23
- openzipkin/zipkin: ^3.0.0
- symfony/yaml: ^6.1
Requires (Dev)
- ext-mysqli: *
- jcchavezs/httptest: ~0.2
- middlewares/fast-route: ^2.0
- middlewares/request-handler: ^2.0
- nyholm/psr7: ^1.4
- phpspec/prophecy-phpunit: ^2.0
- phpstan/phpstan: ^0.12.26
- phpunit/phpunit: ~9
- psr/http-client: ^1.0
- psr/http-server-middleware: ^1.0
- squizlabs/php_codesniffer: 3.*
Suggests
- ext-mysqli: Allows to use mysqli instrumentation.
- psr/http-client: Allows to instrument HTTP clients following PSR18.
- psr/http-server-middleware: Allows to instrument HTTP servers via middlewares following PSR15.
This package is not auto-updated.
Last update: 2025-03-21 19:16:08 UTC
README
A lightweight & opening PHP SDK for Cloud-Native and APM system
Overview
- EaseAgent SDK can collect distributed application tracing, which could be used in the APM system and improve the observability of a distributed system. for the tracing, EaseAgent SDK follows the Google Dapper paper and use zipkin-php core library.
- EaseAgent SDK also can work with Cloud-Native architecture.
- EaseAgent SDK also can work with MegaEase Cloud. For example, it can monitor for service by PHP Docker APP.
Principles
- Safe to PHP application/service.
- Highly extensible, users can easily do extensions through the api
- Design for Micro-Service architecture, collecting the data from a service perspective.
Features
-
Easy to use. It is right out of the box for Http Server Tracing.
- Collecting Tracing Logs.
- Http Server
- Client
- Decorate the Span API for Middleware
- Collecting Tracing Logs.
-
Data Reports
- Console Reporter.
- Http Reporter.
-
Standardization
- The tracing data format is fully compatible with the Zipkin data format.
QuickStart
First production ready, simple and full Easeagent SDK implementation without dependencies.
1. Installing via Composer
easeagent-sdk-php can be installed via Composer:
$ composer require megaease/easeagent-sdk-php
2. Use
use Easeagent\AgentBuilder;
3. Init Agent
// new tracing agent from yaml file. // If you want to publish the `docker app` through the `cloud of megaease` and send the monitoring data to the `cloud`, // please obtain the configuration file path through the environment variable `EASEAGENT_CONFIG`. // We will pass it to you the `cloud configuration` file path. $agent = AgentBuilder::buildFromYaml(getenv('EASEAGENT_CONFIG'));//by default: Console Reporter
4. Server Span
$agent->serverReceive(function ($span) use ($agent) { echo "<p>Welcome to PHP</p>"; });
Documentation
Example
Obs. for a more complete router/frontend/backend example, check this repository
About MegaEase Cloud
- Use SDK in MegaEase Cloud
- Get MegaEase Cloud Config. About MegaEase Cloud Config
- Decorate the Span. please use api:
Agent.startMiddlewareSpan
for decorate Span.
Community
- Github Issues
- Join Slack Workspace for requirement, issue and development.
- MegaEase on Twitter
If you have any questions, welcome to discuss them in our community. Welcome to join!
Licenses
EaseAgent PHP SDK is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.