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

elastic-apm-http-client

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elastic-apm-http-client - npm Package Compare versions

Comparing version 7.1.1 to 7.1.2

16

index.js

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

const ndjson = require('./lib/ndjson')
const stringify = require('./lib/stringify')
const truncate = require('./lib/truncate')

@@ -211,22 +210,21 @@ const pkg = require('./package')

Client.prototype._encode = function (obj, enc) {
const out = {}
switch (enc) {
case Client.encoding.SPAN:
truncate.span(obj.span, this._opts)
out.span = truncate.span(obj.span, this._opts)
break
case Client.encoding.TRANSACTION:
stringify.context(obj.transaction.context)
truncate.transaction(obj.transaction, this._opts)
out.transaction = truncate.transaction(obj.transaction, this._opts)
break
case Client.encoding.METADATA:
truncate.metadata(obj.metadata, this._opts)
out.metadata = truncate.metadata(obj.metadata, this._opts)
break
case Client.encoding.ERROR:
stringify.context(obj.error.context)
truncate.error(obj.error, this._opts)
out.error = truncate.error(obj.error, this._opts)
break
case Client.encoding.METRICSET:
truncate.metricset(obj.metricset, this._opts)
out.metricset = truncate.metricset(obj.metricset, this._opts)
break
}
return ndjson.serialize(obj)
return ndjson.serialize(out)
}

@@ -233,0 +231,0 @@

@@ -13,188 +13,212 @@ 'use strict'

function truncMetadata (metadata, opts) {
breadthFilter(metadata, (value, key, path) => {
if (typeof value !== 'string') {
return value
}
return breadthFilter(metadata, {
onArray,
onObject,
onValue (value, key, path) {
if (typeof value !== 'string') {
return value
}
let max = opts.truncateStringsAt
switch (path[0]) {
case 'service':
switch (path[1]) {
case 'name':
case 'version':
case 'environment':
let max = opts.truncateStringsAt
switch (path[0]) {
case 'service':
switch (path[1]) {
case 'name':
case 'version':
case 'environment':
max = opts.truncateKeywordsAt
break
case 'agent':
case 'framework':
case 'language':
case 'runtime':
switch (path[2]) {
case 'name':
case 'version':
max = opts.truncateKeywordsAt
break
}
break
}
break
case 'process':
if (path[1] === 'title') {
max = opts.truncateKeywordsAt
break
}
break
case 'agent':
case 'framework':
case 'language':
case 'runtime':
switch (path[2]) {
case 'name':
case 'version':
max = opts.truncateKeywordsAt
break
}
break
}
break
case 'system':
switch (path[1]) {
case 'architecture':
case 'hostname':
case 'platform':
max = opts.truncateKeywordsAt
break
}
break
}
case 'process':
if (path[1] === 'title') {
max = opts.truncateKeywordsAt
}
break
case 'system':
switch (path[1]) {
case 'architecture':
case 'hostname':
case 'platform':
max = opts.truncateKeywordsAt
break
}
break
return truncate(value, max)
}
return truncate(value, max)
}, true)
})
}
function truncTransaction (trans, opts) {
trans.name = truncate(String(trans.name), opts.truncateKeywordsAt)
trans.type = truncate(String(trans.type), opts.truncateKeywordsAt)
trans.result = truncate(String(trans.result), opts.truncateKeywordsAt)
const result = breadthFilter(trans, {
onArray,
onObject: onObjectWithHeaders,
onValue (value, key, path) {
if (typeof value !== 'string') {
if (isHeader(path)) return String(value)
breadthFilter(trans, (value, key, path) => {
if (typeof value !== 'string') {
return value
}
let max = opts.truncateStringsAt
switch (path[0]) {
case 'name':
case 'type':
case 'result':
return value
}
case 'id':
case 'trace_id':
case 'parent_id':
max = opts.truncateKeywordsAt
break
let max = opts.truncateStringsAt
switch (path[0]) {
case 'name':
case 'type':
case 'result':
case 'id':
case 'trace_id':
case 'parent_id':
max = opts.truncateKeywordsAt
break
case 'context':
max = contextLength(path, opts)
break
case 'context':
max = contextLength(path, opts)
break
}
return truncate(value, max)
}
})
return truncate(value, max)
}, true)
return Object.assign({
name: 'undefined',
type: 'undefined',
result: 'undefined'
}, result)
}
function truncSpan (span, opts) {
span.name = truncate(String(span.name), opts.truncateKeywordsAt)
span.type = truncate(String(span.type), opts.truncateKeywordsAt)
const result = breadthFilter(span, {
onArray,
onObject,
onValue (value, key, path) {
if (typeof value !== 'string') {
return value
}
breadthFilter(span, (value, key, path) => {
if (typeof value !== 'string') {
return value
}
let max = opts.truncateStringsAt
switch (path[0]) {
case 'name':
case 'type':
case 'id':
case 'trace_id':
case 'parent_id':
case 'transaction_id':
case 'subtype':
case 'action':
max = opts.truncateKeywordsAt
break
let max = opts.truncateStringsAt
switch (path[0]) {
case 'name':
case 'type':
return value
case 'context':
max = contextLength(path, opts)
break
}
case 'id':
case 'trace_id':
case 'parent_id':
case 'transaction_id':
case 'subtype':
case 'action':
max = opts.truncateKeywordsAt
break
case 'context':
max = contextLength(path, opts)
break
return truncate(value, max)
}
})
return truncate(value, max)
}, true)
return Object.assign({
name: 'undefined',
type: 'undefined'
}, result)
}
function truncError (error, opts) {
breadthFilter(error, (value, key, path) => {
if (typeof value !== 'string') {
return value
}
return breadthFilter(error, {
onArray,
onObject: onObjectWithHeaders,
onValue (value, key, path) {
if (typeof value !== 'string') {
if (isHeader(path)) return String(value)
let max = opts.truncateStringsAt
switch (path[0]) {
case 'id':
case 'trace_id':
case 'parent_id':
case 'transaction_id':
max = opts.truncateKeywordsAt
break
return value
}
case 'context':
max = contextLength(path, opts)
break
let max = opts.truncateStringsAt
switch (path[0]) {
case 'id':
case 'trace_id':
case 'parent_id':
case 'transaction_id':
max = opts.truncateKeywordsAt
break
case 'log':
switch (path[1]) {
case 'level':
case 'logger_name':
case 'param_message':
max = opts.truncateKeywordsAt
break
case 'context':
max = contextLength(path, opts)
break
case 'message':
if (opts.truncateErrorMessagesAt >= 0) {
max = opts.truncateErrorMessagesAt
} else {
return value
}
break
}
break
case 'log':
switch (path[1]) {
case 'level':
case 'logger_name':
case 'param_message':
max = opts.truncateKeywordsAt
break
case 'exception':
switch (path[1]) {
case 'type':
case 'code':
case 'module':
max = opts.truncateKeywordsAt
break
case 'message':
if (opts.truncateErrorMessagesAt >= 0) {
max = opts.truncateErrorMessagesAt
} else {
return value
}
break
}
break
case 'message':
if (opts.truncateErrorMessagesAt >= 0) {
max = opts.truncateErrorMessagesAt
} else {
return value
}
break
}
break
case 'exception':
switch (path[1]) {
case 'type':
case 'code':
case 'module':
max = opts.truncateKeywordsAt
break
case 'message':
if (opts.truncateErrorMessagesAt >= 0) {
max = opts.truncateErrorMessagesAt
} else {
return value
}
break
}
break
}
return truncate(value, max)
}
return truncate(value, max)
}, true)
})
}
function truncMetricSet (metricset, opts) {
breadthFilter(metricset, (value, key, path) => {
if (typeof value !== 'string') {
return value
}
return breadthFilter(metricset, {
onArray,
onObject,
onValue (value, key, path) {
if (typeof value !== 'string') {
return value
}
let max = path[0] === 'tags'
? opts.truncateKeywordsAt
: opts.truncateStringsAt
let max = path[0] === 'tags'
? opts.truncateKeywordsAt
: opts.truncateStringsAt
return truncate(value, max)
}, true)
return truncate(value, max)
}
})
}

@@ -247,1 +271,18 @@

}
function isHeader (path) {
return path[0] === 'context' && (path[1] === 'request' || path[1] === 'response') && path[2] === 'headers' && path[3]
}
function onObjectWithHeaders (value, key, path, isNew) {
if (isHeader(path)) return String(value)
return onObject(value, key, path, isNew)
}
function onObject (value, key, path, isNew) {
return isNew ? {} : '[Circular]'
}
function onArray (value, key, path, isNew) {
return isNew ? [] : '[Circular]'
}
{
"name": "elastic-apm-http-client",
"version": "7.1.1",
"version": "7.1.2",
"description": "A low-level HTTP client for communicating with the Elastic APM intake API",

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

"dependencies": {
"breadth-filter": "^1.2.0",
"breadth-filter": "^2.0.0",
"container-info": "^1.0.0",

@@ -26,3 +26,3 @@ "end-of-stream": "^1.4.1",

"pump": "^3.0.0",
"readable-stream": "^3.0.6",
"readable-stream": "^3.2.0",
"stream-chopper": "^3.0.1",

@@ -32,9 +32,9 @@ "unicode-byte-truncate": "^1.0.0"

"devDependencies": {
"codecov": "^3.0.4",
"codecov": "^3.2.0",
"https-pem": "^2.0.0",
"ndjson": "^1.5.0",
"nyc": "^13.0.1",
"semver": "^5.5.1",
"nyc": "^13.3.0",
"semver": "^5.6.0",
"standard": "^12.0.1",
"tape": "^4.9.1"
"tape": "^4.10.1"
},

@@ -56,5 +56,5 @@ "repository": {

"coordinates": [
55.778272,
12.593194
55.6773706,
12.5614183
]
}
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