title: Multiple Endpoints for Prometheus in Go
body: <p>I'm currently working on a program written in <code>Go (golang)</code> that is monitored by Prometheus.</p>
  
  <p>Now the program should serve two endpoints <code>/metrics</code> and <code>/service</code>.
  When scraped by Prometheus on <code>/metrics</code>, it should expose it's own metrics (e.g. requests made, request latency, ...) and when scraped on <code>/service</code>, it should query an API, get metrics from there and expose them to Prometheus.</p>
  
  <p>For the first part I create e.g. a Counter via </p>
  
  <pre><code>requestCount := kitprometheus.NewCounterFrom(stdprometheus.CounterOpts{
      Namespace: "SERVICE",
      Subsystem: "service_metrics",
      Name:      "request_count",
      Help:      "Number of requests received.",
  }, fieldKeys)
  </code></pre>
  
  <p>and serve the stuff via:</p>
  
  <pre><code>http.Handle("/metrics", promhttp.Handler())
  http.ListenAndServe(":8090", nil)
  </code></pre>
  
  <p>for the <code>/service</code> part, I query the API, extract a value and update a different Gauge via <code>Gauge.Set(value)</code></p>
  
  <ul>
  <li>How do I expose this last Gauge on the different endpoint without
  firing up another server (different port)?</li>
  <li>Do I have to create my own Collector (I have no custom metrics, so
  no, right?)?</li>
  </ul>