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
Telemetry #302
Merged
Merged
Telemetry #302
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
272dfeb
First commit
fd8296e
Get the actual package name and version
252ca69
passing tests and linter
92b8561
Expose the version string as the user agent for WebAPI calls
f3dae9d
Use GH repo name instead of node module name
f61f0ea
Oh, linters
4b34df2
Add OS and node version to user agent
208ea33
Add user agent to all outbound events
fb1e6cb
Fix a few bugs here and there.
4176fab
Saner linting rules
589d57c
We don't need that anymore, apparently.
d542584
Add user agent to outbound WS connections. Just in case.
2ca8269
Remove ability to override user agent
9288c14
That was a not very good interface, let's remove it.
1ba6e08
Allow users to make mistakes
578c474
One more test
d4a883e
Make it better again
e5fbb44
JSDocs, yeah!
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"extends": "airbnb/legacy" | ||
"extends": "airbnb/legacy", | ||
"rules": { | ||
"max-len": ["error", 100, { "ignoreComments": true }] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
var expect = require('chai').expect; | ||
var helpers = require('../lib/helpers'); | ||
var os = require('os'); | ||
var pkginfo = require('pkginfo')(module, 'version', 'repository'); // eslint-disable-line no-unused-vars | ||
|
||
var userAgent = module.exports.repository.replace('/', ':') + '/' + module.exports.version | ||
+ ' ' + os.platform() + '/' + os.release() | ||
+ ' node/' + process.version.replace('v', ''); | ||
|
||
describe('Version strings', function () { | ||
describe('getVersionString', function () { | ||
it('returns the current version, when unmodified', function () { | ||
var str = helpers.getVersionString(); | ||
expect(str).to.equal(userAgent); | ||
}); | ||
}); | ||
|
||
describe('appendToVersionString', function () { | ||
it('appends a new value', function () { | ||
var str; | ||
helpers.appendToVersionString('foobar', '1.2'); | ||
str = helpers.getVersionString(); | ||
expect(str).to.equal(userAgent + ' foobar/1.2'); | ||
}); | ||
}); | ||
|
||
describe('appendToVersionString', function () { | ||
it('should never overwrite an existing value', function () { | ||
var str; | ||
helpers.appendToVersionString('foobar', '1.3'); | ||
str = helpers.getVersionString(); | ||
// TODO that the order of these tests _matters_ bothers me | ||
expect(str).to.equal(userAgent + ' foobar/1.2 foobar/1.3'); | ||
}); | ||
}); | ||
|
||
describe('appendToVersionStringWithoutVersion', function () { | ||
it('should never overwrite an existing value', function () { | ||
var str; | ||
helpers.appendToVersionString('foobar'); | ||
str = helpers.getVersionString(); | ||
// TODO that the order of these tests _matters_ bothers me | ||
expect(str).to.equal(userAgent + ' foobar/1.2 foobar/1.3 foobar'); | ||
}); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
can we put some JSDoc on this function so that its surfaced by our reference docs? the intention is for this to be used by "higher-level" users of the SDK, right?