title: python export multiple prometheus registries with one port
body: <p>i need your help in python pleaaaaz</p>
  <p>i have python script with Gauge family metric to export jenkins metrics to prometheus with two exporter classes :
  jenkinsCollector and PollScm.
  here is some of the code :</p>
  <pre><code> class JenkinsCollector:
       def __init__(self, jenkinsInstances):
  // some code
       def collect(self):
  // some code for gauge metric
   class pollScm:
       def __init__(self, jenkinsInstances):
  // some code
       def collect(self):
  // some code for gauge metric
              registrynode = CollectorRegistry()
              registrynode.register(JenkinsCollector(
                jenkinsInstances=jenkinsInstances ))
              start_http_server(port=9759,registry=registrynode)
            
              registryscm = CollectorRegistry()
              registryscm.register(pollScm(
                jenkinsInstances=jenkinsInstances ))
              start_http_server(port=9759,registry=registryscm) 
  </code></pre>
  <p>the export works for only one metric !! either jenkinsCollector or PollScm <strong>because they use the same port</strong> !!
  so to make it work, i have to comment either this part</p>
  <pre><code> registrynode = CollectorRegistry()
              registrynode.register(JenkinsCollector(
                jenkinsInstances=jenkinsInstances ))
              start_http_server(port=9759,registry=registrynode)
  </code></pre>
  <p>Or this part</p>
  <pre><code>registryscm = CollectorRegistry()
              registryscm.register(pollScm(
                jenkinsInstances=jenkinsInstances ))
              start_http_server(port=9759,registry=registryscm)
  </code></pre>
  <p>I tried to find a way in python to use multiple registries with same port as i am working in a docker image that exposes port 9759 and tried this :</p>
  <pre><code>class JenkinsCollector:
   def __init__(self, jenkinsInstances):
  //some code
    **@app.route('/collectormetrics')**
   def collect(self):
  //some code of gauge metric
  class pollScm:
   def __init__(self, jenkinsInstances):
  //some code
   **@app.route('/pollmetrics')**
   def collect(self):
  //some code of gauge metric
  if __name__ == '__main__':
   if  environ['PATH_INFO'] == '/collectormetrics':
          registrynode = CollectorRegistry()
          registrynode.register(JenkinsCollector(
            jenkinsInstances=jenkinsInstances ))
          start_http_server(port=9759,registry=registrynode)
        elif environ['PATH_INFO'] == '/pollmetrics':
          registryscm = CollectorRegistry()
          registryscm.register(pollScm(
            jenkinsInstances=jenkinsInstances ))
          start_http_server(port=9759,registry=registryscm)
  </code></pre>
  <p>But it didn't work !! i need a way to let both exporter registries use same port but use different path ('/') so that the server can invoke the request with same port but depends on the route path to guess what metric should display!</p>
  <p>i'm thankfulll</p>