Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ncabatoff/fakescraper
Scrape prometheus metrics from inside the app. Handy for testing.
https://github.com/ncabatoff/fakescraper
Last synced: 3 months ago
JSON representation
Scrape prometheus metrics from inside the app. Handy for testing.
- Host: GitHub
- URL: https://github.com/ncabatoff/fakescraper
- Owner: ncabatoff
- License: mit
- Created: 2016-07-25T00:39:14.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-21T19:47:20.000Z (6 months ago)
- Last Synced: 2024-07-21T21:27:19.718Z (6 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fakescraper
Scrape Prometheus metrics from inside the app. Handy for testing.I use this when I'm writing Prometheus exporters and want to test them from the command line.
Before this I would start the daemon, run curl to fetch the metrics, then kill it. Now I simply
do something like:```
func main() {
var (
onceToStdout = flag.Bool("once-to-stdout", false,
"Don't bind, instead just print the metrics once to stdout and exit")
)flag.Parse()
if *onceToStdout {
fs := fakescraper.NewFakeScraper()
fmt.Print(fs.Scrape())
return
}...
if err := http.ListenAndServe(*listenAddress, nil); err != nil {
log.Fatalf("Unable to setup HTTP server: %v", err)
}
}
```