Skip to content

Commit ac90f9e

Browse files
committed
prometheus configurations
1 parent e825813 commit ac90f9e

File tree

3 files changed

+124
-1
lines changed

3 files changed

+124
-1
lines changed

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"maatwebsite/excel": "^3.1",
2929
"madnest/madzipper": "^1.1",
3030
"predis/predis": "^1.1",
31-
"rusticisoftware/tincan": "@stable"
31+
"rusticisoftware/tincan": "@stable",
32+
"superbalist/laravel-prometheus-exporter": "^1.0"
3233
},
3334
"require-dev": {
3435
"facade/ignition": "^2.4.2",

config/app.php

+2
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
* Custom Service Providers
190190
*/
191191
App\Providers\QueueMonitorProvider::class,
192+
Superbalist\LaravelPrometheusExporter\PrometheusServiceProvider::class
192193
],
193194

194195
/*
@@ -241,6 +242,7 @@
241242
'Validator' => Illuminate\Support\Facades\Validator::class,
242243
'View' => Illuminate\Support\Facades\View::class,
243244
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
245+
'Prometheus' => Superbalist\LaravelPrometheusExporter\PrometheusFacade::class
244246

245247
],
246248

config/prometheus.php

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<?php
2+
3+
return [
4+
/*
5+
|--------------------------------------------------------------------------
6+
| Namespace
7+
|--------------------------------------------------------------------------
8+
|
9+
| The namespace to use as a prefix for all metrics.
10+
|
11+
| This will typically be the name of your project, eg: 'search'.
12+
|
13+
*/
14+
15+
'namespace' => env('PROMETHEUS_NAMESPACE', 'app'),
16+
17+
/*
18+
|--------------------------------------------------------------------------
19+
| Metrics Route Enabled?
20+
|--------------------------------------------------------------------------
21+
|
22+
| If enabled, a /metrics route will be registered to export prometheus
23+
| metrics.
24+
|
25+
*/
26+
27+
'metrics_route_enabled' => env('PROMETHEUS_METRICS_ROUTE_ENABLED', true),
28+
29+
/*
30+
|--------------------------------------------------------------------------
31+
| Metrics Route Path
32+
|--------------------------------------------------------------------------
33+
|
34+
| The path at which prometheus metrics are exported.
35+
|
36+
| This is only applicable if metrics_route_enabled is set to true.
37+
|
38+
*/
39+
40+
'metrics_route_path' => env('PROMETHEUS_METRICS_ROUTE_PATH', 'metrics'),
41+
42+
/*
43+
|--------------------------------------------------------------------------
44+
| Metrics Route Name
45+
|--------------------------------------------------------------------------
46+
|
47+
| Route Parh name aliase.
48+
|
49+
| This is only applicable if metrics_route_enabled is set to true.
50+
|
51+
*/
52+
53+
'metrics_route_name' => env('PROMETHEUS_METRICS_ROUTE_NAME', 'metrics'),
54+
55+
/*
56+
|--------------------------------------------------------------------------
57+
| Metrics Route Middleware
58+
|--------------------------------------------------------------------------
59+
|
60+
| The middleware to assign to the metrics route.
61+
|
62+
| This can be used to protect the /metrics end-point to authenticated users,
63+
| a specific ip address, etc.
64+
| You are responsible for writing the middleware and implementing any
65+
| business logic needed by your application.
66+
|
67+
*/
68+
69+
'metrics_route_middleware' => env('PROMETHEUS_METRICS_ROUTE_MIDDLEWARE'),
70+
71+
/*
72+
|--------------------------------------------------------------------------
73+
| Storage Adapter
74+
|--------------------------------------------------------------------------
75+
|
76+
| The storage adapter to use.
77+
|
78+
| Supported: "memory", "redis", "apc"
79+
|
80+
*/
81+
82+
'storage_adapter' => env('PROMETHEUS_STORAGE_ADAPTER', 'memory'),
83+
84+
/*
85+
|--------------------------------------------------------------------------
86+
| Storage Adapters
87+
|--------------------------------------------------------------------------
88+
|
89+
| The storage adapter configs.
90+
|
91+
*/
92+
93+
'storage_adapters' => [
94+
95+
'redis' => [
96+
'host' => env('REDIS_HOST', 'localhost'),
97+
'port' => env('REDIS_PORT', 6379),
98+
'password'=> env('REDIS_PASSWORD', null),
99+
'timeout' => 0.1,
100+
'read_timeout' => 10,
101+
'persistent_connections' => false,
102+
'prefix' => env('PROMETHEUS_REDIS_PREFIX', 'PROMETHEUS_'),
103+
],
104+
105+
],
106+
107+
/*
108+
|--------------------------------------------------------------------------
109+
| Collectors
110+
|--------------------------------------------------------------------------
111+
|
112+
| The collectors specified here will be auto-registered in the exporter.
113+
|
114+
*/
115+
116+
'collectors' => [
117+
// \Your\ExporterClass::class,
118+
],
119+
120+
];

0 commit comments

Comments
 (0)