mondago/laravel-application-insights
Composer 安装命令:
composer require mondago/laravel-application-insights
包简介
A Laravel 8 package to send application insights to Microsoft Application Insights
README 文档
README
Installation
Add the following to your composer.json file:
"repositories": [ { "type": "git", "url": "https://github.com/mondago/ApplicationInsights-PHP" }, { "type": "git", "url": "https://github.com/mondago/laravel-azure-application-insights" } ],
and require it by adding the following line to your composer.json file under "require":
"mondago/laravel-application-insights": "^0.6.0"
Optionally, you can publish the config file of this package with this command:
php artisan vendor:publish --provider="Mondago\ApplicationInsights\ServiceProvider"
Middleware
As a convenience you may choose to use the Mondago\ApplicationInsights\Middleware\TrackRequest middleware which will send the request and response to Application Insights.
The middleware utilizes terminable middleware from Laravel to ensure that tracking the request doesn't block the response being sent.
Since 0.6.2, if the request has a session started, this middleware will set the session id as the anonymous user id to allow tracking of user flows.
Make sure to include this in each route group you'd like to track requests for, as attaching it to the global middleware will result in the session never being set.
You can disable this by setting the environment variable APPINSIGHTS_TRACK_ANONYMOUS_USERS to false.
Logging
Since 0.6.2 a custom monolog handler is provided for sending logs to application insights. This handler captures exceptions as well as other log levels. Exceptions are tracked as exceptions, and log messages are sent with their closes matching severity level.
To use this, update your config/logging.php configuration with the following:
'channels' => [ // other channels... 'app-insights' => [ 'driver' => 'custom', 'via' => Mondago\ApplicationInsights\Logging\CreateApplicationInsightsLogger::class, ], ]
You might then choose to include this in your stack log handler:
'channels' => [ // other channels... 'stack' => [ 'driver' => 'stack', 'channels' => ['stderr', 'daily', 'app-insights'], ], ]
Logging Migrations
This package will automatically send migration events to application insights when enabled.
Since 0.6.2 this includes when no migrations were ran. This is great for container images that run php artisan migrate on startup.
Support Matrix
| Our Version | Laravel Version |
|---|---|
| ^0.7.0 | ^10.0 |
| ^0.6.0 | ^9.0 |
| ^0.4.0 | ^8.0 |
| ^0.3.0 | ^7.0 |
mondago/laravel-application-insights 适用场景与选型建议
mondago/laravel-application-insights 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 02 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「analytics」 「monitoring」 「laravel」 「Insights」 「Mondago」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mondago/laravel-application-insights 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mondago/laravel-application-insights 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mondago/laravel-application-insights 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for chameleon-system/sanitycheck
SoftWax Health Check Bundle for Symfony framework
1Pilot client for Symfony
Statsd (Object Oriented) client library for PHP
Analytics chooser extensions for site settings.
APM agent for laravel projects to monitor the application with elastic apm tools.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-20