定制 pccomponentes/apm-doctrine-dbal 二次开发

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

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

pccomponentes/apm-doctrine-dbal

最新稳定版本:0.1.5

Composer 安装命令:

composer require pccomponentes/apm-doctrine-dbal

包简介

Elastic APM for Doctrine DBAL

README 文档

README

This library supports Span traces of SQL queries using Doctrine DBAL.

Installation

  1. Install via composer

    composer require pccomponentes/apm-doctrine-dbal

Usage

In all cases, an already created instance of ElasticApmTracer is assumed.

Native PHP

<?php
declare(strict_types=1);

$sqlLogger = new PcComponentes\ElasticAPM\Doctrine\DBAL\Logging\SQLLogger(
    $apmTracer, /** \ZoiloMora\ElasticAPM\ElasticApmTracer instance. */
    'test',
    'mysql',
);

$configuration = new Doctrine\DBAL\Configuration();
$configuration->setSQLLogger($sqlLogger);

$connection = Doctrine\DBAL\DriverManager::getConnection(
    [
        'url' => 'mysql://user:password@localhost:3306/test',
        'driver' => 'pdo_mysql',
        'charset' => 'UTF8',
    ],
    $configuration,
);

/** ... Use the connection in your project */

Service Container (Symfony)

connection.dbal.test:
  class: Doctrine\DBAL\Connection
  factory: 'Doctrine\DBAL\DriverManager::getConnection'
  arguments:
    $params:
      url: 'mysql://user:password@localhost:3306/test'
      driver: pdo_mysql
      charset: UTF8
    $config: '@connection.dbal.test.configuration'

connection.dbal.test.configuration:
  class: Doctrine\DBAL\Configuration
  calls:
    - method: setSQLLogger
      arguments:
        - '@apm.dbal.test'

apm.dbal.test:
  class: PcComponentes\ElasticAPM\Doctrine\DBAL\Logging\SQLLogger
  arguments:
    $elasticApmTracer: '@apm.tracer' # \ZoiloMora\ElasticAPM\ElasticApmTracer instance.
    $instance: 'test'
    $engine: 'mysql'

License

Licensed under the MIT license

Read LICENSE for more information

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 5
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-28