Skip to content

Better usability for mongodb_collstats_storageStats_indexSizes_.* metrics #882

@rpstw

Description

@rpstw

#97 introduce index sizes metrics years ago, which is useful for huge indexes monitoring.

However, similar to no.3 in #97 (comment), for every index, there will be a separate metric for every single index. For example, mongodb_collstats_storageStats_indexSizes_user_id_1 and mongodb_collstats_storageStats_indexSizes_id_1 could be the same metric (index size) for a same collection.

The number of indexes, or to be more precisely, the number of series is not a major concern from our side.

The problem is it's not of good usability. Here's the argue:

To query the index sizes, we have to perform a regex __name__ query, like {__name__=~"mongodb_collstats_storageStats_indexSizes_.*"}. This works but IMO is against the normal usage pattern of prometheus. A quote from their best practice:

should represent the same logical thing-being-measured across all label dimensions.

Therefor I propose we change the metric format from mongodb_collstats_storageStats_indexSizes_keya_1_keyb_1 to mongodb_collstats_storageStats_indexSizes{name="keya_1_keyb_1"}.The name of index will be a label instead of being included in the metric name.Since it's a backward break change, there should be a flag control this incompatible change. I'm ok with it being default old format.

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions