Skip to content
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

Closed

Conversation

andrewbaldwin44
Copy link
Collaborator

Proposal

  1. Add a new module LocustExporter, which will export stats to a given InfluxDB instance
  2. Add a new flag --exporter, which will export the stats when active
  3. Add documentation to explain the usage
docs/extending-locust.rst Outdated Show resolved Hide resolved
docs/extending-locust.rst Outdated Show resolved Hide resolved
@andrewbaldwin44 andrewbaldwin44 force-pushed the feature/exporter branch 5 times, most recently from 0adf419 to b4f06e3 Compare July 5, 2024 18:59
url=None,
**kwargs,
):
measurement = "request_failure" if exception else "request_success"
Copy link
Collaborator

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?

Copy link
Collaborator Author

@andrewbaldwin44 andrewbaldwin44 Jul 5, 2024

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()
Copy link
Collaborator

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...

Copy link
Collaborator Author

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

Copy link
Collaborator

@cyberw cyberw Jul 6, 2024

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.

Copy link
Collaborator Author

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

Copy link
Collaborator

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?

Copy link
Collaborator Author

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

@andrewbaldwin44 andrewbaldwin44 force-pushed the feature/exporter branch 2 times, most recently from 7d70c30 to 6ccece6 Compare July 8, 2024 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants