tsenart / vegeta

HTTP load testing tool and library. It's over 9000!
http://godoc.org/github.com/tsenart/vegeta/lib
MIT License
23.6k stars 1.37k forks source link

Setting a default user agent #541

Open recrsn opened 4 years ago

recrsn commented 4 years ago

Proposal

Adding a default user agent to identify Vegeta. Optionally customizable via command-line arg.

Background

While trying to identify requests from Vegeta in server logs, the user-agent is reported as Go-http-client. It becomes a bit difficult to debug traces associated with Vegeta requests. In this particular scenario, I was trying to investigate a concurrency-conflict issue in one of our services.

Workarounds

Currently, I modify the HTTP traces we generate to add a user agent header.

dstotijn commented 4 years ago

To identify Vegeta, couldn't you rely on the X-Vegeta-Attack (if you name the attack) and X-Vegeta-Seq HTTP request headers that are set (ref)?

recrsn commented 4 years ago

@dstotijn Yes it is possible, but for that we have to teach our entire tracing infra to recognize and pass-through the header. I am hoping we could rely on something standard (like Curl or Postman does)

AlexanderYastrebov commented 1 year ago

Adding a default user agent to identify Vegeta. Optionally customizable via command-line arg.

It is possible right now:

echo "GET http://localhost:9090" | vegeta attack -header 'User-Agent: FooBar' -rate 10/s | vegeta report -every 1s
AlexanderYastrebov commented 1 year ago

I also think it is not possible to remove default user agent via flags. See related https://github.com/golang/go/issues/15524