Memory issues like this are often caused by using high cardinality tags.
High cardinality here means that the tag can have a large number of unique values. For example, if you want to attach the gender
of your users to your metrics, that tag potentially has low cardinality because you might not have a lot of values to choose from. The userID
on the other hand is high cardinality since every single user will have a unique one.
Having high cardinality tags can result in a huge amount of meters since you have a meter for every unique value which will result in high memory consumption and your metrics backend will experience similar issues too.
Examples for (potentially) high cardinality tags:
- ID of the resource, e.g.: userID
- Email address (basically any user input)
- Request path instead of template (e.g.: it can contain resourceID)
See this article for more details: https://develotters.com/posts/high-cardinality/
also see the Micrometer docs: https://micrometer.io/docs/concepts#_tag_values
Do you have high cardinality tags? If so, you can normalize or remove them.