When those are published on Dockerhub, people will be able to start those
examples in fewer steps than the current documentation:
https://prometheus.io/docs/introduction/getting_started/#starting-up-some-sample-targets
While relying on Docker may not be always wished, giving the possibility to
quickly start a daemon that exposes metrics can be useful in many tutorials.
The simple and random example are build as static binaries and packaged as
single binaries in Docker images.
This commit tries really hard to limit the number of per-example maintenance
work by sharing most of the Makefile to build the Docker images. The tiny top
level Makefiles in each example directory are strictly identical.
Updates: #347
I intentionally left out the Makefile infrastructure that we had
previously for this, as it's not strictly needed and adds
complexity/maintenance burden.
This rewrite had may backs and forths. In my git repository, it
consists of 35 commits which I cannot group or merge into reasonable
review buckets. Gerrit breaks fundamental git semantics, so I have to
squash the 35 commits into one for the review.
I'll push this not with refs/for/master, but with refs/for/next so
that we can transition after submission in a controlled fashion.
For the review, I recommend to start with looking at godoc and in
particular the many examples. After that, continue with a line-by-line
detailed review. (The big picture is hopefully as expected after
wrapping up the discussion earlier.)
Change-Id: Ib38cc46493a5139ca29d84020650929d94cac850
Examining the existing documentation over the standard Go documentation
server revealed some serious formatting flaws. Everything should be
readable now.
- Comments are migrated from ``/* */`` to ``//`` per convention.
- ``NewDefaultHistogram`` helper.
- ``Registry.Handler`` and ``Registry.YieldExporter`` deprecation.
- Cleanup of legacy import paths.
- Updating examples to use acknowledged patterns.
- Parameterizing the random parameter namespaces for ``examples/random/main.go``, which is useful for demoing population behaviors.
- Provide better examples in the examples subdirectory.
- Make the comments consistent in terms of using multi-line format for future-proofing.
- Extract major constants out.