定制 acseo/sylius-prometheus-metrics-plugin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

acseo/sylius-prometheus-metrics-plugin

最新稳定版本:v2.1

Composer 安装命令:

composer require acseo/sylius-prometheus-metrics-plugin

包简介

Sylius Prometheus Metrics Plugin

README 文档

README

ACSEO

Sylius Prometheus Metrics

Features

Observability

We use the artprima/prometheus-metrics-bundle (https://github.com/artprima/prometheus-metrics-bundle) bundle to collect metrics in the Prometheus format, which can then be used to build a dashboard with Grafana. These metrics are visible at the /metrics/prometheus URL of the website.

Default metrics are generated. It is possible to create custom metrics to track "Business" data, such as the number of created orders or the order amount.

Installation for development

  1. Run make install.

Installation on your project

  1. Run $ composer require acseo/sylius-prometheus-metrics-plugin.

  2. Add these few lines to the config/state_machine/sylius_payment.yaml

winzou_state_machine:
   sylius_payment:
      callbacks:
         after:
            sylius_order_items_complete_collector:
               on: 'complete'
               do: ['@metrics.order_collector', 'incrementPrometheusCounters']
               args: ["object.getOrder()"]

Installation without Symfony Flex

  1. Run $ composer require acseo/sylius-prometheus-metrics-plugin.

  2. Enable the plugin in bundles.php

<?php
// config/bundles.php

return [
    // ...
    Artprima\PrometheusMetricsBundle\ArtprimaPrometheusMetricsBundle::class => ['all' => true],
    Acseo\SyliusPrometheusMetricsPlugin\SyliusPrometheusMetricsPlugin::class => ['all' => true],
];
  1. Add this file config/packages/prometheus_metrics.yaml
artprima_prometheus_metrics:
    namespace: myapp
    storage: '%env(PROM_METRICS_DSN)%'

    ignored_routes:
        - prometheus_bundle_prometheus
        - _wdt

    # used to disable default application metrics
    #disable_default_metrics: false

    # Recommended to disable default metrics from promphp/prometheus_client_php
    # see https://github.com/PromPHP/prometheus_client_php/issues/62
    disable_default_promphp_metrics: true

    # used to enable console metrics
    #enable_console_metrics: false

when@test:
    artprima_prometheus_metrics:
        storage: in_memory
  1. Add the metrics routes config/routes/metrics.yaml
app_metrics:
    resource: '@ArtprimaPrometheusMetricsBundle/Resources/config/routing.yaml'
  1. Add environment variables
###> artprima/prometheus-metrics-bundle ###
PROM_METRICS_DSN=apcu
###< artprima/prometheus-metrics-bundle ###

统计信息

  • 总下载量: 4.25k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 1
  • 开发语言: Makefile

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固