percona / mongodb_exporter

A Prometheus exporter for MongoDB including sharding, replication and storage engines
Apache License 2.0
1.15k stars 426 forks source link

Difference between member_state and rs_state #811

Closed pawellrus closed 4 months ago

pawellrus commented 5 months ago

Hello. Could you please describe what is the difference between member_state and rs_state in context of this exporter. member_state is string and rs_state is numeric, but both of them linked to mongodb replica set state.

Here is my example. I have a cluster of 3 mongodb nodes. Each node has it its own exporter. And with this setup I get 9 instance of each metrics with combinations of member_state and rs_state labels. I can understand combination like {member_state="SECONDARY", rs_nm="rs0", rs_state="2"} but what means combination { member_state="PRIMARY", rs_nm="rs0", rs_state="2"}?

BupycHuk commented 5 months ago

Hi, it might be some race condition, because rs_state collected at the beginning of request and member_state is collected for related metrics. I would rely on member_state in this case.

vishwas-sharma2480 commented 5 months ago

Hi @BupycHuk Since it is not a bug can it be closed ?