We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I tried to setup PDO/Sqlite (Windows 11, prometheus_client_php 2.13.0) with the 2 end-points:
$registry = new \Prometheus\CollectorRegistry(new \Prometheus\Storage\PDO(new \PDO('sqlite::memory:'))); $counter = $registry->registerCounter('test', 'some_counter', 'it increases', ['type']); $counter->incBy(3, ['blue']);
$registry = new \Prometheus\CollectorRegistry(new \Prometheus\Storage\PDO(new \PDO('sqlite::memory:'))); $renderer = new \Prometheus\RenderTextFormat(); $result = $renderer->render($registry->getMetricFamilySamples()); header('Content-type: ' . \Prometheus\RenderTextFormat::MIME_TYPE); print($result."\n");
The second end-point keeps returning
# HELP php_info Information about the PHP environment. # TYPE php_info gauge php_info{version="8.4.1"} 1
Note: I had to change the line building $registry as the original line from the example in https://github.com/PromPHP/prometheus_client_php/README.md: $registry = new CollectorRegistry(new \PDO('sqlite::memory:')); triggers an error
$registry
$registry = new CollectorRegistry(new \PDO('sqlite::memory:'));
If I persist the database in a file with new \PDO('sqlite:C:/temp/prom.sqlite'), I get this error the second time I run any of the 2 scripts:
new \PDO('sqlite:C:/temp/prom.sqlite')
Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1 index name already exists in...
It's working well after adding an IF NOT EXISTS in PDO.php line 644
IF NOT EXISTS
$sqlIndex = "CREATE INDEX IF NOT EXISTS `name` ON `{$this->prefix}_summaries`(`name`);";);";
The text was updated successfully, but these errors were encountered:
Hey @apms75,
the registry instance needs to be singleton. You can not have two parallel instances operating on the same database.
Sorry, something went wrong.
No branches or pull requests
I tried to setup PDO/Sqlite (Windows 11, prometheus_client_php 2.13.0) with the 2 end-points:
The second end-point keeps returning
Note: I had to change the line building
$registry
as the original line from the example in https://github.com/PromPHP/prometheus_client_php/README.md:$registry = new CollectorRegistry(new \PDO('sqlite::memory:'));
triggers an errorIf I persist the database in a file with
new \PDO('sqlite:C:/temp/prom.sqlite')
, I get this error the second time I run any of the 2 scripts:It's working well after adding an
IF NOT EXISTS
in PDO.php line 644The text was updated successfully, but these errors were encountered: