Prometheus metrics configuration confusion

I have a little doubt about the configuration of the prometheus metrics. From this docs, I learned the ‘listenAddress’ which is for Prometheus to scrape metrics from. But from the helm charts or other discussion , I learned that each service has exposed a metrics port, e.g default is 9090. So what is the difference between ‘listenAddress’ and service exposed port ? and How should I configure it?

Is the “process-wider configuration” text in docs maybe what’s creating the confusion?
For helm charts each temporal service pod defines its metrics format (prometheus) and the listenAddress defaulting to “”. Each service deployment also sets up prometheus auto discovery, see: {{ $.Chart.Name }}-{{ $service }} 'true' '9090'

in server-deployment.yaml for example.

So each service role can emit its metrics on a different port that can be then scraped by Prometheus. My guess is that the docs maybe assume the use of auto-setup image where all Temporal services are deployed onto same container and same process where you would use a single config.

Hi,@tihomir, I check if my understanding is correct. According your description, I can configure the listen address(prometheus) of each temporal service pod in server-deployment.yaml. However, the server-configmap.yaml is used in same process where use a single config.

          type: frontend
          timerType: histogram
          listenAddress: ""

But I am still a little confusion, will this global configuration affect the each temporal service deployment? what is the use of this global metrics configuration?

Currently in helm charts every Temporal service is going to configure prometheus and port 9090 for metrics as you have shown. We should probably update this to be configurable from values.yaml, could you please open issue in helm-charts repo?

what is the use of this global metrics configuration?

global is “global” really if you run all Temporal services (frontend, matching, history, worker) in the same process and have single config for all (this is default unless you specify SERVICES env var in pods to the specific role you want to start).
If you deploy each service individually like with helm (or same in docker) each pod/container has own config so yes its not that “global” and you could set different configs for each role if you wanted.