Add Prometheus metrics for number of log messages#65
Conversation
Added dependency using: ``` $ dep ensure github.com/marccarre/promrus@v1.0.0 && dep ensure && dep prune ```
This fixes: ``` middleware/grpc_logging.go:10:2: case-insensitive import collision: "github.com/weaveworks/common/vendor/github.com/Sirupsen/logrus" and "github.com/weaveworks/common/vendor/github.com/sirupsen/logrus" ``` Changelog: - Changed `import` statements from `Sirupsen/logrus` to `sirupsen/logrus`, as per the official documentation: https://github.com/sirupsen/logrus - Ran: ``` dep ensure && dep prune ```
jml
left a comment
There was a problem hiding this comment.
I'm not 100% sure about the Sirupsen case thing. I got bit by it a while ago. I suggest trying to use this branch of common in a project with executables before merging it.
|
What do you mean by not sure? I initially did not realise this would lead to such changes when I added |
|
In any case, I'll try it against Cortex and will report back. |
|
Not sure as in "I did something like this a few months ago and regretted it but can't recall the details". It might well break things. |
|
I haven't tried on Cortex yet, but trying on a reduction of the problem (i.e. a smaller project mimicking its dependencies) shows that:
yields metrics which do not increase over time: |
The `promrus` project's ownership has changed, and now belongs to Weaveworks. Command ran: ``` $ dep ensure github.com/weaveworks/promrus@v1.0.0 && dep ensure && dep prune ```
1270de8 to
279ce76
Compare
|
Why do we even want this? |
|
What do you mean by "this"?
Feel free to revert if causing issues though. |
| } | ||
| log.SetLevel(level) | ||
| log.SetFormatter(&textFormatter{}) | ||
| hook, err := promrus.NewPrometheusHook() // Expose number of log messages as Prometheus metrics. |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Adjust the MetricNameRE to reflect the actual behavior
Promrus is a Logrus hook to expose the number of log messages as Prometheus metrics:
Added dependency using:
Fixed casing in
logrusimports, causing the following issue:by:
importstatements fromSirupsen/logrustosirupsen/logrus, as per the official documentation, anddep ensure && dep prune.