fixes
This commit is contained in:
parent
4b056b8c1e
commit
eff4294d5a
4 changed files with 37 additions and 32 deletions
|
@ -23,7 +23,7 @@ Register the service provider in app.php
|
||||||
```php
|
```php
|
||||||
'providers' => [
|
'providers' => [
|
||||||
// ...
|
// ...
|
||||||
Superbalist\LaravelPrometheusExporter\LaravelServiceProvider::class,
|
Superbalist\LaravelPrometheusExporter\PrometheusServiceProvider::class,
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ Register the facade in app.php
|
||||||
|
|
||||||
#### Lumen
|
#### Lumen
|
||||||
```php
|
```php
|
||||||
$app->register(Superbalist\LaravelPrometheusExporter\LumenServiceProvider::class);
|
$app->register(Superbalist\LaravelPrometheusExporter\LumenPrometheusServiceProvider::class);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Superbalist\LaravelPrometheusExporter;
|
|
||||||
|
|
||||||
class LaravelServiceProvider extends PrometheusServiceProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Perform post-registration booting of services.
|
|
||||||
*/
|
|
||||||
public function boot()
|
|
||||||
{
|
|
||||||
$this->publishes([
|
|
||||||
__DIR__ . '/../config/prometheus.php' => config_path('prometheus.php'),
|
|
||||||
]);
|
|
||||||
|
|
||||||
parent::boot();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load routes.
|
|
||||||
*/
|
|
||||||
protected function loadRoutes()
|
|
||||||
{
|
|
||||||
$this->loadRoutesFrom(__DIR__ . '/laravel_routes.php');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,8 +2,16 @@
|
||||||
|
|
||||||
namespace Superbalist\LaravelPrometheusExporter;
|
namespace Superbalist\LaravelPrometheusExporter;
|
||||||
|
|
||||||
class LumenServiceProvider extends PrometheusServiceProvider
|
class LumenPrometheusServiceProvider extends PrometheusServiceProvider
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Publish files.
|
||||||
|
*/
|
||||||
|
protected function publishFiles()
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load routes.
|
* Load routes.
|
||||||
*/
|
*/
|
|
@ -7,14 +7,16 @@ use Illuminate\Support\ServiceProvider;
|
||||||
use Prometheus\CollectorRegistry;
|
use Prometheus\CollectorRegistry;
|
||||||
use Prometheus\Storage\Adapter;
|
use Prometheus\Storage\Adapter;
|
||||||
|
|
||||||
abstract class PrometheusServiceProvider extends ServiceProvider
|
class PrometheusServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Perform post-registration booting of services.
|
* Perform post-registration booting of services.
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
$this->mergeConfigFrom(__DIR__ . '/../config/prometheus.php', 'prometheus');
|
$this->publishFiles();
|
||||||
|
$this->mergeConfigs();
|
||||||
|
$this->loadRoutes();
|
||||||
|
|
||||||
if (config('prometheus.metrics_route_enabled')) {
|
if (config('prometheus.metrics_route_enabled')) {
|
||||||
$this->loadRoutes();
|
$this->loadRoutes();
|
||||||
|
@ -27,10 +29,31 @@ abstract class PrometheusServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merge configs.
|
||||||
|
*/
|
||||||
|
protected function mergeConfigs()
|
||||||
|
{
|
||||||
|
$this->mergeConfigFrom(__DIR__ . '/../config/prometheus.php', 'prometheus');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Publish files.
|
||||||
|
*/
|
||||||
|
protected function publishFiles()
|
||||||
|
{
|
||||||
|
$this->publishes([
|
||||||
|
__DIR__ . '/../config/prometheus.php' => config_path('prometheus.php'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load routes.
|
* Load routes.
|
||||||
*/
|
*/
|
||||||
abstract protected function loadRoutes();
|
protected function loadRoutes()
|
||||||
|
{
|
||||||
|
$this->loadRoutesFrom(__DIR__ . '/laravel_routes.php');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register bindings in the container.
|
* Register bindings in the container.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue