Skip to content
This repository was archived by the owner on Jul 7, 2022. It is now read-only.

Commit f583f27

Browse files
committed
Add instructions on how to compile server.go.
1 parent d9946c9 commit f583f27

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ func main() {
277277
}
278278
```
279279

280+
Compile and run the server
281+
282+
```bash
283+
go build server.go
284+
./server.go
285+
```
286+
280287
We have a simple server which when hit on localhost:8090/ping endpoint sends back pong
281288

282289
<p align="center">
@@ -322,7 +329,7 @@ The `prometheus.MustRegister` function registers the pingCounter to the default
322329
To expose the metrics the Go Prometheus client library provides the promhttp package.
323330
`promhttp.Handler()` provides a `http.Handler` which exposes the metrics registered in the Default Register.
324331

325-
_serverWithMetric.go_
332+
Here is the complete _serverWithMetric.go_ at this point.
326333

327334
```go
328335
package main
@@ -356,6 +363,15 @@ func main() {
356363
}
357364
```
358365

366+
Re-compile the binary
367+
```bash
368+
go get github.com/prometheus/client_golang/prometheus
369+
go get github.com/prometheus/client_golang/prometheus/promhttp
370+
go build server.go
371+
./server.go
372+
```
373+
374+
359375
Now hit the localhost:8090/ping endpoint a couple of times and sending a request to localhost:8090 will provide the metrics.
360376

361377
<p align="center">

0 commit comments

Comments
 (0)