g5_prom_rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/g5_prom_rails.rb +5 -2
- data/lib/g5_prom_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c6e031d0ef9823a61f5386165611a853b304524
|
4
|
+
data.tar.gz: 974794f7fa54e9d128741ddeb80479e07c669add
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6485f9691c48d7e427e9f99bd4597e0b6238e6e45cd574ec7ed1e716b492166802cb00fcc7240da3f92bb4f4410d1af74e2dc252e4fa76c77e615567c11c1bc3
|
7
|
+
data.tar.gz: f0f2bb00fe6c3df231e3c3d92d9b316838e3206c1b499ffb05f36095d0a1736ad1fd18f56d2a22c2d52087354a313111bb6c5181ca81af64aaa61305ef4b4e25
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ G5PromRails.initialize_per_application = -> (registry) {
|
|
33
33
|
METRICS.initialize_per_application(registry)
|
34
34
|
}
|
35
35
|
|
36
|
-
G5PromRails.
|
36
|
+
G5PromRails.initialize_per_process = -> (registry) {
|
37
37
|
METRICS.initialize_per_process(registry)
|
38
38
|
}
|
39
39
|
|
@@ -92,7 +92,7 @@ There are a couple of general Prometheus tips things to keep in mind.
|
|
92
92
|
As you will soon learn, G5PromRails can provide you with some automatic metrics. Most of them are scoped to your application's name. It will attempt to infer the application's name from the Rails Application class's (`config/application.rb`) dasherized parent module name. If that doesn't work for you, it can be manually defined with:
|
93
93
|
|
94
94
|
```ruby
|
95
|
-
G5PromRails.app_name = "
|
95
|
+
G5PromRails.app_name = "my-app-name"
|
96
96
|
```
|
97
97
|
|
98
98
|
## Sidekiq
|
@@ -126,12 +126,12 @@ There are some common instrumentation tasks that this gem can help you with.
|
|
126
126
|
When you'd like to instrument the count of certain ActiveRecord models, in an initializer you can:
|
127
127
|
|
128
128
|
```ruby
|
129
|
-
G5PromRails.count_models(
|
129
|
+
G5PromRails.count_models(Post, Comment)
|
130
130
|
```
|
131
131
|
|
132
132
|
Will result in a gauge metric named `model_rows` with a `model` label set to the tableized name of your model and an `app` label set to the `my_app`. In PromQL this will look like:
|
133
133
|
```promql
|
134
|
-
model_rows{model="posts", app="
|
134
|
+
model_rows{model="posts", app="my-app"}
|
135
135
|
```
|
136
136
|
|
137
137
|
This metric is left un-namespaced because it gives you the ability to compare these values across applications, while still allowing them to be limited to a single app via PromQL. The values will automatically be refreshed when the application-level metrics endpoint is hit.
|
data/lib/g5_prom_rails.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require "g5_prom_rails/engine"
|
2
|
-
|
3
1
|
module G5PromRails
|
4
2
|
PER_PROCESS_PATH = "/metrics"
|
5
3
|
PER_APPLICATION_PATH = "/probe"
|
@@ -24,3 +22,8 @@ module G5PromRails
|
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
25
|
+
|
26
|
+
# Down here due to fun behavior in implementing apps where G5PromRails module
|
27
|
+
# isn't defined if a class is defined straight up as G5PromRails::Whatever.
|
28
|
+
# Just scripting things.
|
29
|
+
require "g5_prom_rails/engine"
|