2019/11/21 18:11:11 Running OpenCensus Trace and Metrics receivers as a gRPC service at "localhost:55678"
2019/11/21 18:11:11 Running zPages on port 55679
```
5. You can check the status of the agent using zPages at http://localhost:55679/debug/tracez.
## Setting up Prometheus
1. Follow the instructions for setting up [Prometheus](https://prometheus.io/docs/prometheus/latest/installation/).
2. Create a file named `prom.yaml` with the following contents:
```yaml
scrape_configs:
- job_name: 'agent1'
scrape_interval: 5s
static_configs:
- targets: ['localhost:8888']
```
3. Run Prometheus with the new configuration file. The following command assumes that you are running from pre-compiled binaries:
```bash
./prometheus --config.file=prom.yaml
```
4. If you see output similar to the following, Prometheus is now running:
```bash
level=info ts=2019-11-22T00:27:13.772Z caller=main.go:626 msg="Server is ready to receive web requests."
```
5. You can now access the Prometheus UI at http://localhost:9090.
6. Check to make sure Prometheus is able to scrape metrics from OpenCensus at http://localhost:9090/targets. If the state for the endpoint `http://localhost:8888/metrics` is not `UP`, make sure the OpenCensus agent is running. If you are running Prometheus using Docker, you may have to add `--net="host"` to your run command so that `localhost` resolves correctly.
## Exporting Metrics
1. Clone the [tools](https://golang.org/x/tools) subrepository.
1. Inside `internal`, create a file named `main.go` with the following contents:
3. Run the new file from within the tools repository:
```bash
go run internal/main.go
```
4. After about 5 seconds, OpenCensus should start receiving your new metrics, which you can see at http://localhost:8888/metrics. This page will look similar to the following:
```
# HELP promdemo_latencyDistribution the various latencies
5. After a few more seconds, Prometheus should start displaying your new metrics. You can view the distribution at http://localhost:9090/graph?g0.range_input=5m&g0.stacked=1&g0.expr=rate(promdemo_latencyDistribution_bucket%5B5m%5D)&g0.tab=0.