Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

elastic-apm-node

Package Overview
Dependencies
Maintainers
2
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elastic-apm-node - npm Package Compare versions

Comparing version 2.10.0 to 2.11.0

.schemacache/context.json

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# 2.11.0 - 2019/5/3
* chore: rename tags to labels ([#1019](https://github.com/elastic/apm-agent-nodejs/pull/1019))
* feat(config): support global labels ([#1020](https://github.com/elastic/apm-agent-nodejs/pull/1020))
* fix(config): do not use ELASTIC_APM_ prefix for k8s ([#1041](https://github.com/elastic/apm-agent-nodejs/pull/1041))
* fix(instrumentation): prevent handler leak in bindEmitter ([#1044](https://github.com/elastic/apm-agent-nodejs/pull/1044))
# 2.10.0 - 2019/4/15

@@ -2,0 +8,0 @@ * feat(express-graphql): add support for version ^0.8.0 ([#1010](https://github.com/elastic/apm-agent-nodejs/pull/1010))

27

index.d.ts

@@ -59,4 +59,6 @@ /// <reference types="node" />

// Context
setTag (name: string, value: TagValue): boolean;
addTags (tags: Tags): boolean;
setLabel (name: string, value: LabelValue): boolean;
setTag (name: string, value: LabelValue): boolean; // Deprecated
addLabels (labels: Labels): boolean;
addTags (labels: Labels): boolean; // Deprecated
setUserContext (user: UserObject): void;

@@ -84,4 +86,6 @@ setCustomContext (custom: object): void;

setTag (name: string, value: TagValue): boolean;
addTags (tags: Tags): boolean;
setLabel (name: string, value: LabelValue): boolean;
setTag (name: string, value: LabelValue): boolean; // Deprecated
addLabels (labels: Labels): boolean;
addTags (labels: Labels): boolean; // Deprecated
}

@@ -162,3 +166,4 @@

user?: UserObject;
tags?: Tags;
labels?: Labels;
tags?: Labels;
custom?: object;

@@ -168,4 +173,4 @@ message?: string;

interface Tags {
[key: string]: TagValue;
interface Labels {
[key: string]: LabelValue;
}

@@ -215,3 +220,3 @@

type FilterFn = (payload: Payload) => Payload | boolean | void;
type TagValue = string | number | boolean | null | undefined;
type LabelValue = string | number | boolean | null | undefined;

@@ -228,4 +233,6 @@ type Payload = { [propName: string]: any }

interface Taggable {
setTag (name: string, value: TagValue): boolean;
addTags (tags: Tags): boolean;
setLabel (name: string, value: LabelValue): boolean;
setTag (name: string, value: LabelValue): boolean; // Deprecated
addLabels (labels: Labels): boolean;
addTags (labels: Labels): boolean; // Deprecated
}

@@ -232,0 +239,0 @@

@@ -110,3 +110,3 @@ 'use strict'

? parseUrl(this._conf.serverUrl)
: { host: 'localhost', port: '8200' }
: { host: 'localhost:8200', port: '8200' }

@@ -205,11 +205,21 @@ this._conf.serverHost = url.host

Agent.prototype.setTag = function (key, value) {
this.logger.warn('Called deprecated method: apm.setTag(...)')
return this.setLabel(key, value)
}
Agent.prototype.setLabel = function (key, value) {
var trans = this.currentTransaction
if (!trans) return false
return trans.setTag(key, value)
return trans.setLabel(key, value)
}
Agent.prototype.addTags = function (tags) {
this.logger.warn('Called deprecated method: apm.addTags(...)')
return this.addLabels(tags)
}
Agent.prototype.addLabels = function (labels) {
var trans = this.currentTransaction
if (!trans) return false
return trans.addTags(tags)
return trans.addLabels(labels)
}

@@ -298,4 +308,5 @@

{},
trans && trans._tags,
opts && opts.tags
trans && trans._labels,
opts && opts.tags,
opts && opts.labels
),

@@ -302,0 +313,0 @@ custom: Object.assign(

@@ -10,2 +10,3 @@ 'use strict'

var truncate = require('unicode-byte-truncate')
var entries = require('object.entries')

@@ -70,3 +71,4 @@ var version = require('../package').version

usePathAsTransactionName: false,
addPatch: undefined
addPatch: undefined,
globalLabels: undefined
}

@@ -108,10 +110,11 @@

containerId: 'ELASTIC_APM_CONTAINER_ID',
kubernetesNodeName: 'ELASTIC_APM_KUBERNETES_NODE_NAME',
kubernetesNamespace: 'ELASTIC_APM_KUBERNETES_NAMESPACE',
kubernetesPodName: 'ELASTIC_APM_KUBERNETES_POD_NAME',
kubernetesPodUID: 'ELASTIC_APM_KUBERNETES_POD_UID',
kubernetesNodeName: [ 'ELASTIC_APM_KUBERNETES_NODE_NAME', 'KUBERNETES_NODE_NAME' ],
kubernetesNamespace: [ 'ELASTIC_APM_KUBERNETES_NAMESPACE', 'KUBERNETES_NAMESPACE' ],
kubernetesPodName: [ 'ELASTIC_APM_KUBERNETES_POD_NAME', 'KUBERNETES_POD_NAME' ],
kubernetesPodUID: [ 'ELASTIC_APM_KUBERNETES_POD_UID', 'KUBERNETES_POD_UID' ],
captureHeaders: 'ELASTIC_APM_CAPTURE_HEADERS',
metricsInterval: 'ELASTIC_APM_METRICS_INTERVAL',
usePathAsTransactionName: 'ELASTIC_APM_USE_PATH_AS_TRANSACTION_NAME',
addPatch: 'ELASTIC_APM_ADD_PATCH'
addPatch: 'ELASTIC_APM_ADD_PATCH',
globalLabels: 'ELASTIC_APM_GLOBAL_LABELS'
}

@@ -163,3 +166,4 @@

var KEY_VALUE_OPTS = [
'addPatch'
'addPatch',
'globalLabels'
]

@@ -206,2 +210,3 @@

frameworkVersion: conf.frameworkVersion,
globalLabels: maybePairsToObject(conf.globalLabels),
hostname: conf.hostname,

@@ -283,3 +288,8 @@

var env = ENV_TABLE[key]
if (env in process.env) opts[key] = process.env[env]
if (!Array.isArray(env)) env = [ env ]
for (let envKey of env) {
if (envKey in process.env) {
opts[key] = process.env[envKey]
}
}
})

@@ -353,3 +363,11 @@

if (key in opts) {
opts[key] = maybeSplitValues(opts[key])
if (typeof opts[key] === 'object' && !Array.isArray(opts[key])) {
opts[key] = entries(opts[key])
return
}
if (!Array.isArray(opts[key])) {
opts[key] = maybeSplitValues(opts[key])
}
if (Array.isArray(opts[key])) {

@@ -431,1 +449,12 @@ opts[key] = opts[key].map(maybeSplitPairs)

}
function maybePairsToObject (pairs) {
return pairs ? pairsToObject(pairs) : undefined
}
function pairsToObject (pairs) {
return pairs.reduce((object, [key, value]) => {
object[key] = value
return object
}, {})
}

@@ -15,3 +15,3 @@ 'use strict'

this._agent = agent
this._tags = null
this._labels = null

@@ -69,4 +69,9 @@ this.timestamp = this._timer.start

GenericSpan.prototype.setTag = function (key, value) {
this.logger.warn(`Called deprecated method: ${this.constructor.name.toLowerCase()}.setTag(...)`)
return this.setLabel(key, value)
}
GenericSpan.prototype.setLabel = function (key, value) {
if (!key) return false
if (!this._tags) this._tags = {}
if (!this._labels) this._labels = {}
var skey = key.replace(/[.*"]/g, '_')

@@ -76,3 +81,3 @@ if (key !== skey) {

}
this._tags[skey] = truncate(String(value), config.INTAKE_STRING_MAX_SIZE)
this._labels[skey] = truncate(String(value), config.INTAKE_STRING_MAX_SIZE)
return true

@@ -82,6 +87,11 @@ }

GenericSpan.prototype.addTags = function (tags) {
if (!tags) return false
var keys = Object.keys(tags)
this.logger.warn(`Called deprecated method: ${this.constructor.name.toLowerCase()}.addTags(...)`)
return this.addLabels(tags)
}
GenericSpan.prototype.addLabels = function (labels) {
if (!labels) return false
var keys = Object.keys(labels)
for (let key of keys) {
if (!this.setTag(key, tags[key])) {
if (!this.setLabel(key, labels[key])) {
return false

@@ -88,0 +98,0 @@ }

@@ -259,2 +259,4 @@ 'use strict'

var wrapped = Symbol('elastic-apm-wrapped-function')
Instrumentation.prototype.bindFunction = function (original) {

@@ -270,2 +272,4 @@ if (typeof original !== 'function' || original.name === 'elasticAPMCallbackWrapper') return original

original[wrapped] = elasticAPMCallbackWrapper
return elasticAPMCallbackWrapper

@@ -289,3 +293,3 @@

var methods = [
var addMethods = [
'on',

@@ -295,9 +299,18 @@ 'addListener'

var removeMethods = [
'off',
'removeListener'
]
if (semver.satisfies(process.versions.node, '>=6')) {
methods.push('prependListener')
addMethods.push('prependListener')
}
shimmer.massWrap(emitter, methods, (original) => function (name, handler) {
shimmer.massWrap(emitter, addMethods, (original) => function (name, handler) {
return original.call(this, name, ins.bindFunction(handler))
})
shimmer.massWrap(emitter, removeMethods, (original) => function (name, handler) {
return original.call(this, name, handler[wrapped] || handler)
})
}

@@ -304,0 +317,0 @@

@@ -139,6 +139,6 @@ 'use strict'

if (self._db || self._tags) {
if (self._db || self._labels) {
payload.context = {
db: self._db || undefined,
tags: self._tags || undefined
tags: self._labels || undefined
}

@@ -145,0 +145,0 @@ }

@@ -127,3 +127,3 @@ 'use strict'

),
tags: this._tags || {},
tags: this._labels || {},
custom: this._custom || {}

@@ -130,0 +130,0 @@ }

{
"name": "elastic-apm-node",
"version": "2.10.0",
"version": "2.11.0",
"description": "The official Elastic APM agent for Node.js",

@@ -80,3 +80,3 @@ "main": "index.js",

"core-util-is": "^1.0.2",
"elastic-apm-http-client": "^7.2.2",
"elastic-apm-http-client": "^7.3.0",
"end-of-stream": "^1.4.1",

@@ -88,2 +88,3 @@ "fast-safe-stringify": "^2.0.6",

"object-filter-sequence": "^1.0.0",
"object.entries": "^1.1.0",
"original-url": "^1.2.2",

@@ -145,3 +146,3 @@ "read-pkg-up": "^4.0.0",

"ndjson": "^1.5.0",
"nyc": "^13.1.0",
"nyc": "^14.0.0",
"once": "^1.4.0",

@@ -153,3 +154,3 @@ "p-finally": "^1.0.0",

"request": "^2.88.0",
"restify": "^7.7.0",
"restify": "^8.3.1",
"restify-clients": "^2.6.2",

@@ -160,7 +161,7 @@ "rimraf": "^2.6.2",

"tape": "4.9.x",
"tedious": "^5.0.3",
"tedious": "^6.1.1",
"test-all-versions": "^4.0.0",
"thunky": "^1.0.3",
"typescript": "^3.3.4000",
"untildify": "^3.0.3",
"untildify": "^4.0.0",
"util.promisify": "^1.0.0",

@@ -167,0 +168,0 @@ "wait-on": "^3.1.0",

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