prometheus client Why can’t you use multiple processes

I try to perform multi-process analysis in the code to analyze the data of a certain file, but the code cannot perform the join normally, and there is no method to perform multiprocessing.Process. May I ask what I did wrong. Thank you very much for reading my question. Below is my test code

from prometheus_client import generate_latest, CollectorRegistry
from prometheus_client.core import CollectorRegistry
from flask import Response,Flask
import multiprocessing
class CustomCollector(object):
    def get_data(self,data):

    def collect(self):
        plist = []
        for x in range(30):
            p = multiprocessing.Process(target=self.get_data,args=("test",))

        for p in plist:
        print('Process close')

def rundata():
    REGISTRY = CollectorRegistry(auto_describe=False)
    coll = CustomCollector()
    return Response(generate_latest(REGISTRY), mimetype="text/plain")


Read more here:

Content Attribution

This content was originally published by user51679 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: