Capturing questionnaire completion timings

  • What is your Grafana version? 8.3.3
  • Self hosted
  • Linux

In my application users complete several questionnaires via a frontend application.

I want to display in Grafana the time it took in seconds for the user to complete the questionnaire along with the time completed, this value is calculated and published to
Prometheus as a duration in seconds. What type of metric type should I be using? I have tried a Summary and I get the following output published from the app:

questionnaire_duration_seconds_count{questionnaire_code=“Questionnaire 1”,user_code=“USER-001”,} 1.0
questionnaire_duration_seconds_sum{questionnaire_code=“Questionnaire 1”,user_code=“USER-001”,} 10.0
questionnaire_duration_seconds_count{questionnaire_code=“Questionnaire 2”,user_code=“USER-001”,} 2.0
questionnaire_duration_seconds_sum{questionnaire_code=“Questionnaire 2”,user_code=“USER-001”,} 14.0

I would like to see a chart showing simple points, time along X axis and questionnaire duration in the Y axis, eg:

USER-001 completes Questionnaire1 in 10 seconds at 1pm
USER-001 completes Questionnaire2 in 20 seconds at 2pm

I have tried the following query in Grafana and it seems to display the correct items in the legend (ie. a distinct list of questionnaires completed in that time period) but nothing is displayed on the graph :frowning:

irate(questionnaire_duration_seconds_sum{user_code=~"$user_code"}[5m]) / irate(questionnaire_duration_seconds_count{user_code=~"$user_code"}[5m])

Am I doing this completely wrong? It looks like it. Thank you!