-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Exporter as an Option for Locust Stats #2788
Conversation
1d69b5b
to
7fd278e
Compare
7fd278e
to
d1272a7
Compare
0adf419
to
b4f06e3
Compare
locust/exporter.py
Outdated
url=None, | ||
**kwargs, | ||
): | ||
measurement = "request_failure" if exception else "request_success" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm less versed then you are in InfluxDB, but shouldnt it be just one measurement (request)? Wouldnt that make queries etc much easier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It helps us to separate the failed requests versus the successful ones, for example, if we wanted to know the number of errors, we could use a query like so:
from(bucket: v.bucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_field"] == "response_time" and r["_measurement"] == "request_failure")
|> count()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but what about the (slightly more common) queries where we want all requests? At least that is how I would do it in SQL...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from(bucket: v.bucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_field"] == "response_time")
Would give back all requests
But yeah on the other hand, then we could also count errors like
from(bucket: v.bucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_field"] == "exception")
So I think it's just a matter of preference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just reading the docs (https://docs.influxdata.com/influxdb/cloud/write-data/best-practices/schema-design/) I think we should store a tag success
(with true/false value), for logically consistent storage (failed and successful requests are not fundamentally different things) and equally fast querying. But lets chat about it on monday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah so based on the docs it definitely makes sense to just have the one measurement. Whether or not we want to have the tag success
, we should decide if it's useful. Like I mentioned, since we could query for failures with r["_field"] == "exception"
, we don't necessarily need a success
field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need it to be a tag for faster querying? Fields arent indexed, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup sorry! For some reason I was thinking exception was a tag but obviously it's not
7d70c30
to
6ccece6
Compare
Proposal
LocustExporter
, which will export stats to a given InfluxDB instance--exporter
, which will export the stats when active