github.com/prebid/prebid-server/v2@v2.18.0/docs/developers/metrics-configuration.md (about) 1 ## Metrics configuration and how to import metrics of [Prebid server](https://docs.prebid.org/prebid-server/versions/pbs-versions-go.html) to [Grafana](https://grafana.com/) through [Prometheus](https://prometheus.io/) stack. 2 3 #### These are the parameters that are capable for metrics collection 4 5 - PBS_METRICS_PROMETHEUS_PORT=9100 - default is 0. 6 7 If PBS_METRICS_PROMETHEUS_PORT is null, your [Prebid server](https://docs.prebid.org/prebid-server/versions/pbs-versions-go.html) won't collect any metrics. 8 9 - PBS_METRICS_PROMETHEUS_NAMESPACE=prebid - default is empty. 10 11 PBS_METRICS_PROMETHEUS_NAMESPACE - this is responsable for the primary prefix added to your metrics to ensure uniqueness within your cluster. 12 13 - PBS_METRICS_PROMETHEUS_SUBSYSTEM=server - default is empty. 14 15 PBS_METRICS_PROMETHEUS_SUBSYSTEM - this is a secondary prefix added to metrics to ensure uniqueness. 16 17 - PBS_METRICS_DISABLED_METRICS_ADAPTER_CONNECTIONS_METRICS=false - default is true. 18 19 PBS_METRICS_DISABLED_METRICS_ADAPTER_CONNECTIONS_METRICS - If this flag is set to true you won't get any bidder http connection adapter metrics (e.g. number of new vs reused connections) but you'll still get other adapter metrics. 20 21 #### If you're going to get metrics though [Prometheus](https://prometheus.io/) and [Prometheus](https://prometheus.io/) stack has been already installed, you have several options, please chose one: 22 23 - change environments into code (bad way). 24 25 - create pbs.yaml if it hasn't been already created (It works, but not flexible). 26 27 - input the parameters into global environments (Highly recommend you to use this way also it's reliable). 28 29 #### Finally, when you fill in your credentials of metrics, please, run: 30 31 - build your app 32 ```bash 33 go build . 34 ``` 35 - run the server 36 ```bash 37 ./prebid-server 38 ``` 39 40 #### Make sure that an application returns any metrics - `http://localhost:9100/`, if not, please check your names of environment and recompile again. 41 42 #### Add your host and port into prometheus.yml file on the instance of your [Prometheus](https://prometheus.io/). 43 44 ```yaml 45 global: 46 scrape_interval: 15s 47 evaluation_interval: 15s 48 49 external_labels: 50 monitor: 'docker-host-alpha' 51 52 rule_files: 53 - "alert.rules" 54 55 scrape_configs: 56 - job_name: 'prometheus' 57 scrape_interval: 10s 58 static_configs: 59 - targets: [ 'prometheus-host:9090'] 60 61 - job_name: 'prebidserver-metrics' 62 scrape_interval: 10s 63 static_configs: 64 - targets: ['prebidserver-host:9100' ] 65 alerting: 66 alertmanagers: 67 - scheme: http 68 static_configs: 69 - targets: 70 - 'localhost:9093' 71 ``` 72 73 #### Import data source as [Prometheus](https://prometheus.io/) into [Grafana](https://grafana.com/) 74 75 Just fill in host and port of [Prometheus](https://prometheus.io/) 76 77 ![img_grafana.png](images/img_grafana.png) 78 79 #### In that case [Prebid server](https://docs.prebid.org/prebid-server/versions/pbs-versions-go.html) uses [package](https://github.com/prometheus/client_golang) in our case it works as [Node exporter](https://github.com/prometheus/node_exporter). Therefore, here is described only how to connect [Prebid server](https://docs.prebid.org/prebid-server/versions/pbs-versions-go.html) connection with [Prometheus](https://prometheus.io/). Also, if you are interested in [Prometheus](https://prometheus.io/) and want to dig deep, follow [docs](https://prometheus.io/docs/introduction/overview/).