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

ClassCastException when including all metrics via domain_regex #415

Closed
KoenDG opened this issue Mar 20, 2023 · 6 comments
Closed

ClassCastException when including all metrics via domain_regex #415

KoenDG opened this issue Mar 20, 2023 · 6 comments

Comments

@KoenDG
Copy link

KoenDG commented Mar 20, 2023

There's no way to fully add the relevant info here without either removing too much, or revealing setup details. So here's my description:

I've run into a situation where I'm trying to get all JMX metrics from a Solr database.

Solr has what's known as a FieldCache. One of the beans for this is the total_size of the FieldCache.

In my logs I'm seeing this(manually truncated here):

Error while trying to match attributeInfo configuration with the Attribute: <truncated>category=CACHE,scope=core,name=fieldCache : javax.management.MBeanAttributeInfo[description=null, name=total_size, type=java.lang.String, read-only, descriptor={}]
java.lang.ClassCastException
Unable to get metrics from <truncated>category=CACHE,scope=core,name=fieldCache - total_size: java.lang.NumberFormatException: For input string: "232.2 MB"

Looks like the output is "232.2 MB" and an attempt is made to cast this to a number. And it fails there.

What steps can I take to resolve this? Or is this something in the code that needs to be resolved?

Since I want to get all possible metrics from the database, I'm using a domain_regex instead of mapping individual metrics. Should I move to mapping individual metrics in the configuration? Or would that still not work?

@KoenDG
Copy link
Author

KoenDG commented Mar 22, 2023

Looking further at the documentation... it seems like this is just straight up not possible.

Is there a way to say in the configuration, for a specific bean: must be interpreted as a specific dataype?

@carlosroman
Copy link
Contributor

It looks like the problem here is Solr is returning total_size as human readable String rather than just the number of bytes. Looking through the Solr code not sure if there is a way to stop Solr making it human readable or if there is a way to get size or ramBytesUsed from the MBean. It should be possible as suggested by the docs here.

@KoenDG
Copy link
Author

KoenDG commented Apr 11, 2023

I'll give it an attempt, though from what I'm reading those statistics are only for the QueryResultCache, whereas I'm explicitely only in interested in the FieldCache

@KoenDG
Copy link
Author

KoenDG commented Apr 22, 2023

Yeah no those values are not the same thing. It seems total_size is the only output given for FieldCache and that's always going to be a string like "405 MB".

And from what I can tell there is currently no way of dealing with that?

@carlosroman
Copy link
Contributor

carlosroman commented Apr 24, 2023

Yes, at the moment there is no way to deal with values such as 405 MB. Having looked at how that value is created I'm not sure what our config would look like for such a value. We also wouldn't want to do this for every string that fails to be converted to a number.
This is pretty much the same as requested in #372

@KoenDG
Copy link
Author

KoenDG commented Apr 24, 2023

Oh wow, I did a bit of a search before making this, but I don't recall finding that.

Yes, that seems identical, so I'll close this one.

Thanks for your time.

@KoenDG KoenDG closed this as completed Apr 24, 2023
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

2 participants