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

adding user_agent string to IDENTIFY #23

Merged
merged 1 commit into from
Jan 31, 2014

Conversation

elubow
Copy link
Contributor

@elubow elubow commented Jan 27, 2014

Adding user agent string

@@ -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
Copy link
Member

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

@elubow
Copy link
Contributor Author

elubow commented Jan 27, 2014

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.

@mreiferson
Copy link
Member

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+)
Copy link
Member

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>")

@mreiferson
Copy link
Member

👍 thanks @elubow

mreiferson added a commit that referenced this pull request Jan 31, 2014
adding user_agent string to IDENTIFY
@mreiferson mreiferson merged commit 256a94d into nsqio:master Jan 31, 2014
@elubow elubow deleted the user_agent_string branch January 31, 2014 16:34
amosir pushed a commit to amosir/go-nsq that referenced this pull request Jan 16, 2024
proper handling of maxBytesPerFile for reads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants