Hello,
I am trying to integrate metrics into a multiprocess application. It is not HTTP (gunicorn) based so I am a little lost trying to follow such examples. Basically, I have a master process which spins up a series of long-lived child processes which perform various functions. I am trying to use the mater process to do the exposition like so:
registry = CollectorRegistry()
multiprocess.MultiProcessCollector(registry)
start_http_server(8000, registry=registry)
In a child process I have a simple Counter to test with:
c_logs_ingested = Counter('logs_listener_logs_ingested', 'Count of ingested log messages')
c_logs_ingested.labels(listener_type=self._listener_type, address=self.address, port=self.port).inc()
I have set the collection dir environment variable:
export prometheus_multiproc_dir=/tmp/prom
And when running, I can see that directory being populated:
$ ls -la
total 64
drwxrwxr-x 2 andersonjd andersonjd 4096 May 8 12:57 .
drwxrwxrwt 44 root root 49152 May 8 12:57 ..
-rw-rw-r-- 1 andersonjd andersonjd 1048576 May 8 12:45 counter_23714.db
-rw-rw-r-- 1 andersonjd andersonjd 1048576 May 8 12:45 counter_23751.db
-rw-rw-r-- 1 andersonjd andersonjd 1048576 May 8 12:57 counter_24807.db
But when I look at the metrics being exported at localhost:8000, it only contains the default environment metrics. What am I missing here?
Thank you for your time,
John