From cb37416767ea3c18cf146d398d023d542af82dc4 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Fri, 5 Dec 2025 18:06:37 +0000 Subject: [PATCH 1/2] prometheus-tailscale-exporter: 0.2.5 -> 0.3.0 --- pkgs/by-name/pr/prometheus-tailscale-exporter/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/pr/prometheus-tailscale-exporter/package.nix b/pkgs/by-name/pr/prometheus-tailscale-exporter/package.nix index f3b1c215b052..a82c2cba2509 100644 --- a/pkgs/by-name/pr/prometheus-tailscale-exporter/package.nix +++ b/pkgs/by-name/pr/prometheus-tailscale-exporter/package.nix @@ -8,16 +8,16 @@ buildGoModule (finalAttrs: { pname = "tailscale-exporter"; - version = "0.2.5"; + version = "0.3.0"; src = fetchFromGitHub { owner = "adinhodovic"; repo = "tailscale-exporter"; tag = finalAttrs.version; - hash = "sha256-6iQtGfQsXVmwFaSA7B1AG+kbtSyKVWFbEld1lMb0DnE="; + hash = "sha256-zZxKTEm23iXv4qYwx6gBtBuz5pduuIXLwMX0ZrrYxZs="; }; - vendorHash = "sha256-Nbx6LyGGhdgI4oEtbyqhJ2H1lY6BfSL/ROH/Dh4UOk0="; + vendorHash = "sha256-WHtmis8r62th90BrM+f63yuyRkW4bVT/vPDfcIJ3Fg8="; subPackages = [ "cmd/tailscale-exporter" From a6ad58384a4b015652b297da68cf810b79a1821f Mon Sep 17 00:00:00 2001 From: squat Date: Fri, 26 Dec 2025 15:22:27 +0100 Subject: [PATCH 2/2] nixosTests.prometheus-exporters.tailscale: unbreak Fix the patch applied to the tailscale-exporter since the upstream code changed significantly in version 0.3.0. Signed-off-by: squat --- nixos/tests/prometheus-exporters.nix | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix index 5374661cb4cf..3a70bd554e1e 100644 --- a/nixos/tests/prometheus-exporters.nix +++ b/nixos/tests/prometheus-exporters.nix @@ -1901,24 +1901,23 @@ let # testing the NixOS module. (pkgs.writeText "allow-running-without-credentials" '' diff --git a/cmd/tailscale-exporter/root.go b/cmd/tailscale-exporter/root.go - index 2ff11cb..2fb576f 100644 + index 14089f9..2bb9a25 100644 --- a/cmd/tailscale-exporter/root.go +++ b/cmd/tailscale-exporter/root.go - @@ -137,14 +137,6 @@ func runExporter(cmd *cobra.Command, args []string) error { - ''\t// Create HTTP client that automatically handles token refresh - ''\thttpClient := oauthConfig.Client(context.Background()) + @@ -162,13 +162,6 @@ func runExporter(cmd *cobra.Command, args []string) error { + ''\t''\t} - -''\t// Test OAuth token generation - -''\ttoken, err := oauthConfig.Token(context.Background()) - -''\tif err != nil { - -''\t''\treturn fmt.Errorf("failed to obtain OAuth token: %w", err) - -''\t} - -''\tlogger.Info("OAuth token obtained", "token_type", token.TokenType) - -''\tlogger.Info("Successfully obtained OAuth token", "expires", token.Expiry) + ''\t''\thttpClient := oauthConfig.Client(context.Background()) + -''\t''\ttoken, err := oauthConfig.Token(context.Background()) + -''\t''\tif err != nil { + -''\t''\t''\treturn fmt.Errorf("failed to obtain OAuth token: %w", err) + -''\t''\t} + -''\t''\tlogger.Info("OAuth token obtained", "token_type", token.TokenType) + -''\t''\tlogger.Info("Successfully obtained OAuth token", "expires", token.Expiry) - - ''\t// Default labels for all metrics - ''\tdefaultLabels := prometheus.Labels{"tailnet": tailnet} - ''\treg := prometheus.WrapRegistererWith( + ''\t''\ttsCollector, err := tailscale.NewTailscaleCollector( + ''\t''\t''\tlogger, + ''\t''\t''\thttpClient, '') ]; };