| 1 | package mainscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/ |
| 2 | |
| 3 | import ( |
| 4 | "flagscip-go gomod github.com/golang/go/src go1.25.0 flag/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 6 | "log/slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/" |
| 7 | "net/httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/" |
| 8 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 9 | "syncscip-go gomod github.com/golang/go/src go1.25.0 sync/" |
| 10 | "timescip-go gomod github.com/golang/go/src go1.25.0 time/" |
| 11 | |
| 12 | "github.com/prometheus/client_golang/prometheusscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus`/" |
| 13 | "github.com/prometheus/client_golang/prometheus/promhttpscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus/promhttp`/" |
| 14 | ) |
| 15 | |
| 16 | var ( |
| 17 | ApplicationNamescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/ApplicationName. = "prometheus_varnish_exporter" |
| 18 | Versionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/Version. string |
| 19 | VersionHashscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/VersionHash. string |
| 20 | VersionDatescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/VersionDate. string |
| 21 | |
| 22 | PrometheusExporterscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/PrometheusExporter. = NewPrometheusExporterscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/NewPrometheusExporter().() |
| 23 | VarnishVersionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/VarnishVersion. = NewVarnishVersionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/NewVarnishVersion().() |
| 24 | ExitHandlerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/ExitHandler. = &exitHandlerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#{} |
| 25 | |
| 26 | StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams. = &startParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#{ |
| 27 | ListenAddressscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#ListenAddress.: ":9131", // Reserved and publicly announced at https://github.com/prometheus/prometheus/wiki/Default-port-allocations |
| 28 | Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path.: "/metrics", |
| 29 | VarnishstatExescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#VarnishstatExe.: "varnishstat", |
| 30 | Paramsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Params.: &varnishstatParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#{}, |
| 31 | LogLevelscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#LogLevel.: "info", |
| 32 | } |
| 33 | ) |
| 34 | |
| 35 | type startParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams# struct { |
| 36 | ListenAddressscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#ListenAddress. string |
| 37 | Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path. string |
| 38 | HealthPathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#HealthPath. string |
| 39 | VarnishstatExescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#VarnishstatExe. string |
| 40 | VarnishDockerContainerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#VarnishDockerContainer. string |
| 41 | Paramsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Params. *varnishstatParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams# |
| 42 | |
| 43 | Verbosescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Verbose. bool // deprecated |
| 44 | ExitOnErrorsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#ExitOnErrors. bool |
| 45 | Testscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Test. bool |
| 46 | Rawscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Raw. bool // deprecated |
| 47 | WithGoMetricsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#WithGoMetrics. bool |
| 48 | |
| 49 | // logging |
| 50 | LogLevelscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#LogLevel. string |
| 51 | LogJSONscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#LogJSON. bool |
| 52 | |
| 53 | noExitscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#noExit. bool // deprecated |
| 54 | } |
| 55 | |
| 56 | type varnishstatParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams# struct { |
| 57 | Instancescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#Instance. string |
| 58 | VSMscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#VSM. string |
| 59 | } |
| 60 | |
| 61 | func (p *varnishstatParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#) isEmptyscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#isEmpty().() bool { |
| 62 | return p.Instancescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#Instance. == "" && p.VSMscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#VSM. == "" |
| 63 | } |
| 64 | |
| 65 | func (p *varnishstatParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#) makescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#make().() (params []string) { |
| 66 | // -n |
| 67 | if p.Instancescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#Instance. != "" { |
| 68 | params = append(params, "-n", p.Instancescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#Instance.) |
| 69 | } |
| 70 | // -N is not supported by 3.x |
| 71 | if p.VSMscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#VSM. != "" && VarnishVersionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/VarnishVersion..EqualsOrGreaterscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishVersion#EqualsOrGreater().(4, 0) { |
| 72 | params = append(params, "-N", p.VSMscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#VSM.) |
| 73 | } |
| 74 | return params |
| 75 | } |
| 76 | |
| 77 | func mainscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/main().() { |
| 78 | // prometheus conventions |
| 79 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.StringVarscip-go gomod github.com/golang/go/src go1.25.0 flag/StringVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..ListenAddressscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#ListenAddress., "web.listen-address", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..ListenAddressscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#ListenAddress., "Address on which to expose metrics and web interface.") |
| 80 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.StringVarscip-go gomod github.com/golang/go/src go1.25.0 flag/StringVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path., "web.telemetry-path", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path., "Path under which to expose metrics.") |
| 81 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.StringVarscip-go gomod github.com/golang/go/src go1.25.0 flag/StringVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..HealthPathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#HealthPath., "web.health-path", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..HealthPathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#HealthPath., "Path under which to expose healthcheck. Disabled unless configured.") |
| 82 | |
| 83 | // varnish |
| 84 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.StringVarscip-go gomod github.com/golang/go/src go1.25.0 flag/StringVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..VarnishstatExescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#VarnishstatExe., "varnishstat-path", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..VarnishstatExescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#VarnishstatExe., "Path to varnishstat.") |
| 85 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.StringVarscip-go gomod github.com/golang/go/src go1.25.0 flag/StringVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Paramsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Params..Instancescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#Instance., "n", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Paramsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Params..Instancescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#Instance., "varnishstat -n value.") |
| 86 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.StringVarscip-go gomod github.com/golang/go/src go1.25.0 flag/StringVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Paramsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Params..VSMscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#VSM., "N", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Paramsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Params..VSMscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishstatParams#VSM., "varnishstat -N value.") |
| 87 | |
| 88 | // docker |
| 89 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.StringVarscip-go gomod github.com/golang/go/src go1.25.0 flag/StringVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..VarnishDockerContainerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#VarnishDockerContainer., "docker-container-name", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..VarnishDockerContainerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#VarnishDockerContainer., "Docker container name to exec varnishstat in.") |
| 90 | |
| 91 | // logging |
| 92 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.StringVarscip-go gomod github.com/golang/go/src go1.25.0 flag/StringVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..LogLevelscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#LogLevel., "log-level", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..LogLevelscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#LogLevel., "Log level: debug, info, warn, error") |
| 93 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.BoolVarscip-go gomod github.com/golang/go/src go1.25.0 flag/BoolVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..LogJSONscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#LogJSON., "log-json", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..LogJSONscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#LogJSON., "Log in JSON format") |
| 94 | |
| 95 | // modes |
| 96 | version := false |
| 97 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.BoolVarscip-go gomod github.com/golang/go/src go1.25.0 flag/BoolVar().(&version, "version", version, "Print version and exit") |
| 98 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.BoolVarscip-go gomod github.com/golang/go/src go1.25.0 flag/BoolVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..ExitOnErrorsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#ExitOnErrors., "exit-on-errors", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..ExitOnErrorsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#ExitOnErrors., "Exit process on scrape errors.") |
| 99 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.BoolVarscip-go gomod github.com/golang/go/src go1.25.0 flag/BoolVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Testscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Test., "test", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Testscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Test., "Test varnishstat availability, prints available metrics and exits.") |
| 100 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.BoolVarscip-go gomod github.com/golang/go/src go1.25.0 flag/BoolVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..WithGoMetricsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#WithGoMetrics., "with-go-metrics", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..WithGoMetricsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#WithGoMetrics., "Export go runtime and http handler metrics") |
| 101 | |
| 102 | // deprecated |
| 103 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.BoolVarscip-go gomod github.com/golang/go/src go1.25.0 flag/BoolVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Rawscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Raw., "raw", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Testscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Test., "Deprecated: Raw stdout logging without timestamps.") |
| 104 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.BoolVarscip-go gomod github.com/golang/go/src go1.25.0 flag/BoolVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Verbosescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Verbose., "verbose", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Verbosescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Verbose., "Deprecated: Verbose logging.") |
| 105 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.BoolVarscip-go gomod github.com/golang/go/src go1.25.0 flag/BoolVar().(&StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..noExitscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#noExit., "no-exit", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..noExitscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#noExit., "Deprecated: see -exit-on-errors") |
| 106 | |
| 107 | flagscip-go gomod github.com/golang/go/src go1.25.0 flag/.Parsescip-go gomod github.com/golang/go/src go1.25.0 flag/Parse().() |
| 108 | |
| 109 | if version { |
| 110 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Printf().("%s %s\n", ApplicationNamescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/ApplicationName., getVersionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/getVersion().(true)) |
| 111 | osscip-go gomod github.com/golang/go/src go1.25.0 os/.Exitscip-go gomod github.com/golang/go/src go1.25.0 os/Exit().(0) |
| 112 | } |
| 113 | |
| 114 | if StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Verbosescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Verbose. || StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Rawscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Raw. { |
| 115 | slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Warnscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Warn().("-verbose and -raw are deprecated and have no effect. These flags will be removed in a future release. Use -log-level=debug and -log-json=false instead.") |
| 116 | } |
| 117 | |
| 118 | initSloggerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/initSlogger().(StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..LogLevelscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#LogLevel., StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..LogJSONscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#LogJSON.) |
| 119 | |
| 120 | if len(StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path.) == 0 || StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path.[0] != '/' { |
| 121 | logFatalscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/logFatal().("-web.telemetry-path cannot be empty and must start with a slash '/'", "path", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path.) |
| 122 | } |
| 123 | if len(StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..HealthPathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#HealthPath.) != 0 && StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..HealthPathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#HealthPath.[0] != '/' { |
| 124 | logFatalscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/logFatal().("-web.health-path must start with a slash '/' if configured", "path", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..HealthPathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#HealthPath.) |
| 125 | } |
| 126 | if StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path. == StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..HealthPathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#HealthPath. { |
| 127 | logFatalscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/logFatal().("-web.telemetry-path and -web.health-path cannot have same value") |
| 128 | } |
| 129 | |
| 130 | // Don't log warning on !noExit as that would spam for the formed default value. |
| 131 | if StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..noExitscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#noExit. { |
| 132 | slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Warnscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Warn().("-no-exit is deprecated. As of v1.5 it is the default behavior not to exit process on scrape errors. You can remove this parameter.") |
| 133 | } |
| 134 | |
| 135 | // Test run or user explicitly wants to exit on any scrape errors during runtime. |
| 136 | ExitHandlerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/ExitHandler..exitOnErrorscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#exitOnError. = StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Testscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Test. == true || StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..ExitOnErrorsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#ExitOnErrors. == true |
| 137 | |
| 138 | slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Infoscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Info().("Initializing application", "applicationName", ApplicationNamescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/ApplicationName., "applicationVersion", getVersionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/getVersion().(false), "parameters", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams.) |
| 139 | |
| 140 | // Initialize |
| 141 | if err := VarnishVersionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/VarnishVersion..Initializescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishVersion#Initialize().(); err != nil { |
| 142 | ExitHandlerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/ExitHandler..Errorfscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#Errorf().("Varnish version initialize failed: %s", err.Error()) |
| 143 | } |
| 144 | if VarnishVersionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/VarnishVersion..Validscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/varnishVersion#Valid().() { |
| 145 | slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Infoscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Info().("Found varnishstat.", "varnishVersion", VarnishVersionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/VarnishVersion.) |
| 146 | if err := PrometheusExporterscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/PrometheusExporter..Initializescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/prometheusExporter#Initialize().(); err != nil { |
| 147 | logFatalscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/logFatal().("Prometheus exporter initialize failed", "error", err.Error()) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | // Test to verify everything is ok before starting the server |
| 152 | { |
| 153 | done := make(chan bool) |
| 154 | metrics := make(chan prometheusscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus`/.Metricscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus`/Metric#) |
| 155 | go func() { |
| 156 | for m := range metrics { |
| 157 | if StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Testscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Test. { |
| 158 | slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Infoscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Info().(m.Descscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus`/Metric#Desc().().Stringscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus`/Desc#String().()) |
| 159 | } |
| 160 | } |
| 161 | done <- true |
| 162 | }() |
| 163 | tStart := timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().() |
| 164 | buf, err := ScrapeVarnishscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/ScrapeVarnish().(metrics) |
| 165 | close(metrics) |
| 166 | <-done |
| 167 | |
| 168 | if err == nil { |
| 169 | slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Infoscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Info().("Test scrape done", "duration", timescip-go gomod github.com/golang/go/src go1.25.0 time/.Sincescip-go gomod github.com/golang/go/src go1.25.0 time/Since().(tStart)) |
| 170 | } else { |
| 171 | if len(buf) > 0 { |
| 172 | slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Debugscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Debug().("Scrape output", "output", string(buf)) |
| 173 | } |
| 174 | ExitHandlerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/ExitHandler..Errorfscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#Errorf().("Startup test: %s", err.Error()) |
| 175 | } |
| 176 | } |
| 177 | if StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Testscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Test. { |
| 178 | return |
| 179 | } |
| 180 | |
| 181 | // Start serving |
| 182 | slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Infoscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Info().("Server starting", "listenAddress", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..ListenAddressscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#ListenAddress., "metricsPath", StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path.) |
| 183 | |
| 184 | if !StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..WithGoMetricsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#WithGoMetrics. { |
| 185 | registry := prometheusscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus`/.NewRegistryscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus`/NewRegistry().() |
| 186 | if err := registry.Registerscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus`/Registry#Register().(PrometheusExporterscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/PrometheusExporter.); err != nil { |
| 187 | logFatalscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/logFatal().("registry.Register failed: %s", err.Error()) |
| 188 | } |
| 189 | handler := promhttpscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus/promhttp`/.HandlerForscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus/promhttp`/HandlerFor().(registry, promhttpscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus/promhttp`/.HandlerOptsscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus/promhttp`/HandlerOpts#{ |
| 190 | ErrorLogscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus/promhttp`/HandlerOpts#ErrorLog.: &SlogErrorLoggerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/SlogErrorLogger#{slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Defaultscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Default().()}, |
| 191 | }) |
| 192 | httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Handlescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Handle().(StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path., handler) |
| 193 | } else { |
| 194 | prometheusscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus`/.MustRegisterscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus`/MustRegister().(PrometheusExporterscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/PrometheusExporter.) |
| 195 | httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Handlescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Handle().(StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path., promhttpscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus/promhttp`/.Handlerscip-go gomod github.com/prometheus/client_golang v1.23.2 `github.com/prometheus/client_golang/prometheus/promhttp`/Handler().()) |
| 196 | } |
| 197 | |
| 198 | if StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path. != "/" { |
| 199 | httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandleFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandleFunc().("/", func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) { |
| 200 | w.Writescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#Write().([]byte(`<html> |
| 201 | <head><title>Varnish Exporter</title></head> |
| 202 | <body> |
| 203 | <h1>Varnish Exporter</h1> |
| 204 | <p><a href="` + StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..Pathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#Path. + `">Metrics</a></p> |
| 205 | </body> |
| 206 | </html>`)) |
| 207 | }) |
| 208 | } |
| 209 | if StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..HealthPathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#HealthPath. != "" { |
| 210 | httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.HandleFuncscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/HandleFunc().(StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..HealthPathscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#HealthPath., func(w httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Request#) { |
| 211 | // As noted in the "up" metric, needs some way to determine if everything is actually Ok. |
| 212 | // For now, this just lets us check that we're accepting connections |
| 213 | w.WriteHeaderscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ResponseWriter#WriteHeader().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.StatusOKscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/StatusOK.) |
| 214 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintlnscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprintln().(w, "Ok") |
| 215 | }) |
| 216 | } |
| 217 | logFatalErrorscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/logFatalError().(httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.ListenAndServescip-go gomod github.com/golang/go/src go1.25.0 `net/http`/ListenAndServe().(StartParamsscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/StartParams..ListenAddressscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/startParams#ListenAddress., nil)) |
| 218 | } |
| 219 | |
| 220 | type exitHandlerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler# struct { |
| 221 | syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.RWMutexscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#RWMutex. |
| 222 | exitOnErrorscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#exitOnError. bool |
| 223 | errscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#err. error |
| 224 | } |
| 225 | |
| 226 | func (ex *exitHandlerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#) Errorfscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#Errorf().(format string, a ...any) error { |
| 227 | return ex.Setscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#Set().(fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().(format, a...)) |
| 228 | } |
| 229 | |
| 230 | func (ex *exitHandlerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#) HasErrorscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#HasError().() bool { |
| 231 | ex.RLockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#RLock().() |
| 232 | hasError := ex.errscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#err. != nil |
| 233 | ex.RUnlockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#RUnlock().() |
| 234 | return hasError |
| 235 | } |
| 236 | |
| 237 | func (ex *exitHandlerscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#) Setscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#Set().(err error) error { |
| 238 | ex.Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#Lock().() |
| 239 | defer ex.Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/RWMutex#Unlock().() |
| 240 | |
| 241 | if err == nil { |
| 242 | ex.errscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#err. = nil |
| 243 | return nil |
| 244 | } |
| 245 | |
| 246 | errDiffers := ex.errscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#err. == nil || ex.errscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#err..Error() != err.Error() |
| 247 | ex.errscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#err. = err |
| 248 | |
| 249 | if ex.exitOnErrorscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/exitHandler#exitOnError. { |
| 250 | logFatalscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/logFatal().("%s", err.Error()) |
| 251 | } else if errDiffers { |
| 252 | slogscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/.Errorscip-go gomod github.com/golang/go/src go1.25.0 `log/slog`/Error().(err.Error()) |
| 253 | } |
| 254 | return err |
| 255 | } |
| 256 | |
| 257 | func getVersionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/getVersion().(date bool) (version string) { |
| 258 | if Versionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/Version. == "" { |
| 259 | return "dev" |
| 260 | } |
| 261 | version = fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("v%s (%s)", Versionscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/Version., VersionHashscip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/VersionHash.) |
| 262 | if date { |
| 263 | version += " " + VersionDatescip-go gomod github.com/otto-de/prometheus_varnish_exporter . `github.com/otto-de/prometheus_varnish_exporter`/VersionDate. |
| 264 | } |
| 265 | return version |
| 266 | } |