chq81/elastic-apm-bundle
Composer 安装命令:
composer require chq81/elastic-apm-bundle
包简介
Elastic APM bundle
关键字:
README 文档
README
This package is a continuation of the excellent work done by goksagun at goksagun/elastic-apm-bundle.
Installation
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
$ composer require chq81/elastic-apm-bundle
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require chq81/elastic-apm-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = [ // ... new Chq81\ElasticApmBundle\ElasticApmBundle(), ]; // ... } // ... }
Step 3: Add the Bundle config file
Then, add the bundle configuration yml file elastic_apm.yml into
config/packages directory:
elastic_apm: enabled: true # Activate the APM Agent, default is true serviceName: 'Symfony APM App' # The name of your service, required serverUrl: 'http://localhost:8200' # The URL for your APM service, required The URL must be fully qualified, including the protocol and port. secretToken: null # The secret token required to send data to your APM service environment: dev # The environment of your service
Configuration
The following configurations options are provided:
| Option | Default | Example Value(s) | Mandatory | Description |
|---|---|---|---|---|
| enabled | true | true, false | yes | Activating the APM Agent |
| serviceName | "Symfony APM Service" | yes | The name of your service | |
| serverUrl | null | "http://localhost:8200" | yes | The URL for your APM service. The URL must be fully qualified, including the protocol and port. |
| secretToken | null | "SOME_TOKEN" | no | The secret token required to send data to your APM service |
| serviceVersion | null | 1.0 | no | The version of your deployed service |
| frameworkName | null | "Symfony" | no | The name of the application framework |
| frameworkVersion | null | "5.1.7", !php/const App\Kernel::VERSION | no | The version of the application framework |
| environment | null | "dev", '%kernel.environment%' | no | The environment where your service is running |
| hostname | null | "local-hostname" | no | The OS hostname on which the agent is running |
| env | [] | ['DOCUMENT_ROOT', 'REMOTE_ADDR', 'REMOTE_USER'] | no | $_SERVER vars to send to the APM Server. Keys are case sensitive |
| cookies | [] | ['my-cookie'] | no | Cookies to send to the APM Server. Keys are case sensitive |
| httpClient | null | "Buzz\Browser" | no | The service reference to the HTTP client to use for APM requests. It needs to implement the Psr\Http\Client\ClientInterface. When left empty, the Http\Discovery\HttpClientDiscovery is used to find any installed http clients. |
| timeout | 10 | 10 | no | The timeout for the HTTP client |
| logger | null | "monolog.logger" | no | The service reference to the Logger to use in all APM requests. It needs to implement the Psr\Log\LoggerInterface. When left empty, the Psr\Log\NullLogger is used. |
| logLevel | INFO | DEBUG | no | The log level of the logger |
| stackTraceLimit | 0 | 10 | no | The depth of a transaction stack trace. The default (0) is unlimited depth. |
| transactionSampleRate | 1.0 | 1.0 | no | Transactions will be sampled at the given rate (1.0 being 100%). Sampling a transaction means that the context and child events will be included in the data sent to APM. Unsampled transactions are still reported to APM, including the overall transaction time, but will have no details. The default is to sample all (1.0) transactions. |
Furthermore, it is possible to de-/activate the data capturing for transactions and errors. Per default, both are enabled. For errors, status codes and exceptions can be excluded. See the following example:
transactions: # Captures transactions
enabled: true # Activating capturing of transactions, default is true
errors: # Captures errors
enabled: true # Activating capturing of errors, default is true
exclude:
status_codes: [] # Status codes which should not be captured. The default is none.
exceptions: [] # Exceptions which should not be captured. The default is none.
Contributing
Contributions are welcome. Read the contributing guide to get started.
Contributors
A big thank you goes out to every contributor of this repo, special thanks goes out to:
chq81/elastic-apm-bundle 适用场景与选型建议
chq81/elastic-apm-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.44k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 10 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「elastic apm bundle」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 chq81/elastic-apm-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chq81/elastic-apm-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 chq81/elastic-apm-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
2lenet/EasyAdminPlusBundle
Elastic APM bundle
The bundle for easy using json-rpc api on your project
This package includes a script and fail2ban configuration that allows you to use fail2ban when utilizing AWS elastic load balancer (ELB) and an apache webserver.
Elastic Driver for Laravel Scout
Provide a way to secure accesses to all routes of an symfony application.
统计信息
- 总下载量: 7.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-20