Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

level=ERROR msg="There was an issue calculating the value" metric=artifacts err="Could not recognise '' as multiplier" #139

Closed
mendesrawr opened this issue Apr 16, 2024 · 7 comments

Comments

@mendesrawr
Copy link

mendesrawr commented Apr 16, 2024

Hello, I was wondering if this is a bug or something I can quickly fix on my own I'm running this in a container with no issue until I noticed parsing errors from the api/storagesummary artifactory endpoint it was scraping. It seems to be having trouble parsing the last few json objects binariesSummary.

https://jfrog.com/help/r/jfrog-rest-apis/get-storage-summary-info

docker run --env-file=file -p 9531:9531 peimanja/artifactory_exporter:latest --artifactory.scrape-uri=https://artifacts.com/artifactory --log.level=error
time=2024-04-16T20:17:25.706Z level=ERROR msg="The string was not recognized as a known multiplier." artifactory.number.multiplier=""
time=2024-04-16T20:17:25.707Z level=ERROR msg="There was an issue calculating the value" metric=binaries err="Could not recognise '' as multiplier"
time=2024-04-16T20:17:25.707Z level=ERROR msg="The string was not recognized as a known multiplier." artifactory.number.multiplier=""
time=2024-04-16T20:17:25.707Z level=ERROR msg="There was an issue calculating the value" metric=artifacts err="Could not recognise '' as multiplier"

"fileStoreSummary": {
    "storageType": "s3-storage-v3-direct",
    "storageDirectory": "/opt/jfrog/artifactory/var/data/artifactory/cache",
    "totalSpace": "1.0 GB",
    "usedSpace": "1.0 GB (1.0%)",
    "freeSpace": "1.0 GB (1.0%)"
},
"binariesSummary": {
    "binariesCount": "1",
    "binariesSize": "288.09 MB",
    "artifactsSize": "288.09 MB",
    "optimization": "100%",
    "itemsCount": "44",
    "artifactsCount": "44"
}

}

@mendesrawr
Copy link
Author

Got around this by using latest tar.gz release which doesnt seem to have the same problem the docker image does an updated docker image would be appreciated.

@peimanja
Copy link
Owner

@mendesrawr can you please give the latest canary image tag a try and let me know if you see the same issue there?

@mendesrawr
Copy link
Author

mendesrawr commented Apr 18, 2024

@peimanja

The error ["There was an issue calculating the value"] occurs in the following instances
Docker image - Canary
Docker image - Latest
Custom image built using provided DockerFile from master branch

The the bug is not present building and running artifactory_exporter-v1.14.0-linux-amd64.tar.gz directly with
./artifactory_exporter --artifactory.scrape-uri=

Would it be possible push a new image using the following release which appears to not have any issues:
https://github.com/peimanja/artifactory_exporter/releases/tag/v1.14.0

Unable to find image 'peimanja/artifactory_exporter:canary' locally
canary: Pulling from peimanja/artifactory_exporter
Digest: sha256:9be91f4557f7e1ee21f64e2c40f09dc97c7abf29c770ce1398b6de4892e20dc7
Status: Downloaded newer image for peimanja/artifactory_exporter:canary
time=2024-04-18T15:32:21.638Z level=INFO msg="Starting artifactory_exporter" version="(version=canary, branch=refs/heads/master, revision=b9c0dbb48006b16a1a87347a2ba50d739ca244b5)"
time=2024-04-18T15:32:21.638Z level=INFO msg="Build context" context="(go=go1.21.8, user=github-actions, date=2024-03-24T17:34:35Z)"
time=2024-04-18T15:32:21.638Z level=INFO msg="Listening on address" address=:9531
time=2024-04-18T15:32:25.257Z level=ERROR msg="The string was not recognized as a known multiplier." artifactory.number.multiplier=""
time=2024-04-18T15:32:25.257Z level=ERROR msg="There was an issue calculating the value" metric=artifacts err="Could not recognise '' as multiplier"
time=2024-04-18T15:32:25.257Z level=ERROR msg="The string was not recognized as a known multiplier." artifactory.number.multiplier=""
time=2024-04-18T15:32:25.259Z level=ERROR msg="There was an issue calculating the value" metric=binaries err="Could not recognise '' as multiplier"

./artifactory_exporter --artifactory.scrape-uri= --log.level=info
time=2024-04-18T13:08:28.866-04:00 level=INFO msg="Starting artifactory_exporter" version="(version=v1.14.0, branch=refs/tags/v1.14.0, revision=8dfb2cae07db3d6c03244ea8b2d450b39c716dbe)"
time=2024-04-18T13:08:28.866-04:00 level=INFO msg="Build context" context="(go=go1.21.7, user=github-actions, date=2024-02-20T05:28:45Z)"
time=2024-04-18T13:08:28.866-04:00 level=INFO msg="Listening on address" address=:9531

docker run --env-file=password.txt -p 9531:9531 :latest --artifactory.scrape-uri=
time=2024-04-18T17:00:02.673Z level=INFO msg="Starting artifactory_exporter" version="(version=, branch=, revision=)"
time=2024-04-18T17:00:02.673Z level=INFO msg="Build context" context="(go=go1.21.9, user=, date=)"
time=2024-04-18T17:00:02.673Z level=INFO msg="Listening on address" address=:9531
time=2024-04-18T17:00:04.578Z level=ERROR msg="The string was not recognized as a known multiplier." artifactory.number.multiplier=""
time=2024-04-18T17:00:04.578Z level=ERROR msg="There was an issue calculating the value" metric=binaries err="Could not recognise '' as multiplier"

@mendesrawr mendesrawr reopened this Apr 18, 2024
KacperPerschke added a commit to KacperPerschke/artifactory_exporter that referenced this issue Apr 20, 2024
@KacperPerschke
Copy link
Contributor

@mendesrawr as I wrote in #140 I hadn't thought about the case you came across.

I'm sorry for inconvenience.

@KacperPerschke
Copy link
Contributor

@peimanja My intention with the change proposed in #124 was to improve readability and make the code easier to maintain. Does the change I made achieve the goal, or does it obfuscate the code and make it harder to diagnose the problem?

KacperPerschke added a commit to KacperPerschke/artifactory_exporter that referenced this issue Apr 20, 2024
Copying the use of re.FindStringSubmatch without
a thorough understanding will backfire sooner or later.

Thank @mendesrawr for the opportunity to learn.
@peimanja
Copy link
Owner

@KacperPerschke looks like there are a lot of edge cases but let's see if we can catch them for now

@mendesrawr
Copy link
Author

@peimanja @KacperPerschke Thank you so much the latest docker image works perfectly now. I really appreciate it. Later this week I'm going to try to replicate this build with a custom image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants