Add metrics

This commit is contained in:
Zoltán Papp
2024-07-24 16:26:26 +02:00
parent 4802b83ef9
commit ecb6f0831e
6 changed files with 156 additions and 53 deletions

View File

@@ -8,6 +8,7 @@ import (
"time"
log "github.com/sirupsen/logrus"
"go.opentelemetry.io/otel/metric"
"github.com/netbirdio/netbird/relay/auth"
"github.com/netbirdio/netbird/relay/server/listener"
@@ -26,14 +27,14 @@ type Server struct {
wSListener listener.Listener
}
func NewServer(exposedAddress string, tlsSupport bool, authValidator auth.Validator) *Server {
return &Server{
relay: NewRelay(
exposedAddress,
tlsSupport,
authValidator,
),
func NewServer(meter metric.Meter, exposedAddress string, tlsSupport bool, authValidator auth.Validator) (*Server, error) {
relay, err := NewRelay(meter, exposedAddress, tlsSupport, authValidator)
if err != nil {
return nil, err
}
return &Server{
relay: relay,
}, nil
}
func (r *Server) Listen(cfg ListenerConfig) error {