can you please give pointers on how to create the endpoint for this module to integrate it with prometheus, this module doesn't show up anywhere in content creation even after the module installation.

Comments

mmbk’s picture

Hi,
the module is not supposed to show up anywhere in the content.

There is only one new route implemented that creates the endpoint automatically

http(s)://YOUR-HOST/metrics

By default it is only accesible by authenticated users, having the permission to view the data.

Your prometheus scraper will probably not authenticate to drupal, so you have to grant access to anoymous users. But be carefull, then you will expose sensitive data to everyone, so protect this url by other means (.htaccess)
For example

<Location /metrics>
        Require all denied
        Require ip IP-OF-YOUR-SCRAPER
</Location>

And yes, the documentation is a bit short.

somnath.ghosh518@gmail.com’s picture

Thank you for the information, this was really helpful.

However I get the below error whenever I hit the said path /metrics

TypeError: Argument 1 passed to Drupal\prometheus_exporter\Controller\MetricsController::__construct() must be an instance of Symfony\Component\Serializer\SerializerInterface, instance of stdClass given, called in /app/web/modules/prometheus_exporter/src/Controller/MetricsController.php on line 49 in Drupal\prometheus_exporter\Controller\MetricsController->__construct() (line 38 of /app/web/modules/prometheus_exporter/src/Controller/MetricsController.php)