From 254ffe11664b11658344d66efc8349a466f8f1a2 Mon Sep 17 00:00:00 2001 From: Anna Kapuscinska Date: Mon, 31 Jul 2023 18:55:01 +0100 Subject: [PATCH] WIP Refactor metrics to avoid using promauto package Signed-off-by: Anna Kapuscinska --- pkg/grpc/tracing/stats.go | 7 ++-- pkg/metrics/errormetrics/errormetrics.go | 10 ++++-- .../eventcachemetrics/eventcachemetrics.go | 13 ++++--- pkg/metrics/eventmetrics/eventmetrics.go | 16 ++++++--- pkg/metrics/kprobemetrics/kprobemetrics.go | 13 ++++--- pkg/metrics/mapmetrics/mapmetrics.go | 10 ++++-- pkg/metrics/metrics.go | 34 ++++++++++++++++++- pkg/metrics/opcodemetrics/opcodemetrics.go | 10 ++++-- pkg/metrics/policyfilter/policyfilter.go | 7 ++-- .../processexecmetrics/processexecmetrics.go | 10 ++++-- pkg/metrics/ringbufmetrics/ringbufmetrics.go | 13 ++++--- pkg/metrics/syscallmetrics/syscallmetrics.go | 7 ++-- pkg/metrics/watchermetrics/watchermetrics.go | 10 ++++-- pkg/observer/data_stats.go | 10 ++++-- 14 files changed, 128 insertions(+), 42 deletions(-) diff --git a/pkg/grpc/tracing/stats.go b/pkg/grpc/tracing/stats.go index 839fa686c58..7ea04beab63 100644 --- a/pkg/grpc/tracing/stats.go +++ b/pkg/grpc/tracing/stats.go @@ -3,11 +3,10 @@ package tracing import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) var ( - LoaderStats = promauto.NewCounterVec(prometheus.CounterOpts{ + LoaderStats = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "process_loader_stats", Help: "Process Loader event statistics. For internal use only.", @@ -15,6 +14,10 @@ var ( }, []string{"count"}) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(LoaderStats) +} + type LoaderType int const ( diff --git a/pkg/metrics/errormetrics/errormetrics.go b/pkg/metrics/errormetrics/errormetrics.go index 14f7ba98753..4f117a04752 100644 --- a/pkg/metrics/errormetrics/errormetrics.go +++ b/pkg/metrics/errormetrics/errormetrics.go @@ -10,7 +10,6 @@ import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) type ErrorType string @@ -35,14 +34,14 @@ var ( ) var ( - ErrorTotal = promauto.NewCounterVec(prometheus.CounterOpts{ + ErrorTotal = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "errors_total", Help: "The total number of Tetragon errors. For internal use only.", ConstLabels: nil, }, []string{"type"}) - HandlerErrors = promauto.NewCounterVec(prometheus.CounterOpts{ + HandlerErrors = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "handler_errors_total", Help: "The total number of event handler errors. For internal use only.", @@ -50,6 +49,11 @@ var ( }, []string{"opcode", "error_type"}) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(ErrorTotal) + registry.MustRegister(HandlerErrors) +} + // Get a new handle on an ErrorTotal metric for an ErrorType func GetErrorTotal(t ErrorType) prometheus.Counter { return ErrorTotal.WithLabelValues(string(t)) diff --git a/pkg/metrics/eventcachemetrics/eventcachemetrics.go b/pkg/metrics/eventcachemetrics/eventcachemetrics.go index 3986191f3fc..40c374d4269 100644 --- a/pkg/metrics/eventcachemetrics/eventcachemetrics.go +++ b/pkg/metrics/eventcachemetrics/eventcachemetrics.go @@ -6,23 +6,22 @@ package eventcachemetrics import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) var ( - processInfoErrors = promauto.NewCounterVec(prometheus.CounterOpts{ + processInfoErrors = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "event_cache_process_info_errors_total", Help: "The total of times we failed to fetch cached process info for a given event type.", ConstLabels: nil, }, []string{"event_type"}) - podInfoErrors = promauto.NewCounterVec(prometheus.CounterOpts{ + podInfoErrors = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "event_cache_pod_info_errors_total", Help: "The total of times we failed to fetch cached pod info for a given event type.", ConstLabels: nil, }, []string{"event_type"}) - EventCacheCount = promauto.NewCounter(prometheus.CounterOpts{ + EventCacheCount = prometheus.NewCounter(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "event_cache_accesses_total", Help: "The total number of Tetragon event cache accesses. For internal use only.", @@ -30,6 +29,12 @@ var ( }) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(processInfoErrors) + registry.MustRegister(podInfoErrors) + registry.MustRegister(EventCacheCount) +} + // Get a new handle on an processInfoErrors metric for an eventType func ProcessInfoError(eventType string) prometheus.Counter { return processInfoErrors.WithLabelValues(eventType) diff --git a/pkg/metrics/eventmetrics/eventmetrics.go b/pkg/metrics/eventmetrics/eventmetrics.go index f730cef27e4..0c3a9b807eb 100644 --- a/pkg/metrics/eventmetrics/eventmetrics.go +++ b/pkg/metrics/eventmetrics/eventmetrics.go @@ -16,30 +16,29 @@ import ( "github.com/cilium/tetragon/pkg/reader/exec" "github.com/cilium/tetragon/pkg/tracingpolicy" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) var ( - EventsProcessed = promauto.NewCounterVec(prometheus.CounterOpts{ + EventsProcessed = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "events_total", Help: "The total number of Tetragon events", ConstLabels: nil, }, []string{"type", "namespace", "pod", "binary"}) - FlagCount = promauto.NewCounterVec(prometheus.CounterOpts{ + FlagCount = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "flags_total", Help: "The total number of Tetragon flags. For internal use only.", ConstLabels: nil, }, []string{"type"}) - NotifyOverflowedEvents = promauto.NewCounter(prometheus.CounterOpts{ + NotifyOverflowedEvents = prometheus.NewCounter(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "notify_overflowed_events_total", Help: "The total number of events dropped because listener buffer was full", ConstLabels: nil, }) - policyStats = promauto.NewCounterVec(prometheus.CounterOpts{ + policyStats = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "policy_events_total", Help: "Policy events calls observed.", @@ -47,6 +46,13 @@ var ( }, []string{"policy", "hook", "namespace", "pod", "binary"}) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(EventsProcessed) + registry.MustRegister(FlagCount) + registry.MustRegister(NotifyOverflowedEvents) + registry.MustRegister(policyStats) +} + func GetProcessInfo(process *tetragon.Process) (binary, pod, namespace string) { if process != nil { binary = process.Binary diff --git a/pkg/metrics/kprobemetrics/kprobemetrics.go b/pkg/metrics/kprobemetrics/kprobemetrics.go index be0debadf9e..2f2adc988f1 100644 --- a/pkg/metrics/kprobemetrics/kprobemetrics.go +++ b/pkg/metrics/kprobemetrics/kprobemetrics.go @@ -6,23 +6,22 @@ package kprobemetrics import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) var ( - MergeErrors = promauto.NewCounterVec(prometheus.CounterOpts{ + MergeErrors = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "generic_kprobe_merge_errors_total", Help: "The total number of failed attempts to merge a kprobe and kretprobe event.", ConstLabels: nil, }, []string{"curr_fn", "curr_type", "prev_fn", "prev_type"}) - MergeOkTotal = promauto.NewCounter(prometheus.CounterOpts{ + MergeOkTotal = prometheus.NewCounter(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "generic_kprobe_merge_ok_total", Help: "The total number of successful attempts to merge a kprobe and kretprobe event.", ConstLabels: nil, }) - MergePushed = promauto.NewCounter(prometheus.CounterOpts{ + MergePushed = prometheus.NewCounter(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "generic_kprobe_merge_pushed_total", Help: "The total number of pushed events for later merge.", @@ -30,6 +29,12 @@ var ( }) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(MergeErrors) + registry.MustRegister(MergeOkTotal) + registry.MustRegister(MergePushed) +} + // Get a new handle on the mergeErrors metric for a current and previous function // name and probe type func GetMergeErrors(currFn, currType, prevFn, prevType string) prometheus.Counter { diff --git a/pkg/metrics/mapmetrics/mapmetrics.go b/pkg/metrics/mapmetrics/mapmetrics.go index 464e6473445..fe5494c653e 100644 --- a/pkg/metrics/mapmetrics/mapmetrics.go +++ b/pkg/metrics/mapmetrics/mapmetrics.go @@ -8,18 +8,17 @@ import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) var ( - MapSize = promauto.NewGaugeVec(prometheus.GaugeOpts{ + MapSize = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: consts.MetricsNamespace, Name: "map_in_use_gauge", Help: "The total number of in-use entries per map.", ConstLabels: nil, }, []string{"map", "total"}) - MapDrops = promauto.NewCounterVec(prometheus.CounterOpts{ + MapDrops = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "map_drops_total", Help: "The total number of entries dropped per LRU map.", @@ -27,6 +26,11 @@ var ( }, []string{"map"}) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(MapSize) + registry.MustRegister(MapDrops) +} + // Get a new handle on a mapSize metric for a mapName and totalCapacity func GetMapSize(mapName string, totalCapacity int) prometheus.Gauge { return MapSize.WithLabelValues(mapName, fmt.Sprint(totalCapacity)) diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index e7e4d41723c..2d8dce9ac2d 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -6,12 +6,44 @@ package metrics import ( "net/http" + "github.com/cilium/tetragon/pkg/grpc/tracing" "github.com/cilium/tetragon/pkg/logger" + "github.com/cilium/tetragon/pkg/metrics/errormetrics" + "github.com/cilium/tetragon/pkg/metrics/eventcachemetrics" + "github.com/cilium/tetragon/pkg/metrics/eventmetrics" + "github.com/cilium/tetragon/pkg/metrics/kprobemetrics" + "github.com/cilium/tetragon/pkg/metrics/mapmetrics" + "github.com/cilium/tetragon/pkg/metrics/opcodemetrics" + pfmetrics "github.com/cilium/tetragon/pkg/metrics/policyfilter" + "github.com/cilium/tetragon/pkg/metrics/processexecmetrics" + "github.com/cilium/tetragon/pkg/metrics/ringbufmetrics" + "github.com/cilium/tetragon/pkg/metrics/syscallmetrics" + "github.com/cilium/tetragon/pkg/metrics/watchermetrics" + "github.com/cilium/tetragon/pkg/observer" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" ) +func InitAllMetrics(registry *prometheus.Registry) { + errormetrics.InitMetrics(registry) + eventcachemetrics.InitMetrics(registry) + eventmetrics.InitMetrics(registry) + kprobemetrics.InitMetrics(registry) + mapmetrics.InitMetrics(registry) + opcodemetrics.InitMetrics(registry) + pfmetrics.InitMetrics(registry) + processexecmetrics.InitMetrics(registry) + ringbufmetrics.InitMetrics(registry) + syscallmetrics.InitMetrics(registry) + watchermetrics.InitMetrics(registry) + observer.InitMetrics(registry) + tracing.InitMetrics(registry) +} + func EnableMetrics(address string) { + reg := prometheus.NewRegistry() + InitAllMetrics(reg) logger.GetLogger().WithField("addr", address).Info("Starting metrics server") - http.Handle("/metrics", promhttp.Handler()) + http.Handle("/metrics", promhttp.HandlerFor(reg, promhttp.HandlerOpts{Registry: reg})) http.ListenAndServe(address, nil) } diff --git a/pkg/metrics/opcodemetrics/opcodemetrics.go b/pkg/metrics/opcodemetrics/opcodemetrics.go index 18b7cc01d0a..e5d2b397afc 100644 --- a/pkg/metrics/opcodemetrics/opcodemetrics.go +++ b/pkg/metrics/opcodemetrics/opcodemetrics.go @@ -8,18 +8,17 @@ import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) var ( - MsgOpsCount = promauto.NewCounterVec(prometheus.CounterOpts{ + MsgOpsCount = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "msg_op_total", Help: "The total number of times we encounter a given message opcode. For internal use only.", ConstLabels: nil, }, []string{"msg_op"}) - LatencyStats = promauto.NewHistogramVec(prometheus.HistogramOpts{ + LatencyStats = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Namespace: consts.MetricsNamespace, Name: "handling_latency", Help: "The latency of handling messages in us.", @@ -28,6 +27,11 @@ var ( }, []string{"op"}) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(MsgOpsCount) + registry.MustRegister(LatencyStats) +} + // Get a new handle on a msgOpsCount metric for an OpCode func GetOpTotal(op int) prometheus.Counter { return MsgOpsCount.WithLabelValues(fmt.Sprint(op)) diff --git a/pkg/metrics/policyfilter/policyfilter.go b/pkg/metrics/policyfilter/policyfilter.go index ad34cbdc922..d79ac0c59b7 100644 --- a/pkg/metrics/policyfilter/policyfilter.go +++ b/pkg/metrics/policyfilter/policyfilter.go @@ -10,11 +10,10 @@ import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) var ( - PolicyFilterOpMetrics = promauto.NewCounterVec(prometheus.CounterOpts{ + PolicyFilterOpMetrics = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "policyflter_metrics_total", Help: "Policy filter metrics. For internal use only.", @@ -22,6 +21,10 @@ var ( }, []string{"subsys", "op", "error_type"}) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(PolicyFilterOpMetrics) +} + func OpInc(subsys, op string, err error) { PolicyFilterOpMetrics.WithLabelValues( subsys, op, diff --git a/pkg/metrics/processexecmetrics/processexecmetrics.go b/pkg/metrics/processexecmetrics/processexecmetrics.go index 095b883b81d..433e635335f 100644 --- a/pkg/metrics/processexecmetrics/processexecmetrics.go +++ b/pkg/metrics/processexecmetrics/processexecmetrics.go @@ -6,17 +6,16 @@ package processexecmetrics import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) var ( - MissingParentErrors = promauto.NewCounterVec(prometheus.CounterOpts{ + MissingParentErrors = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "exec_missing_parent_errors_total", Help: "The total of times a given parent exec id could not be found in an exec event.", ConstLabels: nil, }, []string{"parent_exec_id"}) - SameExecIdErrors = promauto.NewCounterVec(prometheus.CounterOpts{ + SameExecIdErrors = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "exec_parent_child_same_id_errors_total", Help: "The total of times an error occurs due to a parent and child process have the same exec id.", @@ -24,6 +23,11 @@ var ( }, []string{"exec_id"}) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(MissingParentErrors) + registry.MustRegister(SameExecIdErrors) +} + // Get a new handle on the missingParentErrors metric for an execId func GetMissingParent(execId string) prometheus.Counter { return MissingParentErrors.WithLabelValues(execId) diff --git a/pkg/metrics/ringbufmetrics/ringbufmetrics.go b/pkg/metrics/ringbufmetrics/ringbufmetrics.go index 4fd01dc3c2b..92ebc57b542 100644 --- a/pkg/metrics/ringbufmetrics/ringbufmetrics.go +++ b/pkg/metrics/ringbufmetrics/ringbufmetrics.go @@ -6,26 +6,31 @@ package ringbufmetrics import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) var ( - PerfEventReceived = promauto.NewCounter(prometheus.CounterOpts{ + PerfEventReceived = prometheus.NewCounter(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "ringbuf_perf_event_received_total", Help: "The total number of Tetragon ringbuf perf events received.", ConstLabels: nil, }) - PerfEventLost = promauto.NewCounter(prometheus.CounterOpts{ + PerfEventLost = prometheus.NewCounter(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "ringbuf_perf_event_lost_total", Help: "The total number of Tetragon ringbuf perf events lost.", ConstLabels: nil, }) - PerfEventErrors = promauto.NewCounter(prometheus.CounterOpts{ + PerfEventErrors = prometheus.NewCounter(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "ringbuf_perf_event_errors_total", Help: "The total number of errors when reading the Tetragon ringbuf.", ConstLabels: nil, }) ) + +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(PerfEventReceived) + registry.MustRegister(PerfEventLost) + registry.MustRegister(PerfEventErrors) +} diff --git a/pkg/metrics/syscallmetrics/syscallmetrics.go b/pkg/metrics/syscallmetrics/syscallmetrics.go index 91f35c1e81a..0f7c5a5ed7e 100644 --- a/pkg/metrics/syscallmetrics/syscallmetrics.go +++ b/pkg/metrics/syscallmetrics/syscallmetrics.go @@ -8,11 +8,10 @@ import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/cilium/tetragon/pkg/syscallinfo" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) var ( - syscallStats = promauto.NewCounterVec(prometheus.CounterOpts{ + syscallStats = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "syscalls_total", Help: "System calls observed.", @@ -20,6 +19,10 @@ var ( }, []string{"syscall", "namespace", "pod", "binary"}) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(syscallStats) +} + func Handle(event interface{}) { ev, ok := event.(*tetragon.GetEventsResponse) if !ok { diff --git a/pkg/metrics/watchermetrics/watchermetrics.go b/pkg/metrics/watchermetrics/watchermetrics.go index e26221fdb51..aae32f22473 100644 --- a/pkg/metrics/watchermetrics/watchermetrics.go +++ b/pkg/metrics/watchermetrics/watchermetrics.go @@ -6,7 +6,6 @@ package watchermetrics import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) type ErrorType string @@ -16,13 +15,13 @@ const ( ) var ( - WatcherErrors = promauto.NewCounterVec(prometheus.CounterOpts{ + WatcherErrors = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "watcher_errors_total", Help: "The total number of errors for a given watcher type.", ConstLabels: nil, }, []string{"watcher", "error"}) - WatcherEvents = promauto.NewCounterVec(prometheus.CounterOpts{ + WatcherEvents = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "watcher_events_total", Help: "The total number of events for a given watcher type.", @@ -30,6 +29,11 @@ var ( }, []string{"watcher"}) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(WatcherErrors) + registry.MustRegister(WatcherEvents) +} + // Get a new handle on an WatcherEvents metric for a watcher type func GetWatcherEvents(watcherType string) prometheus.Counter { return WatcherEvents.WithLabelValues(watcherType) diff --git a/pkg/observer/data_stats.go b/pkg/observer/data_stats.go index e1c68a493a4..f967058e26d 100644 --- a/pkg/observer/data_stats.go +++ b/pkg/observer/data_stats.go @@ -6,19 +6,18 @@ package observer import ( "github.com/cilium/tetragon/pkg/metrics/consts" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" ) var ( // Define a counter metric for data event statistics - DataEventStats = promauto.NewCounterVec(prometheus.CounterOpts{ + DataEventStats = prometheus.NewCounterVec(prometheus.CounterOpts{ Namespace: consts.MetricsNamespace, Name: "data_events_total", Help: "The number of data events by type. For internal use only.", ConstLabels: nil, }, []string{"event"}) - DataEventSizeHist = promauto.NewHistogramVec(prometheus.HistogramOpts{ + DataEventSizeHist = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Namespace: consts.MetricsNamespace, Name: "data_event_size", Help: "The size of received data events.", @@ -27,6 +26,11 @@ var ( }, []string{"op"}) ) +func InitMetrics(registry *prometheus.Registry) { + registry.MustRegister(DataEventStats) + registry.MustRegister(DataEventSizeHist) +} + type DataEventType int const (