Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

ref: Delete empty properties before sending event to the server #407

Merged
merged 1 commit into from
Dec 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Those configuration options are documented below:

.. describe:: logger

The name of the logger used by Sentry. Default: ``''``
The name of the logger used by Sentry.

.. code-block:: javascript

Expand Down
18 changes: 10 additions & 8 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@ extend(Raven.prototype, {
this.root = options.root || global.process.cwd();
this.transport = options.transport || transports[this.dsn.protocol];
this.sendTimeout = options.sendTimeout || 1;
this.release = options.release || global.process.env.SENTRY_RELEASE || '';
this.release = options.release || global.process.env.SENTRY_RELEASE;
this.environment =
options.environment ||
global.process.env.SENTRY_ENVIRONMENT ||
global.process.env.NODE_ENV ||
'';
global.process.env.NODE_ENV;

// autoBreadcrumbs: true enables all, autoBreadcrumbs: false disables all
// autoBreadcrumbs: { http: true } enables a single type
Expand All @@ -68,7 +67,7 @@ extend(Raven.prototype, {
this.maxBreadcrumbs = Math.max(0, Math.min(options.maxBreadcrumbs || 30, 100));

this.captureUnhandledRejections = options.captureUnhandledRejections;
this.loggerName = options.logger || '';
this.loggerName = options.logger;
this.dataCallback = options.dataCallback;
this.shouldSendCallback = options.shouldSendCallback;
this.sampleRate = typeof options.sampleRate === 'undefined' ? 1 : options.sampleRate;
Expand Down Expand Up @@ -266,11 +265,14 @@ extend(Raven.prototype, {
kwargs.timestamp = new Date().toISOString().split('.')[0];
kwargs.project = this.dsn.project_id;
kwargs.platform = 'node';
kwargs.release = this.release;

// Only include release information if it is set
if (this.release) {
kwargs.release = this.release;
}
// Cleanup empty properties before sending them to the server
Object.keys(kwargs).forEach(function(key) {
if (kwargs[key] == null || kwargs[key] === '') {
delete kwargs[key];
}
});

if (this.dataCallback) {
kwargs = this.dataCallback(kwargs);
Expand Down