Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose badger and go metrics #491

Merged
merged 4 commits into from
Oct 4, 2021
Merged

Expose badger and go metrics #491

merged 4 commits into from
Oct 4, 2021

Conversation

Ullaakut
Copy link
Contributor

@Ullaakut Ullaakut commented Oct 4, 2021

Goal of this PR

Fixes #488

This PR imports "github.com/dgraph-io/badger/v2/y" in both indexer binaries, so that the metrics are exposed on the default HTTP handler. It also adds an HTTP server to both binaries which exposes the default handler (which is why it's given a nil handler).

You can test this PR by running the indexer and making a curl call to <FLAG_METRICS>/debug/vars, depending on what you set as the --metrics parameter.

FYI, here is the init function in badger's metrics package:

func init() {
  http.HandleFunc("/debug/vars", expvarHandler)
  Publish("cmdline", Func(cmdline))
  Publish("memstats", Func(memstats))
}

The exposed metrics are expvar metrics, so in order to consume them with something like prometheus, you will need external tooling, such as prometheus-expvar-exporter.

Checklist

  • Is on the right branch
  • Documentation is up-to-date
  • Tests are up-to-date

cmd/flow-dps-indexer/README.md Outdated Show resolved Hide resolved
cmd/flow-dps-indexer/main.go Outdated Show resolved Hide resolved
cmd/flow-dps-indexer/main.go Outdated Show resolved Hide resolved
@Ullaakut Ullaakut requested a review from awfm9 October 4, 2021 10:42
@awfm9 awfm9 merged commit c2d3e49 into master Oct 4, 2021
@Ullaakut Ullaakut deleted the expose-badger-metrics branch October 5, 2021 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose Go and Badger metrics on live indexer
2 participants