Expose log messages as Prometheus metrics.#572
Merged
Conversation
Steps followed:
- add `promrus` to be able to expose metrics on log messages ("legacy" version used so that we keep using `Sirupsen/logrus` instead of `sirupsen/logrus` for now, as it leads to too many conflicts otherwise):
```
dep ensure github.com/weaveworks/promrus@v1.0.0-legacy && dep ensure && dep prune
git status | grep BUILD.bazel | cut -d' ' -f 5 | xargs git checkout HEAD
```
- add ability to add hook to `prometheus/common/log`, for now directly in `vendor`, change will eventually have to be made upstream, and Cortex upgraded,
- add hook in all `main.go`.
jml
approved these changes
Oct 5, 2017
| hook, err := promrus.NewPrometheusHook() | ||
| if err != nil { | ||
| log.Fatalf("Error initializing promrus: %v", err) | ||
| } |
Contributor
There was a problem hiding this comment.
Maybe add a MustNewPrometheusHook variant later?
Contributor
Author
There was a problem hiding this comment.
Good idea. Let's keep it DRY. I didn't know that MustNew* was actually so idiomatic, thanks for pointing it out.
This was referenced Oct 5, 2017
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Steps followed:
promrusto be able to expose metrics on log messages ("legacy" version used so that we keep usingSirupsen/logrusinstead ofsirupsen/logrusfor now, as it leads to too many conflicts otherwise):prometheus/common/log, for now directly invendor, change will eventually have to be made upstream, and Cortex upgraded,main.go.Manual testing in
local:alertmanager:configs:lite:Similar metrics are to be expected once deployed in
devandprod.