forked from zapier/prom-aggregation-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WEB-2117 wipe gauges after scrape --------- Co-authored-by: Pedro Ladaria <[email protected]>
- Loading branch information
Showing
3 changed files
with
131 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Contributing | ||
|
||
## Install Go | ||
|
||
https://golang.org/doc/install | ||
|
||
## Install dependencies | ||
|
||
```sh | ||
go mod tidy | ||
``` | ||
|
||
## Run | ||
|
||
```sh | ||
go run . --apiListen 127.0.0.1:8080 | ||
``` | ||
|
||
## Send some metrics | ||
|
||
``` | ||
echo "some_metric 3.14" | curl --data-binary @- http://127.0.0.1:8080/metrics/job/some_job | ||
printf "#TYPE another_metric gauge\nanother_metric 42\n" | curl --data-binary @- http://127.0.0.1:8080/metrics/job/some_job | ||
``` | ||
|
||
## See your metric | ||
|
||
Open http://127.0.0.1:8080/metrics in your browser or use `curl`: | ||
|
||
```sh | ||
curl http://127.0.0.1:8080/metrics | ||
``` | ||
|
||
Expected result | ||
|
||
``` | ||
# TYPE another_metric gauge | ||
another_metric{job="some_job"} 42 | ||
# TYPE some_metric untyped | ||
some_metric{job="some_job"} 3.14 | ||
``` | ||
|
||
## Simulate a scrape from Prometheus | ||
|
||
- With "Prometheus/1.0" as user-agent | ||
- Gauges will be cleared after the scrape | ||
|
||
```sh | ||
curl -H "User-Agent: Prometheus/1.0" http://127.0.0.1:8080/metrics | ||
``` | ||
|
||
Returns the same as above. But if executed again, `gauge` metrics are cleared: | ||
|
||
``` | ||
# TYPE some_metric untyped | ||
some_metric{job="some_job"} 3.14 | ||
``` | ||
|
||
## Run tests | ||
|
||
```sh | ||
go test ./... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters