Adding an Input Field to a Visualization and show results based on it

  • What Grafana version and what operating system are you using?
    Grafana v9.5.3 (916d9793aa) on Ubuntu 20.04.4 LTS

  • What are you trying to achieve?
    Hi! I’m quite new to setting up monitoring using Prometheus/Grafana. So, I want a Visualization in my Dashboard where I can see no of requests per user in an interval. So, I am expecting it to be something like an Input Field on top where I enter the User ID and it fetches the no of requests for that user in an interval. And it also shows me an option to select an interval like span of 1 Week, 1 Day, etc …

  • How are you trying to achieve it?
    I have setup a simple NodeJS App which has a simple route and I am loading testing on it. The route what it does is, it picks a random number form 1 to 20 considering it as User ID and increment it’s value.

const requestsPerUserCounter = new client.Counter({
    name: 'requests_per_user',
    help: 'Number of requests per user',
    labelNames: ['user'],
  });

app.get('/', (req, res) => {
    // Randomly select a user between 1 and 20
    const user = getRandomUser().toString();
  
    // Increment the requests per user counter
    requestsPerUserCounter.labels(user).inc();
  
    res.send(`Hello, User ${user}!`);
});
  • What happened?
    Sorry for bring newbie, I tried going to my dashboard and there selcted the option to Add a Visualization and there in metric I provided requests_per_user now I am a little clueless even after searching on web that how do I create that input field. Also, how do I set the scale on Y Axis to be like 100, 200, 300 and so on … (Image Reference Below)

  • What did you expect to happen?

  • Can you copy/paste the configuration(s) that you are having problems with?
    N/A

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No

  • Did you follow any online instructions? If so, what is the URL?
    Yes, for the basic setup I followd some majorly from Node.js Application Monitoring with Prometheus and Grafana and ChatGPT.