fix: update IncReconnect for auth failures; import metric in proxy manager for observable callback

This commit is contained in:
Marc Schäfer
2025-10-08 00:32:39 +02:00
parent d74065a71b
commit 75d5e695d6
2 changed files with 2 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ import (
"github.com/fosrl/newt/internal/telemetry"
"github.com/fosrl/newt/logger"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
"golang.zx2c4.com/wireguard/tun/netstack"
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
)

View File

@@ -313,7 +313,7 @@ func (c *Client) getToken() (string, error) {
telemetry.IncConnError(context.Background(), "auth", bin)
// Reconnect reason mapping for auth failures
if resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusForbidden {
telemetry.IncReconnect(context.Background(), c.config.ID, telemetry.ReasonAuthError)
telemetry.IncReconnect(context.Background(), c.config.ID, "client", telemetry.ReasonAuthError)
}
return "", fmt.Errorf("failed to get token with status code: %d, body: %s", resp.StatusCode, string(body))
}