File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 4
4
"context"
5
5
"fmt"
6
6
"github.com/ldebruijn/graphql-protect/internal/app/config"
7
+ _ "github.com/ldebruijn/graphql-protect/internal/app/metrics"
7
8
"github.com/ldebruijn/graphql-protect/internal/app/otel"
8
9
"github.com/ldebruijn/graphql-protect/internal/business/protect"
9
10
"github.com/ldebruijn/graphql-protect/internal/business/rules/block_field_suggestions"
Original file line number Diff line number Diff line change
1
+ package metrics
2
+
3
+ import (
4
+ "github.com/prometheus/client_golang/prometheus"
5
+ "github.com/prometheus/client_golang/prometheus/collectors"
6
+ "regexp"
7
+ )
8
+
9
+ func init () {
10
+ // Register metrics from GoCollector collecting statistics from the Go Runtime.
11
+ // This enabled default, recommended metrics with the additional, recommended metric for
12
+ // goroutine scheduling latencies histogram that is currently bit too expensive for the default option.
13
+ //
14
+ // See the related GopherConUK talk to learn more: https://www.youtube.com/watch?v=18dyI_8VFa0
15
+
16
+ // Unregister the default GoCollector.
17
+ prometheus .Unregister (collectors .NewGoCollector ())
18
+
19
+ // Register the default GoCollector with a custom config.
20
+ prometheus .MustRegister (
21
+ collectors .NewGoCollector (
22
+ collectors .WithGoCollectorRuntimeMetrics (
23
+ collectors.GoRuntimeMetricsRule {Matcher : regexp .MustCompile ("/sched/latencies:seconds" )},
24
+ ),
25
+ ),
26
+ )
27
+ }
You can’t perform that action at this time.
0 commit comments