vegeta-server
vegeta-server copied to clipboard
Export on-going attack to Prometheus
Needs more thought. This would help to see a live plot of an attack using grafana
Exporting metrics to prometheus using promauto should be a straight-forward task. https://godoc.org/github.com/prometheus/client_golang/prometheus/promauto
@nitishm Typically prometheus is meant to scrape metrics endpoints, as opposed to being pushed to.
Would a metrics endpoint be an acceptable outcome for this issue?
Sorry, I think I misunderstood it when I read the comments last night. It does seem that you were requesting an exported endpoint.
Would the models/report_response
be the model we want to export?
@ryanhartje From what I recall, I wanted to capture the metrics live through the AttackFn
as shown here https://github.com/nitishm/vegeta-server/blob/v1.0.0/pkg/vegeta/vegeta.go#L68-L102
Prior to encoding the result, we can use the members of vegeta.Result
to increment the prometheus metrics (counters, gauges, etc) as each result is received through the channel.
The idea is mimic how the vegeta plot
functionality works in the original command line vegeta tool. See https://github.com/tsenart/vegeta/blob/master/plot.go
This task is a little involved wherein you will need to play around with vegeta CLI command for live plotting and understand how that works to mimic it via prometheus metrics, which must be exported to grafana through relevant dashboards (future task).
Let me know if that makes sense.
Just for you to know, there is a similar issue on Vegeta itself: https://github.com/tsenart/vegeta/issues/477