mirror of
https://github.com/fosrl/newt.git
synced 2026-03-26 20:46:41 +00:00
fix: update IncReconnect for auth failures; import metric in proxy manager for observable callback
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/fosrl/newt/internal/telemetry"
|
"github.com/fosrl/newt/internal/telemetry"
|
||||||
"github.com/fosrl/newt/logger"
|
"github.com/fosrl/newt/logger"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/metric"
|
||||||
"golang.zx2c4.com/wireguard/tun/netstack"
|
"golang.zx2c4.com/wireguard/tun/netstack"
|
||||||
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
|
"gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ func (c *Client) getToken() (string, error) {
|
|||||||
telemetry.IncConnError(context.Background(), "auth", bin)
|
telemetry.IncConnError(context.Background(), "auth", bin)
|
||||||
// Reconnect reason mapping for auth failures
|
// Reconnect reason mapping for auth failures
|
||||||
if resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusForbidden {
|
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))
|
return "", fmt.Errorf("failed to get token with status code: %d, body: %s", resp.StatusCode, string(body))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user