cors/prometheus
最新稳定版本:1.1.0
Composer 安装命令:
composer require cors/prometheus
包简介
CORS - Prometheus
README 文档
README
CORS Pimcore Prometheus
Expose Pimcore Metrics to Prometheus. This includes the following metrics:
- Installed Bundles and Versions
- Pimcore Sites
- Tables and row Counts
- Symfony Messenger Processed Messages Count
Installation
- Install and enable the bundle
composer require cors/prometheus bin/console pimcore:bundle:enable CORSPrometheusBundle
- Configure the routes
# app/routes.yaml _cors_prometheus: resource: "@CORSPrometheusBundle/Resources/config/routing.yaml"
Make sure to not expose the /metrics route to public access! We do that with nginx configs:
location ~* /metrics { deny all; return 403; }
You can also add a event listener that uses a Key to protect the route:
<?php declare(strict_types=1); namespace App\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\KernelEvent; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Security\Core\Exception\AccessDeniedException; final class MetricsListener implements EventSubscriberInterface { public static function getSubscribedEvents() { return [ KernelEvents::REQUEST => 'request', ]; } public function request(KernelEvent $event): void { if ('cors_prometheus' === $event->getRequest()->attributes->get('_route')) { if ($event->getRequest()->query->get('apiKey') !== 'your-super-secret-key') { throw new NotFoundHttpException('Access denied'); } } } }
Storage
Also make sure you have some kind of storage to temporarily store the metrics. We use a Redis instance for that.
Prometheus\Storage\Adapter: factory: [ 'CORS\Bundle\PrometheusBundle\StorageFactory', 'create' ] arguments: $dsn: 'redis://redis:6379'
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2024-02-21
