forked from vieter-v/vieter
fix: metrics no longer bloat memory
parent
8f32888dff
commit
e10b450abd
|
@ -10,8 +10,7 @@ fn (mut app App) v1_metrics() web.Result {
|
||||||
return app.status(.not_found)
|
return app.status(.not_found)
|
||||||
}
|
}
|
||||||
|
|
||||||
mut exporter := metrics.new_prometheus_exporter([0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 5,
|
mut exporter := metrics.new_prometheus_exporter()
|
||||||
10])
|
|
||||||
exporter.load('vieter_', app.collector)
|
exporter.load('vieter_', app.collector)
|
||||||
|
|
||||||
// TODO stream to connection instead
|
// TODO stream to connection instead
|
||||||
|
|
|
@ -92,12 +92,15 @@ pub fn server(conf Config) ! {
|
||||||
util.exit_with_message(1, 'Failed to initialize database: $err.msg()')
|
util.exit_with_message(1, 'Failed to initialize database: $err.msg()')
|
||||||
}
|
}
|
||||||
|
|
||||||
collector := if conf.collect_metrics {
|
mut collector := if conf.collect_metrics {
|
||||||
&metrics.MetricsCollector(metrics.new_default_collector())
|
&metrics.MetricsCollector(metrics.new_default_collector())
|
||||||
} else {
|
} else {
|
||||||
&metrics.MetricsCollector(metrics.new_null_collector())
|
&metrics.MetricsCollector(metrics.new_null_collector())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
collector.histogram_buckets_set('http_requests_duration_seconds', [0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 5,
|
||||||
|
10] )
|
||||||
|
|
||||||
mut app := &App{
|
mut app := &App{
|
||||||
logger: logger
|
logger: logger
|
||||||
api_key: conf.api_key
|
api_key: conf.api_key
|
||||||
|
|
Loading…
Reference in New Issue