switch to vanity import path

This commit is contained in:
Josh Deprez 2024-10-18 13:10:01 +11:00
parent 21ffc9ccde
commit 62b6f62b59
3 changed files with 21 additions and 11 deletions

View file

@ -1,5 +1,5 @@
// The lifepo4wered-exporter binary serves Prometheus metrics based on the output // The lifepo4wered-exporter binary serves Prometheus metrics based on the output
package main // import "gitea.drjosh.dev/josh/lifepo4wered-exporter" package main // import "drjosh.dev/lifepo4wered-exporter"
import ( import (
"bufio" "bufio"
@ -11,7 +11,7 @@ import (
"os/exec" "os/exec"
"time" "time"
"gitea.drjosh.dev/josh/jmetrics" "drjosh.dev/jmetrics"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
@ -30,12 +30,22 @@ var (
) )
lifepo4weredSummaries = map[string]*jmetrics.LiteGaugeSummary{ lifepo4weredSummaries = map[string]*jmetrics.LiteGaugeSummary{
"VIN": jmetrics.NewLiteGaugeSummary("lifepo4wered_voltage_in", "Voltage in (mV)"), "VIN": jmetrics.NewLiteGaugeSummary(jmetrics.LiteGaugeSummaryOpts{
"VOUT": jmetrics.NewLiteGaugeSummary("lifepo4wered_voltage_out", "Voltage out (mV)"), Namespace: "lifepo4wered", Name: "voltage_in", Help: "Voltage in (mV)",
"VBAT": jmetrics.NewLiteGaugeSummary("lifepo4wered_voltage_bat", "Battery voltage (mV)"), }),
"IOUT": jmetrics.NewLiteGaugeSummary("lifepo4wered_current_out", "Current out (mA)"), "VOUT": jmetrics.NewLiteGaugeSummary(jmetrics.LiteGaugeSummaryOpts{
Namespace: "lifepo4wered", Name: "voltage_out", Help: "Voltage out (mV)",
}),
"VBAT": jmetrics.NewLiteGaugeSummary(jmetrics.LiteGaugeSummaryOpts{
Namespace: "lifepo4wered", Name: "voltage_bat", Help: "Battery voltage (mV)",
}),
"IOUT": jmetrics.NewLiteGaugeSummary(jmetrics.LiteGaugeSummaryOpts{
Namespace: "lifepo4wered", Name: "current_out", Help: "Current out (mA)",
}),
} }
lifepo4weredPOutSummary = jmetrics.NewLiteGaugeSummary("lifepo4wered_power_out", "Power out (mW)") lifepo4weredPOutSummary = jmetrics.NewLiteGaugeSummary(jmetrics.LiteGaugeSummaryOpts{
Namespace: "lifepo4wered", Name: "power_out", Help: "Power out (mW)",
})
lifepo4weredHists = map[string]prometheus.Histogram{ lifepo4weredHists = map[string]prometheus.Histogram{
"VIN": promauto.NewHistogram(prometheus.HistogramOpts{ "VIN": promauto.NewHistogram(prometheus.HistogramOpts{

4
go.mod
View file

@ -1,9 +1,9 @@
module gitea.drjosh.dev/josh/lifepo4wered-exporter module drjosh.dev/lifepo4wered-exporter
go 1.23.1 go 1.23.1
require ( require (
gitea.drjosh.dev/josh/jmetrics v0.0.1 drjosh.dev/jmetrics v0.0.3
github.com/prometheus/client_golang v1.20.4 github.com/prometheus/client_golang v1.20.4
) )

4
go.sum
View file

@ -1,5 +1,5 @@
gitea.drjosh.dev/josh/jmetrics v0.0.1 h1:s79Ye9SEAXen17hXFWuTjAhwjvgYs4L1YW2Vs9mdaR0= drjosh.dev/jmetrics v0.0.3 h1:6xBfQQG4qzOLJeoQRD0gzmQqB3XkQueLYnCT/YqPR0A=
gitea.drjosh.dev/josh/jmetrics v0.0.1/go.mod h1:2nQ3pf8j3kSfLIjRVWrKWuWGPjh/TKnu7MDx6PFb4BM= drjosh.dev/jmetrics v0.0.3/go.mod h1:unknXjbR6aU7nTtXi80zvZLwTQdxEvoRtgIi4vCWx/g=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=