Skip to content

Commit

Permalink
remove the metrics sender
Browse files Browse the repository at this point in the history
PR-URL: npm#2382
Credit: @nlf
Close: npm#2382
Reviewed-by: @isaacs
  • Loading branch information
nlf authored and isaacs committed Dec 18, 2020
1 parent 0ad958f commit 7539504
Show file tree
Hide file tree
Showing 12 changed files with 0 additions and 193 deletions.
17 changes: 0 additions & 17 deletions docs/content/using-npm/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -744,13 +744,6 @@ Commit message which is used by `npm version` when creating version commit.

Any "%s" in the message will be replaced with the version number.

#### metrics-registry

* Default: The value of `registry` (which defaults to "https://registry.npmjs.org/")
* Type: String

The registry you want to send cli metrics to if `send-metrics` is true.

#### node-options

* Default: null
Expand Down Expand Up @@ -1089,16 +1082,6 @@ searches.
The age of the cache, in seconds, before another registry request is made if
using legacy search endpoint.

#### send-metrics

* Default: false
* Type: Boolean

If true, success/failure metrics will be reported to the registry stored in
`metrics-registry`. These requests contain the number of successful and
failing runs of the npm CLI and the time period over which those counts were
gathered. No identifying information is included in these requests.

#### shell

* Default: SHELL environment variable, or "bash" on Posix, or "cmd" on
Expand Down
3 changes: 0 additions & 3 deletions lib/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ const npm = module.exports = new class extends EventEmitter {

this.projectScope = this.config.get('scope') ||
getProjectScope(this.prefix)

startMetrics()
}

get flatOptions () {
Expand Down Expand Up @@ -297,7 +295,6 @@ const npm = module.exports = new class extends EventEmitter {

const log = require('npmlog')
const { promisify } = require('util')
const startMetrics = require('./utils/metrics.js').start

const which = promisify(require('which'))

Expand Down
4 changes: 0 additions & 4 deletions lib/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ const defaults = {
long: false,
maxsockets: 50,
message: '%s',
'metrics-registry': null,
'node-options': null,
'node-version': process.version,
noproxy: null,
Expand Down Expand Up @@ -159,7 +158,6 @@ const defaults = {
searchlimit: 20,
searchopts: '',
searchstaleness: 15 * 60,
'send-metrics': false,
shell,
shrinkwrap: true,
'sign-git-commit': false,
Expand Down Expand Up @@ -273,7 +271,6 @@ const types = {
long: Boolean,
maxsockets: Number,
message: String,
'metrics-registry': [null, String],
'node-options': [null, String],
'node-version': [null, semver],
noproxy: [null, String, Array],
Expand Down Expand Up @@ -312,7 +309,6 @@ const types = {
searchlimit: Number,
searchopts: String,
searchstaleness: Number,
'send-metrics': Boolean,
shell: String,
shrinkwrap: Boolean,
'sign-git-commit': Boolean,
Expand Down
4 changes: 0 additions & 4 deletions lib/utils/error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ let wroteLogFile = false
let exitCode = 0
const errorMessage = require('./error-message.js')
const replaceInfo = require('./replace-info.js')
const stopMetrics = require('./metrics.js').stop

const cacheFile = require('./cache-file.js')

Expand Down Expand Up @@ -43,9 +42,6 @@ process.on('exit', code => {
}
}

// kill any outstanding stats reporter if it hasn't finished yet
stopMetrics()

if (code)
itWorked = false
if (itWorked)
Expand Down
2 changes: 0 additions & 2 deletions lib/utils/flat-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ const flatten = obj => ({
cache: join(obj.cache, '_cacache'),
global: obj.global,

metricsRegistry: obj['metrics-registry'] || obj.registry,
sendMetrics: obj['send-metrics'],
registry: obj.registry,
scope: obj.scope,
access: obj.access,
Expand Down
43 changes: 0 additions & 43 deletions lib/utils/metrics-launch.js

This file was deleted.

80 changes: 0 additions & 80 deletions lib/utils/metrics.js

This file was deleted.

21 changes: 0 additions & 21 deletions tap-snapshots/test-lib-utils-config.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ Object {
"long": false,
"maxsockets": 50,
"message": "%s",
"metrics-registry": null,
"node-options": null,
"node-version": "v14.8.0",
"noproxy": null,
Expand Down Expand Up @@ -120,7 +119,6 @@ Object {
"searchlimit": 20,
"searchopts": "",
"searchstaleness": 900,
"send-metrics": false,
"shell": "cmd.exe",
"shrinkwrap": true,
"sign-git-commit": false,
Expand Down Expand Up @@ -423,10 +421,6 @@ Object {
"long": "{Boolean TYPE}",
"maxsockets": "{Number TYPE}",
"message": "{String TYPE}",
"metrics-registry": Array [
null,
"{String TYPE}",
],
"node-options": Array [
null,
"{String TYPE}",
Expand Down Expand Up @@ -509,7 +503,6 @@ Object {
"searchlimit": "{Number TYPE}",
"searchopts": "{String TYPE}",
"searchstaleness": "{Number TYPE}",
"send-metrics": "{Boolean TYPE}",
"shell": "{String TYPE}",
"shrinkwrap": "{Boolean TYPE}",
"sign-git-commit": "{Boolean TYPE}",
Expand Down Expand Up @@ -616,7 +609,6 @@ Object {
"long": false,
"maxsockets": 50,
"message": "%s",
"metrics-registry": null,
"node-options": null,
"node-version": "v14.8.0",
"noproxy": null,
Expand Down Expand Up @@ -654,7 +646,6 @@ Object {
"searchlimit": 20,
"searchopts": "",
"searchstaleness": 900,
"send-metrics": false,
"shell": "cmd.exe",
"shrinkwrap": true,
"sign-git-commit": false,
Expand Down Expand Up @@ -957,10 +948,6 @@ Object {
"long": "{Boolean TYPE}",
"maxsockets": "{Number TYPE}",
"message": "{String TYPE}",
"metrics-registry": Array [
null,
"{String TYPE}",
],
"node-options": Array [
null,
"{String TYPE}",
Expand Down Expand Up @@ -1043,7 +1030,6 @@ Object {
"searchlimit": "{Number TYPE}",
"searchopts": "{String TYPE}",
"searchstaleness": "{Number TYPE}",
"send-metrics": "{Boolean TYPE}",
"shell": "{String TYPE}",
"shrinkwrap": "{Boolean TYPE}",
"sign-git-commit": "{Boolean TYPE}",
Expand Down Expand Up @@ -1150,7 +1136,6 @@ Object {
"long": false,
"maxsockets": 50,
"message": "%s",
"metrics-registry": null,
"node-options": null,
"node-version": "v14.8.0",
"noproxy": null,
Expand Down Expand Up @@ -1188,7 +1173,6 @@ Object {
"searchlimit": 20,
"searchopts": "",
"searchstaleness": 900,
"send-metrics": false,
"shell": "/usr/local/bin/bash",
"shrinkwrap": true,
"sign-git-commit": false,
Expand Down Expand Up @@ -1493,10 +1477,6 @@ Object {
"long": "{Boolean TYPE}",
"maxsockets": "{Number TYPE}",
"message": "{String TYPE}",
"metrics-registry": Array [
null,
"{String TYPE}",
],
"node-options": Array [
null,
"{String TYPE}",
Expand Down Expand Up @@ -1579,7 +1559,6 @@ Object {
"searchlimit": "{Number TYPE}",
"searchopts": "{String TYPE}",
"searchstaleness": "{Number TYPE}",
"send-metrics": "{Boolean TYPE}",
"shell": "{String TYPE}",
"shrinkwrap": "{Boolean TYPE}",
"sign-git-commit": "{Boolean TYPE}",
Expand Down
2 changes: 0 additions & 2 deletions tap-snapshots/test-lib-utils-flat-options.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Object {
"log": Object {},
"long": undefined,
"message": "message",
"metricsRegistry": "metrics-registry",
"nodeBin": "/path/to/some/node",
"nodeVersion": "1.2.3",
"noProxy": "noproxy",
Expand Down Expand Up @@ -100,7 +99,6 @@ Object {
},
"staleness": "searchstaleness",
},
"sendMetrics": "send-metrics",
"shell": undefined,
"signGitCommit": "sign-git-commit",
"signGitTag": "sign-git-tag",
Expand Down
Loading

0 comments on commit 7539504

Please sign in to comment.