superbalist / laravel-prometheus-exporter Goto Github PK
View Code? Open in Web Editor NEWA prometheus exporter for Laravel
License: MIT License
A prometheus exporter for Laravel
License: MIT License
I'd like to use this library, however I'm using a custom built storage adapter and I don't see how I could inject it into the factory.
Could we provide the possibility to use a custom storage adapter class, similar to how you can define a custom logging channel in laravel?
Hi,
This project seems unmaintained. There are a few PRs that would be great to review and merge, like Laravel 8 support.
Can we help maintaining in any way?
Thanks,
This is both a question—how do other users of this package secure the endpoint?—and a suggestion: Maybe it would be a good idea to add a section on security to the readme. I'm well aware someone integrating Prometheus into their ecosystem probably knows what they do, but opening up metrics accidentally may still be a huge threat vector.
Therefore I'd like to collect strategies to secure the endpoint, and maybe come up with a secure default to recommend in the readme.
We currently use a middleware that checks the source IP against an allowlist of Prometheus instances (simplified):
public function handle($request, Closure $next)
{
if (in_array($request->ip(), config('services.prometheus.allowed_ips'), true) {
return abort(404);
}
return $next($request);
}
https://github.com/Jimdo/prometheus_client_php is archived and no longer maintained.
They didn't add the abandoned
value in composer.json
, so there's no link to it from there, but my suggestion is to change the dependency to the one they link to in the repository readme: https://github.com/endclothing/prometheus_client_php.
After installing this package one of my projects, if I run the test it throws the below error:
Symfony\Component\Process\Exception\ProcessSignaledException
The process has been signaled with signal "11".
at vendor/symfony/process/Process.php:424
420▕ usleep(1000);
421▕ }
422▕
423▕ if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
➜ 424▕ throw new ProcessSignaledException($this);
425▕ }
426▕
427▕ return $this->exitcode;
428▕ }
1 vendor/symfony/process/Process.php:234
Symfony\Component\Process\Process::wait()
2 vendor/nunomaduro/collision/src/Adapters/Laravel/Commands/TestCommand.php:95
Symfony\Component\Process\Process::run(Object(Closure))
3 vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
NunoMaduro\Collision\Adapters\Laravel\Commands\TestCommand::handle()
4 vendor/laravel/framework/src/Illuminate/Container/Util.php:40
Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
5 vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
6 vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Object(Closure))
7 vendor/laravel/framework/src/Illuminate/Container/Container.php:610
Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), [])
8 vendor/laravel/framework/src/Illuminate/Console/Command.php:136
Illuminate\Container\Container::call()
9 vendor/symfony/console/Command/Command.php:258
Illuminate\Console\Command::execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
10 vendor/laravel/framework/src/Illuminate/Console/Command.php:121
Symfony\Component\Console\Command\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
11 vendor/symfony/console/Application.php:920
Illuminate\Console\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
12 vendor/symfony/console/Application.php:266
Symfony\Component\Console\Application::doRunCommand(Object(NunoMaduro\Collision\Adapters\Laravel\Commands\TestCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
13 vendor/symfony/console/Application.php:142
Symfony\Component\Console\Application::doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
14 vendor/laravel/framework/src/Illuminate/Console/Application.php:93
Symfony\Component\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
15 vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:129
Illuminate\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
16 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Hardware configuration
I tried to change the adapter as well, getting the same error for memory
and redis
adapter
If I try to run the single test it works, but if I try to run the whole test suit it stuck with the above error [Segmentfault (core dump)]
200
Segmentfault (core dump)
Hi!
Hope you are fine. I wanted to integrate prometheus with laravel. I have followed your guide but I am unable to understand how to configure the DB Parameters of Prometheus in Laravel and secondly how to test that if laravel and prometheus are linked successfully. Any help in this regard would be appreciated.
Thanks.
Support for multiple middleware would be great under some scenarios, e.g.:
PROMETHEUS_METRICS_ROUTE_MIDDLEWARE=admin,authorized_ips
Error: array_combine(): Both parameters should have an equal number of elements
PROMETHEUS_NAMESPACE=namespace
PROMETHEUS_METRICS_ROUTE_ENABLED=true
PROMETHEUS_METRICS_ROUTE_PATH=metrics
PROMETHEUS_METRICS_ROUTE_MIDDLEWARE=null
PROMETHEUS_STORAGE_ADAPTER=redis
PROMETHEUS_REDIS_PREFIX=PROMETHEUS_
The package service provider uses the array_get
helper function which was removed in Laravel 6. It should be changed to use.
Looks like #10 was merged but this was missed and the tests don't cover the service provider.
Currently the package will generate an error as soon as installed into a Laravel 6 app and the package auto-discovery kicks in, unless the laravel/helper
package is already installed.
When using this library I get error:
{
"message": "Call to undefined method Illuminate\\Support\\Facades\\Redis::connect()",
"context": {
"exception": {
"class": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError",
"message": "Call to undefined method Illuminate\\Support\\Facades\\Redis::connect()",
"code": 0,
"file": "/var/www/html/vendor/jimdo/prometheus_client_php/src/Prometheus/Storage/Redis.php:95"
}
}
}
Predis is installed and defined as the client in database.php
But I have tried from tinker, Illuminate\Support\Facades\Redis::connect() is working.
Also I have checked my docker image, it does not install php-redis or php5-redis.
What could be the probable reason?
Hi, are you willing to widen the supported version of laravel to allow the new major release 6.0?
The dependency in composer.json could be changed to ^5.3 || ^6.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.