Skip to content

Commit

Permalink
Minor amendments.
Browse files Browse the repository at this point in the history
Shortcomings left over from rapid development.
  • Loading branch information
KacperPerschke committed Nov 5, 2024
1 parent 9fbf1c5 commit 839c38a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions artifactory/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type LicenseInfo struct {
ValidSeconds int64 // It will be calculated in the ‘collector’ package.
}

func (l LicenseInfo) NormalizedLicenseType() string {
func (l LicenseInfo) TypeNormalized() string {
return strings.ToLower(l.Type)
}

Expand All @@ -84,7 +84,7 @@ func (l LicenseInfo) IsOSS() bool {
}
return slices.Contains(
afOSSLicenseTypes,
l.NormalizedLicenseType(),
l.TypeNormalized(),
)
}

Expand Down
10 changes: 2 additions & 8 deletions collector/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ import (
"github.com/peimanja/artifactory_exporter/artifactory"
)

var afOSSLicenseTypes = []string{
`oss`,
`jcr edition`,
`community edition for c/c++`,
}

func collectLicense(e *Exporter, ch chan<- prometheus.Metric) (artifactory.LicenseInfo, error) {
retErr := func(err error) (artifactory.LicenseInfo, error) {
return artifactory.LicenseInfo{}, err
Expand Down Expand Up @@ -108,8 +102,8 @@ func (e *Exporter) exportSystem(ch chan<- prometheus.Metric) error {
ch <- prometheus.MustNewConstMetric(
metric,
prometheus.GaugeValue,
float64(licenseInfo.ValidSeconds), //float
licenseInfo.NormalizedLicenseType(),
float64(licenseInfo.ValidSeconds), // Prometheus expects a float type.
licenseInfo.TypeNormalized(),
licenseInfo.LicensedTo,
licenseInfo.ValidThrough,
licenseInfo.NodeId,
Expand Down

0 comments on commit 839c38a

Please sign in to comment.