opossum-prometheus icon indicating copy to clipboard operation
opossum-prometheus copied to clipboard

External prom-client up-to-date library

Open ttessarolo opened this issue 3 years ago • 1 comments

I had serious problems using this library by interfacing it with an existing implementation of prom-client (v13.1.0) using the default client and registry:

const client = require("prom-client");
const register = client.register;

In summary, the opossum-prometheus library logs to a separate prom-client registry/client than the main one, probably because it uses its own internal instance of prom-client, so the logs are not recorded in the main registry/client.

The solution to this problem is simple: add the ability to pass the client in the library options:

  this._registry = options.registry || options.client.register || client.register;
  this._client = options.client || client;

In this way passing the external client everything works perfectly.

ttessarolo avatar Apr 21 '21 06:04 ttessarolo