diff --git a/artifactory/system.go b/artifactory/system.go index 245a252..d47ae41 100644 --- a/artifactory/system.go +++ b/artifactory/system.go @@ -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) } @@ -84,7 +84,7 @@ func (l LicenseInfo) IsOSS() bool { } return slices.Contains( afOSSLicenseTypes, - l.NormalizedLicenseType(), + l.TypeNormalized(), ) } diff --git a/collector/system.go b/collector/system.go index 309b97d..f656bc2 100644 --- a/collector/system.go +++ b/collector/system.go @@ -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 @@ -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,