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

Turn off Statsbeat if not able to connect to endpoint #956

Merged
merged 7 commits into from
Apr 27, 2022

Conversation

hectorhdzg
Copy link
Member

No description provided.

@@ -54,7 +54,7 @@ class Statsbeat {
let statsbeatConnectionString = this._getConnectionString(config);
this._statsbeatConfig = new Config(statsbeatConnectionString);
this._statsbeatConfig.samplingPercentage = 100; // Do not sample
this._sender = new Sender(this._statsbeatConfig, null, null, this._handleNetworkError);
this._sender = new Sender(this._statsbeatConfig, null, null, null, null, true, this._shutdownStatsbeat);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parameters are getting jammed. how do you handle that in node? what is the limit or keep growing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the object starts doing stuff the moment is instantiated, we need to provide the settings in the constructor, it could receive a single "settings" object with everything instead of multiple required and optional parameters, that is what I prefer to do but that will be a breaking change so we cannot do it right now, customer could be instantiating this class directly so we cannot change the signature now.

@@ -59,6 +64,9 @@ class Sender {
this._fileCleanupTimer = null;
// tmpdir is /tmp for *nix and USERDIR/AppData/Local/Temp for Windows
this._tempDir = path.join(os.tmpdir(), Sender.TEMPDIR_PREFIX + this._config.instrumentationKey);
this._isStatsbeatSender = isStatsbeatSender || false;
this._shutdownStatsbeat = shutdownStatsbeat;
this._failedToIngestCounter = 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 36 is default to 0, right? line 69 might be redundant? at least that's what Java does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value would be undefined in this case even if we set the type as number

Library/Sender.ts Outdated Show resolved Hide resolved
@hectorhdzg hectorhdzg merged commit 141b6d9 into develop Apr 27, 2022
@hectorhdzg hectorhdzg deleted the hectorhdzg/statsbeatupd branch November 9, 2022 20:45
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.

None yet

3 participants