-
Notifications
You must be signed in to change notification settings - Fork 442
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
adding user_agent string to IDENTIFY #23
Conversation
@@ -635,6 +638,7 @@ func (q *Reader) ConnectToNSQ(addr string) error { | |||
ci["snappy"] = q.Snappy | |||
ci["feature_negotiation"] = true | |||
ci["sample_rate"] = q.SampleRate | |||
ci["user_agent"] = q.UserAgent |
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.
the way I envisioned user_agent
to work is that it would typically be set to the name/version of the client library... i.e. go-nsq/0.3.5-alpha
Perhaps the end-user UserAgent
property should be appended to the above, in parentheses, like it would in HTTP:
userAgent := fmt.Sprintf("go-nsq/%s", VERSION)
if q.UserAgent != "" {
userAgent = fmt.Sprintf("%s (%s)", userAgent, q.UserAgent)
}
ci["user_agent"] = userAgent
After giving this some thought, the user_agent string should be allowed to be changed. But I think overall it should work similar to curl. This means that the user_agent string has a default (similar to the one you set above). Beyond that, it should be customizable. |
ok, this seems reasonable to me, go ahead with that approach (same for pynsq) |
@@ -123,7 +123,8 @@ type Reader struct { | |||
DeflateLevel int // the compression level to negotiate for Deflate | |||
Snappy bool // negotiate enabling Snappy compression | |||
|
|||
SampleRate int32 // set the sampleRate of the client's messagePump (requires nsqd 0.2.25+) | |||
SampleRate int32 // set the sampleRate of the client's messagePump (requires nsqd 0.2.25+) | |||
UserAgent string // set the user agent string of the client in the spirit of HTTP (default: "<client_library_name>/<version>") (requires nsqd 0.2.25+) |
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.
// a string identifying the agent for this client in the spirit of HTTP (default: "<client_library_name>/<version>")
👍 thanks @elubow |
adding user_agent string to IDENTIFY
proper handling of maxBytesPerFile for reads
Adding user agent string