Hi, I’m trying to track how many assets I’ve uploaded into the system over time (and other things like how many workflows are being run), so I can see what the state of the system is in when requests start to slow down or fail.
Creating some ‘Counters’ seemed the perfect solution for this, but they only seems to report ‘1’ all the time as per this post:
Which can’t be used by InfluxDB/Grafana (as far as I know…) to tell you anything, so I’m not sure what the point of this metric is.
Is it possible to create bespoke real-time metrics? This is such a massive USP over other tools, it would be hugely disappointing if you can’t do this.
UPDATE: Use CUMULATIVE_SUM()
in your InfluxDB query (of your Counter) to get this behaviour.
I’m confused by your question. Unless I completely misunderstand something, Counter
custom metrics should work perfectly well for your use case.
but they only seems to report ‘1’ all the time as per this post:
In the example I gave in the post you linked to, the value for the my_counter
is 6
(2 iterations * (2 + 1) = 6
)… This should also be visible in InfluxDB or any other external output.
Yes, it’s visible in InfluxDB. But in your example, imagine ‘myCounter’ was ‘assetsInTheSystem’. How would you create a graph that shows how many assets there were in the system over time during the test run?
For example, if I notice that there’s a performance issue appearing halfway through the test run, how would I know how many assets there were in the system at this point? At the moment, the ‘Counter’ would just display ‘1’ even if there were ‘100’. The Counter doesn’t increment as the test is running.
I understand that it calculates the total amount of assets in the system at the end of the test run, but that’s not useful for most of the situations I’d like to model. I’m sure I must be missing something!
I.e. Is it possible to track the state of the application while the test was running, rather than at the end?
I think I understand what you’re trying to achieve. And while it probably makes some sense to have such a metric natively in k6, I think it’s mostly a matter of how you interpret and visualize the Counter
metric.
In your case, I think the InfluxDB function CUMULATIVE_SUM()
would work to visualize the total value of the assetsInTheSystem
counter at any particular moment in time.
2 Likes
Whoop! That worked! Very happy
2 Likes