peimanja / artifactory_exporter

JFrog Artifactory Prometheus Exporter written in Go
Apache License 2.0
140 stars 37 forks source link

Noisy warning message when license expiry is `"N/R"` #106

Closed cmur2 closed 8 months ago

cmur2 commented 1 year ago

The code in https://github.com/peimanja/artifactory_exporter/blob/d34c1c0e0dc0743edcccab3b79b0edfd5ab1f5e1/collector/system.go#L41 will issue a warning message every time it fails to parse the expiry date, example log message: level=warn ts=2023-04-18T10:27:38.129Z caller=system.go:41 msg="Couldn't parse Artifactory license ValidThrough" err="parsing time \"N/R\" as \"Jan 2, 2006\": cannot parse \"N/R\" as \"Jan\""

How can this be improved to avoid spamming the logs with a non-useful message?

This is how the metrics looks like in Prometheus: artifactory_system_license{expires="N/R", licensed_to="Artifactory Online Dedicated", node_id="foo", type="enterprise"}

Before parsing it could be checked for example whether validThroughTime == "N/R" and then use validThrough = timeNow but without emitting a warning - should I raise a PR for this?

peimanja commented 1 year ago

interesting .. what does N/R mean in this case?

cmur2 commented 1 year ago

interesting .. what does N/R mean in this case?

Sadly I don't know that, since N/R looks similar to N/A ("not available") so it could be anything like "Not Restricted" orso...

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

peimanja commented 1 year ago

@cmur2 can you try v1.13.2 or helm chart prometheus-artifactory-exporter-0.6.1. You should not see warning messages if the log level set to info

cmur2 commented 1 year ago

Will do and report back (maybe already tomorrow), thanks!

cmur2 commented 1 year ago

You should not see warning messages if the log level set to info

I am not sure how that is supposed to work as warnings are a higher priority than informations and thus would still appear?

I don't see a recent code change that would switch this behavior so not sure why it would behave differently now - can you explain?

cmur2 commented 1 year ago

I deployed version https://github.com/peimanja/artifactory_exporter/releases/tag/v1.13.2 just now and still see a steady flow of messages like: level=warn ts=2023-06-06T07:24:21.101Z caller=system.go:41 msg="Couldn't parse Artifactory license ValidThrough" err="parsing time \"N/R\" as \"Jan 2, 2006\": cannot parse \"N/R\" as \"Jan\""

peimanja commented 1 year ago

yeah okay we can handle this issue then

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 11 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 10 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.