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

Jike v5.6.1 #274

Closed
wants to merge 5 commits into from
Closed
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
19 changes: 12 additions & 7 deletions lib/harvest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const a = require('async')
const CollectorResponse = require('./collector/response')
const logger = require('./logger').child({component: 'Harvest'})
const logger = require('./logger').child({ component: 'Harvest' })

const FROM_MILLIS = 1e-3
const NAMES = require('./metrics/names')
Expand Down Expand Up @@ -188,7 +188,12 @@ class HarvestStep {
// Done!
self.result = response
self.payload = response.payload
callback()

try {
callback()
} catch (err) {
console.warn(err, 'Failed to call callback')
}
})
}

Expand Down Expand Up @@ -426,7 +431,7 @@ class TransactionTraceHarvest extends HarvestStep {
constructor(harvest) {
const traceAggr = harvest.agent.traces
const maxTraceSegments = harvest.agent.config.max_trace_segments
const traces = [].concat(traceAggr.syntheticsTraces)
const traces = [].concat(traceAggr.syntheticsTraces)

if (traceAggr.trace) {
const trace = traceAggr.trace
Expand Down Expand Up @@ -611,7 +616,7 @@ class Harvest {
// Pull out and log any errors from harvest steps.
const errors = results.map((r) => r.error).filter((e) => !!e)
if (errors.length > 0) {
logger.warn({errors}, 'Errors during harvest!')
logger.warn({ errors }, 'Errors during harvest!')
}

// See if any endpoints told us to shutdown or restart. A shutdown trumps
Expand Down Expand Up @@ -654,7 +659,7 @@ function _splitPayload(runId, queue) {
toMerge: queue,
payload: [
runId,
{reservoir_size: queue.limit, events_seen: queue.seen},
{ reservoir_size: queue.limit, events_seen: queue.seen },
queue.toArray()
]
}]
Expand All @@ -672,14 +677,14 @@ function _splitPayload(runId, queue) {
toMerge: firstHalf,
payload: [
runId,
{reservoir_size: limit, events_seen: seen},
{ reservoir_size: limit, events_seen: seen },
firstHalf.map(rawEventsToValues)
]
}, {
toMerge: events,
payload: [
runId,
{reservoir_size: queue.limit - limit, events_seen: queue.seen - seen},
{ reservoir_size: queue.limit - limit, events_seen: queue.seen - seen },
events.map(rawEventsToValues)
]
}]
Expand Down
9 changes: 7 additions & 2 deletions lib/instrumentation/core/http-outbound.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ module.exports = function instrumentOutbound(agent, opts, makeRequest) {
opts = copy.shallow(opts)
}

let hostname = opts.hostname || opts.host || DEFAULT_HOST
let hostname =
(opts.getHeader && opts.getHeader("Host")) ||
(opts.headers && opts.headers.Host) ||
opts.hostname ||
opts.host ||
DEFAULT_HOST
let port = opts.port || opts.defaultPort
if (!port) {
port = (!opts.protocol || opts.protocol === 'http:') ? DEFAULT_PORT : DEFAULT_SSL_PORT
Expand All @@ -55,7 +60,7 @@ module.exports = function instrumentOutbound(agent, opts, makeRequest) {
// but due to legacy issues we can't do that without moving customer's cheese.
//
// TODO: Move customers cheese by not appending the default port for https.
if (port && port !== DEFAULT_PORT) {
if (port && port !== DEFAULT_PORT && !hostname.includes(':')) {
hostname += ':' + port
}

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "newrelic",
"version": "5.6.1",
"name": "@ruguoapp/newrelic",
"version": "5.6.1-jike-alpha.2",
"author": "New Relic Node.js agent team <nodejs@newrelic.com>",
"licenses": [
{
Expand Down