Skip to content

Commit

Permalink
chore: remove analytics for every call (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo4815162342 committed May 9, 2022
1 parent 1673d3c commit b52b4d1
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 116 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ const { getHistoricRates } = require('dukascopy-node');
|`cacheFolderPath`|`String`|false|`./.dukascopy-cache`|Folder path where all cache artifacts (binary data) will be stored|
|`retryCount`|`Number`|false|`0`|Number of retries for a failed artifact download. If `0` no retries will happen even for failed requests.|
|`pauseBetweenRetriesMs`|`Number`|false|`500`|Pause between retries. If `retryCount` is `0` this parameter will be ignored|
|`analytics`|`Boolean`|false|`true`|A flag indicating whether the library should send analytics remote report, which is used for improving the DX and the library itself|

***

Expand All @@ -111,8 +110,7 @@ const { getHistoricRates } = require('dukascopy-node');
useCache: true,
cacheFolderPath: '.dukascopy-cache',
retryCount: 5,
pauseBetweenRetriesMs: 250,
analytics: true
pauseBetweenRetriesMs: 250
}
```

Expand Down Expand Up @@ -163,8 +161,6 @@ Options:
-chpath, --cache-path <value> Folder path for cache data (default: "./.dukascopy-cache")
-r, --retries <value> Number of retries for a failed artifact download (default: 0)
-rp, --retry-pause <value> Pause between retries in milliseconds (default: 500)
-a, --analytics Enable remote analytics (default: true)
--no-analytics Disable remote analytics
-h, --help display help for command
```
</details>
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
"files": [
"dist",
"scripts"
"dist"
],
"bin": {
"dukascopy-cli": "./dist/cli/index.js"
Expand All @@ -20,8 +19,7 @@
"lint": "eslint ./src --ext ts --ext js",
"gen:meta": "ts-node src/utils/instrument-meta-data/generate-data.ts",
"gen:instruments-md": "ts-node src/utils/instrument-meta-data/generate-instrument-md.ts",
"release": "standard-version && git push --follow-tags origin master && pnpm build && npm publish",
"postinstall": "node scripts/install.js"
"release": "standard-version && git push --follow-tags origin master && pnpm build && npm publish"
},
"author": "leonid.pyrlia",
"license": "MIT",
Expand Down
22 changes: 0 additions & 22 deletions scripts/install.js

This file was deleted.

53 changes: 0 additions & 53 deletions src/analytics/index.ts

This file was deleted.

7 changes: 2 additions & 5 deletions src/cli/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ program
.option('-ch, --cache', 'Use cache', false)
.option('-chpath, --cache-path <value>', 'Folder path for cache data', './.dukascopy-cache')
.option('-r, --retries <value>', 'Number of retries for a failed artifact download', Number, 0)
.option('-rp, --retry-pause <value>', 'Pause between retries in milliseconds', Number, 500)
.option('-a, --analytics', 'Enable remote analytics', true)
.option('--no-analytics', 'Disable remote analytics');
.option('-rp, --retry-pause <value>', 'Pause between retries in milliseconds', Number, 500);

program.parse(process.argv);

Expand Down Expand Up @@ -63,8 +61,7 @@ const cliConfig: CliConfig = {
cacheFolderPath: options.cachePath,
retryCount: options.retries,
pauseBetweenRetriesMs: options.retryPause,
debug: options.debug,
analytics: options.analytics
debug: options.debug
};

const cliSchema: InputSchema<CliConfig> = {
Expand Down
11 changes: 1 addition & 10 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import debug from 'debug';

import { Output } from '../output-formatter/types';
import { Timeframe } from '../config/timeframes';
import { GOALS, trackCustomGoal } from '../analytics';
import { version } from '../../package.json';

const DEBUG_NAMESPACE = 'dukascopy-node:cli';
Expand All @@ -38,8 +37,7 @@ let {
cacheFolderPath,
dir,
silent,
debug: isDebugActive,
analytics
debug: isDebugActive
} = input;

if (isDebugActive) {
Expand Down Expand Up @@ -69,13 +67,6 @@ const filePath = resolve(folderPath, fileName);
validationErrors
});

if (analytics) {
debug(`${DEBUG_NAMESPACE}:analytics`)(
`Sending "${GOALS.getHistoricalRates}" custom goal to analytics`
);
trackCustomGoal(GOALS.getHistoricalRates, input, isValid, 'cli');
}

if (isValid) {
const [startDate, endDate] = normaliseDates({
instrument,
Expand Down
7 changes: 1 addition & 6 deletions src/config-validator/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,5 @@ export const schema: InputSchema<Config> = {
integer: true,
optional: true,
default: defaultConfig.pauseBetweenRetriesMs
} as RuleNumber,
analytics: {
type: 'boolean',
optional: true,
default: defaultConfig.analytics
} as RuleBoolean
} as RuleNumber
};
4 changes: 1 addition & 3 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export interface Config {
cacheFolderPath?: string;
retryCount?: number;
pauseBetweenRetriesMs?: number;
analytics?: boolean;
}

export type DefaultConfig = Required<Pick<Config, OptionalKeys<Config>>>;
Expand All @@ -41,8 +40,7 @@ export const defaultConfig: DefaultConfig = {
useCache: false,
cacheFolderPath: '',
retryCount: 0,
pauseBetweenRetriesMs: 500,
analytics: true
pauseBetweenRetriesMs: 500
};

export interface ConfigArrayTickItem extends Config {
Expand Down
8 changes: 0 additions & 8 deletions src/getHistoricRates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { formatOutput } from './output-formatter';
import { CacheManager } from './cache-manager';
import { formatBytes } from './utils/formatBytes';
import { Timeframe } from './config/timeframes';
import { GOALS, trackCustomGoal } from './analytics';
import { ArrayItem, ArrayTickItem, JsonItem, JsonItemTick, Output } from './output-formatter/types';
import { NotifyFn } from './buffer-fetcher/types';

Expand Down Expand Up @@ -44,13 +43,6 @@ export async function getHistoricRates(config: Config): Promise<Output> {
validationErrors
});

if (config.analytics) {
debug(`${DEBUG_NAMESPACE}:analytics`)(
`Sending "${GOALS.getHistoricalRates}" custom goal to analytics`
);
trackCustomGoal(GOALS.getHistoricalRates, config, isValid, 'node');
}

if (!isValid) {
throw { validationErrors };
}
Expand Down

0 comments on commit b52b4d1

Please sign in to comment.