vegeta-server icon indicating copy to clipboard operation
vegeta-server copied to clipboard

Export on-going attack to Prometheus

Open nitishm opened this issue 6 years ago • 5 comments

Needs more thought. This would help to see a live plot of an attack using grafana

nitishm avatar Jan 23 '19 15:01 nitishm

Exporting metrics to prometheus using promauto should be a straight-forward task. https://godoc.org/github.com/prometheus/client_golang/prometheus/promauto

nitishm avatar Feb 11 '19 14:02 nitishm

@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?

goshlanguage avatar Oct 04 '19 02:10 goshlanguage

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?

goshlanguage avatar Oct 04 '19 13:10 goshlanguage

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

nitishm avatar Oct 08 '19 13:10 nitishm

Just for you to know, there is a similar issue on Vegeta itself: https://github.com/tsenart/vegeta/issues/477

flaviostutz avatar Jun 29 '20 19:06 flaviostutz