Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pccomponentes/apm-doctrine-dbal
Elastic APM for Doctrine DBAL
https://github.com/pccomponentes/apm-doctrine-dbal
apm dbal doctrine doctrine-dbal elasticsearch
Last synced: about 2 months ago
JSON representation
Elastic APM for Doctrine DBAL
- Host: GitHub
- URL: https://github.com/pccomponentes/apm-doctrine-dbal
- Owner: PcComponentes
- License: mit
- Created: 2020-05-28T06:45:40.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-14T10:11:19.000Z (over 3 years ago)
- Last Synced: 2024-11-06T18:17:21.040Z (about 2 months ago)
- Topics: apm, dbal, doctrine, doctrine-dbal, elasticsearch
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 2
- Watchers: 6
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Elastic APM for Doctrine DBAL
This library supports Span traces of SQL queries using [Doctrine DBAL](https://github.com/doctrine/dbal).
## Installation
1) Install via [composer](https://getcomposer.org/)
```shell script
composer require pccomponentes/apm-doctrine-dbal
```## Usage
In all cases, an already created instance of [ElasticApmTracer](https://github.com/zoilomora/elastic-apm-agent-php) is assumed.
### Native PHP
```php
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)
```yaml
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](http://opensource.org/licenses/MIT)Read [LICENSE](LICENSE) for more information