PCA (Prometheus Certified Associate) sample exam question with answer 198

Question:
You are writing a bash script that will write metrics that are ultimately ingested via the Node Exporter’s textfile collector. You want to add a metric that tracks the number of users currently logged into your server.
Which of the following metric names, types and labels is the MOST appropriate for this use case?

  1. Name: users_logged_in
    Type: Gauge
    Labels: None
  2. Name: user_last_login_timestamp
    Type: Counter
    Labels: username
  3. Name: users_logged_in
    Type: Gauge
    Labels: last_login_timestamp
  4. Name: user_last_login_timestamp
    Type: Gauge
    Labels: username
Answer:
A - correct answer. For more information check naming and instrumentation