Hello @PlayStay,
In order to help you more accurately, I’d need to understand better what would you like to measure, and what’s the shape of that data.
But in general terms, I’d recommend you to either:
- Define all the metrics (i.e. counters) for all the values you expect, in advance
- because it’s not possible to define them on the fly
- Use tags, so you can group your metrics by tag value.
For instance, if you’re trying to count how many messages you receive of each type (or similar), you can use a message_type
tag, for instance (as you’re already doing in the example above).
In such case, the only downside is that as far as I know, for now, there’s no way to display the tagged results in the summary, unless you define a threshold according to that, as discussed here.
Please, let me know if that would help in your case. Also, feel free to bring as much context as possible, in order to be able to help you more accurately.
For instance, when you say “I’m trying to do is create a custom metric for every response parsed from the JSON file”, what would be the reason/purpose to do so? Tell me what you need from the user perspective, and I’ll try to tell you how to get it with k6, or suggest a feature request if not possible.
Thanks!