File tree Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -53,10 +53,19 @@ var (
53
53
},
54
54
[]string {"route" },
55
55
)
56
+
57
+ appInfo = prometheus .NewGaugeVec (prometheus.GaugeOpts {
58
+ Namespace : "go_graphql_armor" ,
59
+ Subsystem : "app" ,
60
+ Name : "info" ,
61
+ Help : "Application information" ,
62
+ },
63
+ []string {"version" , "go_version" },
64
+ )
56
65
)
57
66
58
67
func init () {
59
- prometheus .MustRegister (httpCounter , httpDuration )
68
+ prometheus .MustRegister (httpCounter , httpDuration , appInfo )
60
69
}
61
70
62
71
func main () {
@@ -76,6 +85,11 @@ func main() {
76
85
77
86
log .Info ("Starting service" , "version" , build )
78
87
88
+ appInfo .With (prometheus.Labels {
89
+ "version" : build ,
90
+ "go_version" : runtime .Version (),
91
+ })
92
+
79
93
shutdown := make (chan os.Signal , 1 )
80
94
signal .Notify (shutdown , syscall .SIGINT , syscall .SIGTERM )
81
95
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ max_tokens:
14
14
# Enable the feature
15
15
enable : " true"
16
16
# The maximum number of allowed tokens within a single request.
17
- max : 10000
17
+ max : 1000
18
18
# Reject the request when the rule fails. Disable this to allow the request regardless of token count.
19
19
reject_on_failure : " true"
20
20
` ` `
Original file line number Diff line number Diff line change @@ -208,7 +208,7 @@ func (p *PersistedOperationsHandler) reloadFromLocalDir() error {
208
208
p .lock .Unlock ()
209
209
210
210
p .log .Info ("Loaded persisted operations" , "amount" , len (cache ))
211
- reloadGauge .WithLabelValues ("local" ).Inc ( )
211
+ reloadGauge .WithLabelValues ("local" ).Set ( 1 )
212
212
213
213
return nil
214
214
}
@@ -229,7 +229,7 @@ func (p *PersistedOperationsHandler) reload() {
229
229
if err != nil {
230
230
p .log .Warn ("Error loading from local dir" , "err" , err )
231
231
}
232
- reloadGauge .WithLabelValues ("ticker" ).Inc ( )
232
+ reloadGauge .WithLabelValues ("ticker" ).Set ( 1 )
233
233
}
234
234
}
235
235
}()
@@ -248,7 +248,7 @@ func (p *PersistedOperationsHandler) reloadFromRemote() {
248
248
return
249
249
}
250
250
251
- reloadGauge .WithLabelValues ("remote" ).Inc ( )
251
+ reloadGauge .WithLabelValues ("remote" ).Set ( 1 )
252
252
}
253
253
254
254
func (p * PersistedOperationsHandler ) Shutdown () {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ var resultCounter = prometheus.NewCounterVec(prometheus.CounterOpts{
18
18
19
19
type Config struct {
20
20
Enabled bool `conf:"default:true" yaml:"enabled"`
21
- Max int `conf:"default:10000 " yaml:"max"`
21
+ Max int `conf:"default:1000 " yaml:"max"`
22
22
RejectOnFailure bool `conf:"default:true" yaml:"reject-on-failure"`
23
23
}
24
24
You can’t perform that action at this time.
0 commit comments