mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
Remove unused bloom filter, test helpers, metrics scaffolding, and linearizable VM wrapper. Trim stale go.sum entries. Add genesis builder helpers and xvm FX/genesis initialization.
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package server
|
|
|
|
import (
|
|
"github.com/luxfi/metric"
|
|
)
|
|
|
|
type serverMetrics struct {
|
|
requests metric.CounterVec
|
|
duration metric.HistogramVec
|
|
inflight metric.Gauge
|
|
}
|
|
|
|
func newMetrics(registerer metric.Registerer) (*serverMetrics, error) {
|
|
m := &serverMetrics{
|
|
requests: registerer.NewCounterVec("api_requests_total", "Total number of API requests", []string{"method", "endpoint"}),
|
|
duration: registerer.NewHistogramVec("api_request_duration_seconds", "API request duration in seconds", []string{"method", "endpoint"}, nil),
|
|
inflight: registerer.NewGauge("api_requests_inflight", "Number of inflight API requests"),
|
|
}
|
|
|
|
if err := registerer.Register(metric.AsCollector(m.requests)); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := registerer.Register(metric.AsCollector(m.duration)); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := registerer.Register(metric.AsCollector(m.inflight)); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return m, nil
|
|
}
|
|
|