Socket
Socket
Sign inDemoInstall

@elastic/apm-rum-core

Package Overview
Dependencies
Maintainers
61
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elastic/apm-rum-core - npm Package Compare versions

Comparing version 4.8.0 to 4.8.1

13

CHANGELOG.md

@@ -6,2 +6,15 @@ # Change Log

## [4.8.1](https://github.com/elastic/apm-agent-rum-js/compare/@elastic/apm-rum-core@4.8.0...@elastic/apm-rum-core@4.8.1) (2020-01-30)
### Bug Fixes
* **rum-core:** add error properties to custom context by default ([#586](https://github.com/elastic/apm-agent-rum-js/issues/586)) ([15ef0b6](https://github.com/elastic/apm-agent-rum-js/commit/15ef0b623da844ab05886b2a5d61fdf3dc383d1b))
* **rum-core:** do not capture timing spans for unsampled transactions ([#590](https://github.com/elastic/apm-agent-rum-js/issues/590)) ([88b61ec](https://github.com/elastic/apm-agent-rum-js/commit/88b61ec98a328eb84ed87023b219c8eeb0f6b462))
* **rum-core:** transaction onstart hook must be consistent ([#585](https://github.com/elastic/apm-agent-rum-js/issues/585)) ([dd792d1](https://github.com/elastic/apm-agent-rum-js/commit/dd792d167a13c072e8870c3ea29efdae015fe9d4))
# [4.8.0](https://github.com/elastic/apm-agent-rum-js/compare/@elastic/apm-rum-core@4.7.0...@elastic/apm-rum-core@4.8.0) (2020-01-15)

@@ -8,0 +21,0 @@

56

dist/es/error-logging/error-logging.js
import { createStackTraces, filterInvalidFrames } from './stack-trace';
import { getPageMetadata, generateRandomId, merge, extend } from '../common/utils';
import { truncateModel, ERROR_MODEL } from '../common/truncate';
var IGNORE_KEYS = ['stack', 'message'];
function getErrorProperties(error) {
var propertyFound = false;
var properties = {};
Object.keys(error).forEach(function (key) {
if (IGNORE_KEYS.indexOf(key) >= 0) {
return;
}
var val = error[key];
if (val == null || typeof val === 'function') {
return;
}
if (typeof val === 'object') {
if (typeof val.toISOString !== 'function') return;
val = val.toISOString();
}
properties[key] = val;
propertyFound = true;
});
if (propertyFound) {
return properties;
}
}
var ErrorLogging = function () {

@@ -33,3 +62,7 @@ function ErrorLogging(apmServer, configService, transactionService) {

errorType = error.name;
errorContext = this._getErrorProperties(error);
var customProperties = getErrorProperties(error);
if (customProperties) {
errorContext.custom = customProperties;
}
}

@@ -134,23 +167,2 @@

_proto._getErrorProperties = function _getErrorProperties(error) {
var properties = {};
Object.keys(error).forEach(function (key) {
if (key === 'stack') return;
var val = error[key];
if (val === null) return;
switch (typeof val) {
case 'function':
return;
case 'object':
if (typeof val.toISOString !== 'function') return;
val = val.toISOString();
}
properties[key] = val;
});
return properties;
};
return ErrorLogging;

@@ -157,0 +169,0 @@ }();

@@ -115,4 +115,2 @@ import { Promise } from 'es6-promise';

tr.captureTimings = true;
if (tr.type === PAGE_LOAD) {

@@ -134,2 +132,6 @@ tr.options.checkBrowserResponsiveness = false;

if (tr.sampled) {
tr.captureTimings = true;
}
this.ensureRespInterval(tr.options.checkBrowserResponsiveness);

@@ -144,5 +146,11 @@ return tr;

var tr;
var fireOnstartHook = true;
if (perfOptions.managed) {
var current = this.currentTransaction;
tr = this.startManagedTransaction(name, type, perfOptions);
if (current === tr) {
fireOnstartHook = false;
}
} else {

@@ -156,8 +164,10 @@ tr = new Transaction(name, type, perfOptions);

if (__DEV__) {
this._logger.debug("startTransaction(" + tr.id + ", " + tr.name + ", " + tr.type + ")");
if (fireOnstartHook) {
if (__DEV__) {
this._logger.debug("startTransaction(" + tr.id + ", " + tr.name + ", " + tr.type + ")");
}
this._config.events.send(TRANSACTION_START, [tr]);
}
this._config.events.send(TRANSACTION_START, [tr]);
return tr;

@@ -164,0 +174,0 @@ };

@@ -12,2 +12,32 @@ "use strict";

var IGNORE_KEYS = ['stack', 'message'];
function getErrorProperties(error) {
var propertyFound = false;
var properties = {};
Object.keys(error).forEach(function (key) {
if (IGNORE_KEYS.indexOf(key) >= 0) {
return;
}
var val = error[key];
if (val == null || typeof val === 'function') {
return;
}
if (typeof val === 'object') {
if (typeof val.toISOString !== 'function') return;
val = val.toISOString();
}
properties[key] = val;
propertyFound = true;
});
if (propertyFound) {
return properties;
}
}
var ErrorLogging = function () {

@@ -41,3 +71,7 @@ function ErrorLogging(apmServer, configService, transactionService) {

errorType = error.name;
errorContext = this._getErrorProperties(error);
var customProperties = getErrorProperties(error);
if (customProperties) {
errorContext.custom = customProperties;
}
}

@@ -142,23 +176,2 @@

_proto._getErrorProperties = function _getErrorProperties(error) {
var properties = {};
Object.keys(error).forEach(function (key) {
if (key === 'stack') return;
var val = error[key];
if (val === null) return;
switch (typeof val) {
case 'function':
return;
case 'object':
if (typeof val.toISOString !== 'function') return;
val = val.toISOString();
}
properties[key] = val;
});
return properties;
};
return ErrorLogging;

@@ -165,0 +178,0 @@ }();

@@ -130,4 +130,2 @@ "use strict";

tr.captureTimings = true;
if (tr.type === _constants.PAGE_LOAD) {

@@ -149,2 +147,6 @@ tr.options.checkBrowserResponsiveness = false;

if (tr.sampled) {
tr.captureTimings = true;
}
this.ensureRespInterval(tr.options.checkBrowserResponsiveness);

@@ -159,5 +161,11 @@ return tr;

var tr;
var fireOnstartHook = true;
if (perfOptions.managed) {
var current = this.currentTransaction;
tr = this.startManagedTransaction(name, type, perfOptions);
if (current === tr) {
fireOnstartHook = false;
}
} else {

@@ -171,8 +179,10 @@ tr = new _transaction.default(name, type, perfOptions);

if (_env.__DEV__) {
this._logger.debug("startTransaction(" + tr.id + ", " + tr.name + ", " + tr.type + ")");
if (fireOnstartHook) {
if (_env.__DEV__) {
this._logger.debug("startTransaction(" + tr.id + ", " + tr.name + ", " + tr.type + ")");
}
this._config.events.send(_constants.TRANSACTION_START, [tr]);
}
this._config.events.send(_constants.TRANSACTION_START, [tr]);
return tr;

@@ -179,0 +189,0 @@ };

{
"name": "@elastic/apm-rum-core",
"version": "4.8.0",
"version": "4.8.1",
"description": "Elastic apm core",

@@ -44,3 +44,3 @@ "license": "MIT",

},
"gitHead": "08b142a7571d7d1c3beec2909bf6170dbb1eef4e"
"gitHead": "e1dc73702055ceabd1b39dc7ab94f6da8df36c87"
}

@@ -35,2 +35,39 @@ /**

/**
* List of keys to be ignored from getting added to custom error properties
*/
const IGNORE_KEYS = ['stack', 'message']
function getErrorProperties(error) {
/**
* Flag which is used to eliminate the empty object
* check on context.custom
*/
let propertyFound = false
const properties = {}
Object.keys(error).forEach(function(key) {
if (IGNORE_KEYS.indexOf(key) >= 0) {
return
}
/**
* ignore null, undefined, function values
*/
let val = error[key]
if (val == null || typeof val === 'function') {
return
}
if (typeof val === 'object') {
if (typeof val.toISOString !== 'function') return
val = val.toISOString()
}
properties[key] = val
propertyFound = true
})
if (propertyFound) {
return properties
}
}
class ErrorLogging {

@@ -64,3 +101,6 @@ constructor(apmServer, configService, transactionService) {

errorType = error.name
errorContext = this._getErrorProperties(error)
const customProperties = getErrorProperties(error)
if (customProperties) {
errorContext.custom = customProperties
}
}

@@ -169,23 +209,4 @@

}
_getErrorProperties(error) {
const properties = {}
Object.keys(error).forEach(function(key) {
if (key === 'stack') return
let val = error[key]
if (val === null) return // null is typeof object and well break the switch below
switch (typeof val) {
case 'function':
return
case 'object':
// ignore all objects except Dates
if (typeof val.toISOString !== 'function') return
val = val.toISOString()
}
properties[key] = val
})
return properties
}
}
export default ErrorLogging

@@ -159,4 +159,2 @@ /**

tr.captureTimings = true
if (tr.type === PAGE_LOAD) {

@@ -179,2 +177,10 @@ tr.options.checkBrowserResponsiveness = false

/**
* For unsampled transactions, avoid capturing various timing information
* as spans since they are dropped before sending to the server
*/
if (tr.sampled) {
tr.captureTimings = true
}
this.ensureRespInterval(tr.options.checkBrowserResponsiveness)

@@ -188,4 +194,17 @@

let tr
/**
* Flag that decides whether we have to fire the `onstart`
* hook for a given transaction
*/
let fireOnstartHook = true
if (perfOptions.managed) {
const current = this.currentTransaction
tr = this.startManagedTransaction(name, type, perfOptions)
/**
* If the current transaction remains the same since the
* transaction could be reused, we should not fire the hook
*/
if (current === tr) {
fireOnstartHook = false
}
} else {

@@ -197,6 +216,8 @@ tr = new Transaction(name, type, perfOptions)

if (__DEV__) {
this._logger.debug(`startTransaction(${tr.id}, ${tr.name}, ${tr.type})`)
if (fireOnstartHook) {
if (__DEV__) {
this._logger.debug(`startTransaction(${tr.id}, ${tr.name}, ${tr.type})`)
}
this._config.events.send(TRANSACTION_START, [tr])
}
this._config.events.send(TRANSACTION_START, [tr])

@@ -203,0 +224,0 @@ return tr

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc