-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: Updates and Cleanup #89
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ dist: focal | |
language: go | ||
|
||
go: | ||
- 1.17.4 | ||
- 1.23.1 | ||
|
||
before_script: | ||
- sudo apt-get install varnish -y | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
module github.com/jonnenauha/prometheus_varnish_exporter | ||
|
||
go 1.12 | ||
go 1.22 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would go 1.22 be required? I get the version bump if deps require it, but im not using packages that need new APIs from later go releases. Prom seems to require go 1.21 so we should target that. https://github.com/prometheus/client_golang/blob/main/go.mod#L3 Despite what the go.mod says here, whatever go version you have will be used to build the binary. Its not like if you have go 1.23 installed and build it, it's not going to be be like you built it with go 1.12. go mod tells you the minimum version you can use to build the code. So if you are using features released in later go versions you can enforce it here. But I agree bumping the version up to 1.21 is sensible. It can probably enable some compiler features versus 1.12. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more note, the travis ci go version update is ofc importatnt as it pushes the offiicial releases to github. So that is great, I was more talking about the go.mod changes here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's just me bumping everything to latest, you are correct, we can set this to 1.21. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. EDIT: Actually, since 1.23 has been released this is no longer correct. I wouldn't set 1.21 here since it is no longer supported:
|
||
|
||
require github.com/prometheus/client_golang v1.11.0 | ||
require github.com/prometheus/client_golang v1.19.1 | ||
|
||
require ( | ||
github.com/beorn7/perks v1.0.1 // indirect | ||
github.com/cespare/xxhash/v2 v2.3.0 // indirect | ||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect | ||
github.com/prometheus/client_model v0.6.1 // indirect | ||
github.com/prometheus/common v0.55.0 // indirect | ||
github.com/prometheus/procfs v0.15.1 // indirect | ||
golang.org/x/sys v0.21.0 // indirect | ||
google.golang.org/protobuf v1.34.2 // indirect | ||
) |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,25 +114,25 @@ type group struct { | |
|
||
var ( | ||
groups = []group{ | ||
group{name: "backend", prefixes: []string{ | ||
{name: "backend", prefixes: []string{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what auto formatter are you using to remove the struct name here? i have never seen the official go fmt do this? I think this is an unnecessary change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the result of |
||
"vbe.", | ||
}}, | ||
group{name: "mempool", prefixes: []string{ | ||
{name: "mempool", prefixes: []string{ | ||
"mempool.", | ||
}}, | ||
group{name: "lck", prefixes: []string{ | ||
{name: "lck", prefixes: []string{ | ||
"lck.", | ||
}}, | ||
group{name: "sma", prefixes: []string{ | ||
{name: "sma", prefixes: []string{ | ||
"sma.", | ||
}}, | ||
group{name: "smf", prefixes: []string{ | ||
{name: "smf", prefixes: []string{ | ||
"smf.", | ||
}}, | ||
group{name: "mgt", prefixes: []string{ | ||
{name: "mgt", prefixes: []string{ | ||
"mgt.", | ||
}}, | ||
group{name: "main", prefixes: []string{ | ||
{name: "main", prefixes: []string{ | ||
"main.", | ||
}}, | ||
} | ||
|
@@ -148,18 +148,18 @@ type grouping struct { | |
|
||
var ( | ||
fqGroupPrefixes = []*grouping{ | ||
&grouping{ | ||
{ | ||
prefix: "main_fetch", | ||
total: "main_s_fetch", | ||
desc: "Number of fetches", | ||
}, | ||
&grouping{ | ||
{ | ||
newPrefix: "main_sessions", | ||
prefix: "main_sess", | ||
total: "main_s_sess", | ||
desc: "Number of sessions", | ||
}, | ||
&grouping{ | ||
{ | ||
newPrefix: "main_worker_threads", | ||
prefix: "main_n_wrk", | ||
total: "main_n_wrk", | ||
|
@@ -229,7 +229,7 @@ func cleanBackendName(name string) string { | |
if strings.HasPrefix(name, "reload_") { | ||
dot := strings.Index(name, ".") | ||
if dot != -1 { | ||
name = name[dot + 1:] | ||
name = name[dot+1:] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this certainly is not go fmt either right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's just standard $ git status
On branch master
Your branch is up to date with 'origin/master'.
$ go fmt ./prometheus.go
$ git diff
diff --git a/prometheus.go b/prometheus.go
index c54f642..533051e 100644
--- a/prometheus.go
+++ b/prometheus.go
@@ -229,7 +229,7 @@ func cleanBackendName(name string) string {
if strings.HasPrefix(name, "reload_") {
dot := strings.Index(name, ".")
if dot != -1 {
- name = name[dot + 1:]
+ name = name[dot+1:]
}
} |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so did you actually change any logic here or just run it through some auto formatter? i dont see the point, afaik the script was working fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither. Yes,
/bin/bash
will work fine on most systems, but in rare cases this path is not correct (NixOS comes to mind)./bin/env bash
ensures it works across the board. It's just good practice.