newrelic 9.4.0 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEWS.md +18 -0
- package/README.md +8 -6
- package/index.js +6 -5
- package/lib/collector/remote-method.js +2 -1
- package/lib/config/default.js +528 -287
- package/lib/config/formatters.js +108 -0
- package/lib/config/index.js +69 -91
- package/lib/instrumentation/@hapi/hapi.js +229 -1
- package/lib/instrumentation/{vision.js → @hapi/vision.js} +0 -0
- package/lib/instrumentation/core/async_hooks.js +1 -4
- package/lib/instrumentation/core/globals.js +2 -3
- package/lib/instrumentation/core/http-outbound.js +3 -5
- package/lib/instrumentation/core/http.js +6 -19
- package/lib/instrumentation/core/timers.js +3 -1
- package/lib/instrumentation/mysql/mysql.js +6 -5
- package/lib/instrumentation/promise.js +16 -15
- package/lib/instrumentation/undici.js +10 -15
- package/lib/instrumentations.js +1 -1
- package/lib/shim/constants.js +1 -16
- package/lib/shim/datastore-shim.js +2 -1
- package/lib/shim/promise-shim.js +18 -17
- package/lib/shim/shim.js +37 -82
- package/lib/shim/transaction-shim.js +1 -1
- package/lib/shim/webframework-shim.js +2 -8
- package/lib/shimmer.js +29 -23
- package/lib/symbols.js +26 -0
- package/lib/system-info.js +1 -2
- package/lib/transaction/tracer/index.js +12 -18
- package/lib/util/arity.js +4 -9
- package/lib/util/properties.js +0 -46
- package/package.json +3 -3
- package/lib/config/env.js +0 -294
- package/lib/instrumentation/hapi/hapi.js +0 -207
- package/lib/instrumentation/hapi/shared.js +0 -28
- package/lib/instrumentation/hapi.js +0 -254
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newrelic",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.6.0",
|
|
4
4
|
"author": "New Relic Node.js agent team <nodejs@newrelic.com>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"contributors": [
|
|
@@ -146,8 +146,8 @@
|
|
|
146
146
|
"bench": "node ./bin/run-bench.js",
|
|
147
147
|
"docker-env": "./bin/docker-env-vars.sh",
|
|
148
148
|
"docs": "npm ci && jsdoc -c ./jsdoc-conf.json --private -r .",
|
|
149
|
-
"integration": "npm run prepare-test && npm run sub-install && time tap --test-regex='(\\/|^test\\/integration\\/.*\\.tap\\.js)$' --timeout=180 --no-coverage --reporter classic",
|
|
150
|
-
"integration:async-local": "npm run prepare-test && npm run sub-install && time tap --test-regex='(\\/|^test\\/integration\\/.*\\.tap\\.js)$' --timeout=
|
|
149
|
+
"integration": "npm run prepare-test && npm run sub-install && time c8 -o ./coverage/integration tap --test-regex='(\\/|^test\\/integration\\/.*\\.tap\\.js)$' --timeout=180 --no-coverage --reporter classic",
|
|
150
|
+
"integration:async-local": "npm run prepare-test && npm run sub-install && time c8 -o ./coverage/integration-async-local tap --test-regex='(\\/|^test\\/integration\\/.*\\.tap\\.js)$' --timeout=360 --no-coverage --reporter classic --test-env=NEW_RELIC_FEATURE_FLAG_ASYNC_LOCAL_CONTEXT=1",
|
|
151
151
|
"prepare-test": "npm run ssl && npm run docker-env",
|
|
152
152
|
"lint": "eslint ./*.{js,mjs} lib test bin examples",
|
|
153
153
|
"lint:fix": "eslint --fix, ./*.{js,mjs} lib test bin examples",
|
package/lib/config/env.js
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
'use strict'
|
|
7
|
-
|
|
8
|
-
// Map of configuration values to their associated environment value names.
|
|
9
|
-
const ENV_MAPPING = {
|
|
10
|
-
newrelic_home: 'NEW_RELIC_HOME',
|
|
11
|
-
app_name: 'NEW_RELIC_APP_NAME',
|
|
12
|
-
license_key: 'NEW_RELIC_LICENSE_KEY',
|
|
13
|
-
apdex_t: 'NEW_RELIC_APDEX_T',
|
|
14
|
-
security_policies_token: 'NEW_RELIC_SECURITY_POLICIES_TOKEN',
|
|
15
|
-
ssl: 'NEW_RELIC_USE_SSL',
|
|
16
|
-
host: 'NEW_RELIC_HOST',
|
|
17
|
-
port: 'NEW_RELIC_PORT',
|
|
18
|
-
proxy: 'NEW_RELIC_PROXY_URL',
|
|
19
|
-
proxy_host: 'NEW_RELIC_PROXY_HOST',
|
|
20
|
-
proxy_port: 'NEW_RELIC_PROXY_PORT',
|
|
21
|
-
proxy_user: 'NEW_RELIC_PROXY_USER',
|
|
22
|
-
proxy_pass: 'NEW_RELIC_PROXY_PASS',
|
|
23
|
-
agent_enabled: 'NEW_RELIC_ENABLED',
|
|
24
|
-
allow_all_headers: 'NEW_RELIC_ALLOW_ALL_HEADERS',
|
|
25
|
-
compressed_content_encoding: 'NEW_RELIC_COMPRESSED_CONTENT_ENCODING',
|
|
26
|
-
attributes: {
|
|
27
|
-
enabled: 'NEW_RELIC_ATTRIBUTES_ENABLED',
|
|
28
|
-
exclude: 'NEW_RELIC_ATTRIBUTES_EXCLUDE',
|
|
29
|
-
include: 'NEW_RELIC_ATTRIBUTES_INCLUDE',
|
|
30
|
-
include_enabled: 'NEW_RELIC_ATTRIBUTES_INCLUDE_ENABLED'
|
|
31
|
-
},
|
|
32
|
-
logging: {
|
|
33
|
-
level: 'NEW_RELIC_LOG_LEVEL',
|
|
34
|
-
filepath: 'NEW_RELIC_LOG',
|
|
35
|
-
enabled: 'NEW_RELIC_LOG_ENABLED'
|
|
36
|
-
},
|
|
37
|
-
audit_log: {
|
|
38
|
-
enabled: 'NEW_RELIC_AUDIT_LOG_ENABLED',
|
|
39
|
-
endpoints: 'NEW_RELIC_AUDIT_LOG_ENDPOINTS'
|
|
40
|
-
},
|
|
41
|
-
error_collector: {
|
|
42
|
-
attributes: {
|
|
43
|
-
enabled: 'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_ENABLED'
|
|
44
|
-
},
|
|
45
|
-
enabled: 'NEW_RELIC_ERROR_COLLECTOR_ENABLED',
|
|
46
|
-
ignore_status_codes: 'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERROR_CODES',
|
|
47
|
-
ignore_classes: 'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERRORS',
|
|
48
|
-
expected_status_codes: 'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERROR_CODES',
|
|
49
|
-
expected_classes: 'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERRORS',
|
|
50
|
-
max_event_samples_stored: 'NEW_RELIC_ERROR_COLLECTOR_MAX_EVENT_SAMPLES_STORED'
|
|
51
|
-
},
|
|
52
|
-
strip_exception_messages: {
|
|
53
|
-
enabled: 'NEW_RELIC_STRIP_EXCEPTION_MESSAGES_ENABLED'
|
|
54
|
-
},
|
|
55
|
-
transaction_events: {
|
|
56
|
-
attributes: {
|
|
57
|
-
enabled: 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_ENABLED',
|
|
58
|
-
exclude: 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_EXCLUDE',
|
|
59
|
-
include: 'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_INCLUDE'
|
|
60
|
-
},
|
|
61
|
-
max_samples_stored: 'NEW_RELIC_TRANSACTION_EVENTS_MAX_SAMPLES_STORED'
|
|
62
|
-
},
|
|
63
|
-
custom_insights_events: {
|
|
64
|
-
max_samples_stored: 'NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED'
|
|
65
|
-
},
|
|
66
|
-
transaction_tracer: {
|
|
67
|
-
attributes: {
|
|
68
|
-
enabled: 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_ENABLED',
|
|
69
|
-
exclude: 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_EXCLUDE',
|
|
70
|
-
include: 'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_INCLUDE'
|
|
71
|
-
},
|
|
72
|
-
enabled: 'NEW_RELIC_TRACER_ENABLED',
|
|
73
|
-
transaction_threshold: 'NEW_RELIC_TRACER_THRESHOLD',
|
|
74
|
-
top_n: 'NEW_RELIC_TRACER_TOP_N',
|
|
75
|
-
record_sql: 'NEW_RELIC_RECORD_SQL',
|
|
76
|
-
explain_threshold: 'NEW_RELIC_EXPLAIN_THRESHOLD',
|
|
77
|
-
hide_internals: 'NEW_RELIC_HIDE_INTERNALS'
|
|
78
|
-
},
|
|
79
|
-
utilization: {
|
|
80
|
-
detect_aws: 'NEW_RELIC_UTILIZATION_DETECT_AWS',
|
|
81
|
-
detect_pcf: 'NEW_RELIC_UTILIZATION_DETECT_PCF',
|
|
82
|
-
detect_azure: 'NEW_RELIC_UTILIZATION_DETECT_AZURE',
|
|
83
|
-
detect_gcp: 'NEW_RELIC_UTILIZATION_DETECT_GCP',
|
|
84
|
-
detect_docker: 'NEW_RELIC_UTILIZATION_DETECT_DOCKER',
|
|
85
|
-
detect_kubernetes: 'NEW_RELIC_UTILIZATION_DETECT_KUBERNETES',
|
|
86
|
-
logical_processors: 'NEW_RELIC_UTILIZATION_LOGICAL_PROCESSORS',
|
|
87
|
-
total_ram_mib: 'NEW_RELIC_UTILIZATION_TOTAL_RAM_MIB',
|
|
88
|
-
billing_hostname: 'NEW_RELIC_UTILIZATION_BILLING_HOSTNAME'
|
|
89
|
-
},
|
|
90
|
-
rules: {
|
|
91
|
-
name: 'NEW_RELIC_NAMING_RULES',
|
|
92
|
-
ignore: 'NEW_RELIC_IGNORING_RULES'
|
|
93
|
-
},
|
|
94
|
-
enforce_backstop: 'NEW_RELIC_ENFORCE_BACKSTOP',
|
|
95
|
-
browser_monitoring: {
|
|
96
|
-
attributes: {
|
|
97
|
-
enabled: 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_ENABLED',
|
|
98
|
-
exclude: 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_EXCLUDE',
|
|
99
|
-
include: 'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_INCLUDE'
|
|
100
|
-
},
|
|
101
|
-
enable: 'NEW_RELIC_BROWSER_MONITOR_ENABLE',
|
|
102
|
-
debug: 'NEW_RELIC_BROWSER_MONITOR_DEBUG'
|
|
103
|
-
},
|
|
104
|
-
high_security: 'NEW_RELIC_HIGH_SECURITY',
|
|
105
|
-
labels: 'NEW_RELIC_LABELS',
|
|
106
|
-
slow_sql: {
|
|
107
|
-
enabled: 'NEW_RELIC_SLOW_SQL_ENABLED',
|
|
108
|
-
max_samples: 'NEW_RELIC_MAX_SQL_SAMPLES'
|
|
109
|
-
},
|
|
110
|
-
process_host: {
|
|
111
|
-
display_name: 'NEW_RELIC_PROCESS_HOST_DISPLAY_NAME',
|
|
112
|
-
ipv_preference: 'NEW_RELIC_IPV_PREFERENCE'
|
|
113
|
-
},
|
|
114
|
-
api: {
|
|
115
|
-
custom_attributes_enabled: 'NEW_RELIC_API_CUSTOM_ATTRIBUTES',
|
|
116
|
-
custom_events_enabled: 'NEW_RELIC_API_CUSTOM_EVENTS',
|
|
117
|
-
notice_error_enabled: 'NEW_RELIC_API_NOTICE_ERROR',
|
|
118
|
-
esm: {
|
|
119
|
-
custom_instrumentation_entrypoint: 'NEW_RELIC_API_ESM_CUSTOM_INSTRUMENTATION_ENTRYPOINT'
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
datastore_tracer: {
|
|
123
|
-
instance_reporting: {
|
|
124
|
-
enabled: 'NEW_RELIC_DATASTORE_INSTANCE_REPORTING_ENABLED'
|
|
125
|
-
},
|
|
126
|
-
database_name_reporting: {
|
|
127
|
-
enabled: 'NEW_RELIC_DATASTORE_DATABASE_NAME_REPORTING_ENABLED'
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
grpc: {
|
|
131
|
-
record_errors: 'NEW_RELIC_GRPC_RECORD_ERRORS'
|
|
132
|
-
},
|
|
133
|
-
span_events: {
|
|
134
|
-
enabled: 'NEW_RELIC_SPAN_EVENTS_ENABLED',
|
|
135
|
-
attributes: {
|
|
136
|
-
enabled: 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_ENABLED',
|
|
137
|
-
exclude: 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_EXCLUDE',
|
|
138
|
-
include: 'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_INCLUDE'
|
|
139
|
-
},
|
|
140
|
-
max_samples_stored: 'NEW_RELIC_SPAN_EVENTS_MAX_SAMPLES_STORED'
|
|
141
|
-
},
|
|
142
|
-
transaction_segments: {
|
|
143
|
-
attributes: {
|
|
144
|
-
enabled: 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_ENABLED',
|
|
145
|
-
exclude: 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_EXCLUDE',
|
|
146
|
-
include: 'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_INCLUDE'
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
distributed_tracing: {
|
|
150
|
-
enabled: 'NEW_RELIC_DISTRIBUTED_TRACING_ENABLED',
|
|
151
|
-
exclude_newrelic_header: 'NEW_RELIC_DISTRIBUTED_TRACING_EXCLUDE_NEWRELIC_HEADER'
|
|
152
|
-
},
|
|
153
|
-
message_tracer: {
|
|
154
|
-
segment_parameters: {
|
|
155
|
-
enabled: 'NEW_RELIC_MESSAGE_TRACER_SEGMENT_PARAMETERS_ENABLED'
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
serverless_mode: {
|
|
159
|
-
enabled: 'NEW_RELIC_SERVERLESS_MODE_ENABLED'
|
|
160
|
-
},
|
|
161
|
-
plugins: {
|
|
162
|
-
native_metrics: {
|
|
163
|
-
enabled: 'NEW_RELIC_NATIVE_METRICS_ENABLED'
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
trusted_account_key: 'NEW_RELIC_TRUSTED_ACCOUNT_KEY',
|
|
167
|
-
primary_application_id: 'NEW_RELIC_PRIMARY_APPLICATION_ID',
|
|
168
|
-
account_id: 'NEW_RELIC_ACCOUNT_ID',
|
|
169
|
-
infinite_tracing: {
|
|
170
|
-
trace_observer: {
|
|
171
|
-
host: 'NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_HOST',
|
|
172
|
-
port: 'NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_PORT'
|
|
173
|
-
},
|
|
174
|
-
span_events: {
|
|
175
|
-
queue_size: 'NEW_RELIC_INFINITE_TRACING_SPAN_EVENTS_QUEUE_SIZE'
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
application_logging: {
|
|
179
|
-
enabled: 'NEW_RELIC_APPLICATION_LOGGING_ENABLED',
|
|
180
|
-
forwarding: {
|
|
181
|
-
enabled: 'NEW_RELIC_APPLICATION_LOGGING_FORWARDING_ENABLED',
|
|
182
|
-
max_samples_stored: 'NEW_RELIC_APPLICATION_LOGGING_FORWARDING_MAX_SAMPLES_STORED'
|
|
183
|
-
},
|
|
184
|
-
metrics: {
|
|
185
|
-
enabled: 'NEW_RELIC_APPLICATION_LOGGING_METRICS_ENABLED'
|
|
186
|
-
},
|
|
187
|
-
local_decorating: {
|
|
188
|
-
enabled: 'NEW_RELIC_APPLICATION_LOGGING_LOCAL_DECORATING_ENABLED'
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
ignore_server_configuration: 'NEW_RELIC_IGNORE_SERVER_SIDE_CONFIG'
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// List of environment values which are comma-delimited lists.
|
|
195
|
-
const LIST_VARS = new Set([
|
|
196
|
-
'NEW_RELIC_APP_NAME',
|
|
197
|
-
'NEW_RELIC_ATTRIBUTES_EXCLUDE',
|
|
198
|
-
'NEW_RELIC_ATTRIBUTES_INCLUDE',
|
|
199
|
-
'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERROR_CODES',
|
|
200
|
-
'NEW_RELIC_ERROR_COLLECTOR_IGNORE_ERRORS',
|
|
201
|
-
'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERROR_CODES',
|
|
202
|
-
'NEW_RELIC_ERROR_COLLECTOR_EXPECTED_ERRORS',
|
|
203
|
-
'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_EXCLUDE',
|
|
204
|
-
'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_INCLUDE',
|
|
205
|
-
'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_EXCLUDE',
|
|
206
|
-
'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_INCLUDE',
|
|
207
|
-
'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_EXCLUDE',
|
|
208
|
-
'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_INCLUDE',
|
|
209
|
-
'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_EXCLUDE',
|
|
210
|
-
'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_INCLUDE',
|
|
211
|
-
'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_EXCLUDE',
|
|
212
|
-
'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_INCLUDE',
|
|
213
|
-
'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_EXCLUDE',
|
|
214
|
-
'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_INCLUDE',
|
|
215
|
-
'NEW_RELIC_IGNORING_RULES',
|
|
216
|
-
'NEW_RELIC_AUDIT_LOG_ENDPOINTS'
|
|
217
|
-
])
|
|
218
|
-
|
|
219
|
-
// Mapping to customize the split delimiter for the LIST_VARS
|
|
220
|
-
const LIST_VARS_CUSTOM_DELIMITERS = {
|
|
221
|
-
NEW_RELIC_APP_NAME: /;|,/
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Values in object lists are comma-delimited object literals
|
|
225
|
-
const OBJECT_LIST_VARS = new Set(['NEW_RELIC_NAMING_RULES'])
|
|
226
|
-
|
|
227
|
-
// Values in boolean variables. Is pretty tolerant about values, but don't get
|
|
228
|
-
// fancy--just use 'true' and 'false', everybody.
|
|
229
|
-
const BOOLEAN_VARS = new Set([
|
|
230
|
-
'NEW_RELIC_ENABLED',
|
|
231
|
-
'NEW_RELIC_ALLOW_ALL_HEADERS',
|
|
232
|
-
'NEW_RELIC_ATTRIBUTES_ENABLED',
|
|
233
|
-
'NEW_RELIC_ERROR_COLLECTOR_ENABLED',
|
|
234
|
-
'NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_ENABLED',
|
|
235
|
-
'NEW_RELIC_STRIP_EXCEPTION_MESSAGES_ENABLED',
|
|
236
|
-
'NEW_RELIC_ATTRIBUTES_INCLUDE_ENABLED',
|
|
237
|
-
'NEW_RELIC_TRACER_ENABLED',
|
|
238
|
-
'NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_ENABLED',
|
|
239
|
-
'NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_ENABLED',
|
|
240
|
-
'NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_ENABLED',
|
|
241
|
-
'NEW_RELIC_DEBUG_METRICS',
|
|
242
|
-
'NEW_RELIC_DEBUG_TRACER',
|
|
243
|
-
'NEW_RELIC_ENFORCE_BACKSTOP',
|
|
244
|
-
'NEW_RELIC_USE_SSL',
|
|
245
|
-
'NEW_RELIC_BROWSER_MONITOR_ENABLE',
|
|
246
|
-
'NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_ENABLED',
|
|
247
|
-
'NEW_RELIC_BROWSER_MONITOR_DEBUG',
|
|
248
|
-
'NEW_RELIC_HIGH_SECURITY',
|
|
249
|
-
'NEW_RELIC_SLOW_SQL_ENABLED',
|
|
250
|
-
'NEW_RELIC_GRPC_RECORD_ERRORS',
|
|
251
|
-
'NEW_RELIC_SPAN_EVENTS_ENABLED',
|
|
252
|
-
'NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_ENABLED',
|
|
253
|
-
'NEW_RELIC_DISTRIBUTED_TRACING_ENABLED',
|
|
254
|
-
'NEW_RELIC_DISTRIBUTED_TRACING_EXCLUDE_NEWRELIC_HEADER',
|
|
255
|
-
'NEW_RELIC_LOG_ENABLED',
|
|
256
|
-
'NEW_RELIC_AUDIT_LOG_ENABLED',
|
|
257
|
-
'NEW_RELIC_DATASTORE_DATABASE_NAME_REPORTING_ENABLED',
|
|
258
|
-
'NEW_RELIC_DATASTORE_INSTANCE_REPORTING_ENABLED',
|
|
259
|
-
'NEW_RELIC_MESSAGE_TRACER_SEGMENT_PARAMETERS_ENABLED',
|
|
260
|
-
'NEW_RELIC_UTILIZATION_DETECT_AWS',
|
|
261
|
-
'NEW_RELIC_UTILIZATION_DETECT_PCF',
|
|
262
|
-
'NEW_RELIC_UTILIZATION_DETECT_AZURE',
|
|
263
|
-
'NEW_RELIC_UTILIZATION_DETECT_DOCKER',
|
|
264
|
-
'NEW_RELIC_UTILIZATION_DETECT_GCP',
|
|
265
|
-
'NEW_RELIC_UTILIZATION_DETECT_KUBERNETES',
|
|
266
|
-
'NEW_RELIC_SERVERLESS_MODE_ENABLED',
|
|
267
|
-
'NEW_RELIC_NATIVE_METRICS_ENABLED',
|
|
268
|
-
'NEW_RELIC_APPLICATION_LOGGING_ENABLED',
|
|
269
|
-
'NEW_RELIC_APPLICATION_LOGGING_FORWARDING_ENABLED',
|
|
270
|
-
'NEW_RELIC_APPLICATION_LOGGING_METRICS_ENABLED',
|
|
271
|
-
'NEW_RELIC_APPLICATION_LOGGING_LOCAL_DECORATING_ENABLED',
|
|
272
|
-
'NEW_RELIC_IGNORE_SERVER_SIDE_CONFIG'
|
|
273
|
-
])
|
|
274
|
-
|
|
275
|
-
const FLOAT_VARS = new Set(['NEW_RELIC_APDEX_T', 'NEW_RELIC_TRACER_THRESHOLD'])
|
|
276
|
-
|
|
277
|
-
const INT_VARS = new Set([
|
|
278
|
-
'NEW_RELIC_EXPLAIN_THRESHOLD',
|
|
279
|
-
'NEW_RELIC_MAX_SQL_SAMPLES',
|
|
280
|
-
'NEW_RELIC_INFINITE_TRACING_SPAN_EVENTS_QUEUE_SIZE',
|
|
281
|
-
'NEW_RELIC_SPAN_EVENTS_MAX_SAMPLES_STORED',
|
|
282
|
-
'NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED',
|
|
283
|
-
'NEW_RELIC_TRANSACTION_EVENTS_MAX_SAMPLES_STORED',
|
|
284
|
-
'NEW_RELIC_ERROR_COLLECTOR_MAX_EVENT_SAMPLES_STORED',
|
|
285
|
-
'NEW_RELIC_APPLICATION_LOGGING_FORWARDING_MAX_SAMPLES_STORED'
|
|
286
|
-
])
|
|
287
|
-
|
|
288
|
-
exports.ENV_MAPPING = ENV_MAPPING
|
|
289
|
-
exports.LIST_VARS = LIST_VARS
|
|
290
|
-
exports.LIST_VARS_CUSTOM_DELIMITERS = LIST_VARS_CUSTOM_DELIMITERS
|
|
291
|
-
exports.OBJECT_LIST_VARS = OBJECT_LIST_VARS
|
|
292
|
-
exports.BOOLEAN_VARS = BOOLEAN_VARS
|
|
293
|
-
exports.FLOAT_VARS = FLOAT_VARS
|
|
294
|
-
exports.INT_VARS = INT_VARS
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
'use strict'
|
|
7
|
-
|
|
8
|
-
const shared = require('./shared')
|
|
9
|
-
const record = require('../../metrics/recorders/generic')
|
|
10
|
-
|
|
11
|
-
// TODO: abstract and consolidate mostly-shared hapi functionality
|
|
12
|
-
module.exports = function initialize(agent, hapi, moduleName, shim) {
|
|
13
|
-
// At this point, framework and error predicate have both already been set via ./hapi,
|
|
14
|
-
// so we only need to set the response predicate and wrap the server object
|
|
15
|
-
shim.setResponsePredicate(function hapiResponsePredicate(args, result) {
|
|
16
|
-
return !(result instanceof Error) && result !== args[1].continue
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
// 'Server' and 'server' both point to the same export,
|
|
20
|
-
// but we can't make any assumption about which will be used.
|
|
21
|
-
// Since we wrap the prototype, the second wrap should exit early.
|
|
22
|
-
shim.wrapReturn(hapi, 'server', serverFactoryWrapper)
|
|
23
|
-
shim.wrapReturn(hapi, 'Server', serverFactoryWrapper)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function serverFactoryWrapper(shim, fn, fnName, server) {
|
|
27
|
-
serverPostConstructor.call(server, shim)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function serverPostConstructor(shim) {
|
|
31
|
-
const proto = Object.getPrototypeOf(this)
|
|
32
|
-
|
|
33
|
-
if (shim.isWrapped(proto.decorate)) {
|
|
34
|
-
shim.logger.trace('Already wrapped Server proto, not wrapping again')
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
shim.wrap(proto, 'decorate', function wrapDecorate(shim, original) {
|
|
39
|
-
return function wrappedDecorate(type) {
|
|
40
|
-
// server.decorate also accepts 'request', 'toolkit', 'server' types,
|
|
41
|
-
// but we're only concerned with 'handler'
|
|
42
|
-
if (type !== 'handler') {
|
|
43
|
-
return original.apply(this, arguments)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Convert arguments to usable array
|
|
47
|
-
const args = shim.argsToArray.apply(shim, arguments)
|
|
48
|
-
|
|
49
|
-
// Wrap the third server.decorate arg, the user-defined handler
|
|
50
|
-
shim.wrap(args, shim.THIRD, function wrapHandler(shim, fn) {
|
|
51
|
-
if (typeof fn !== 'function') {
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (fn.defaults) {
|
|
56
|
-
wrappedHandler.defaults = fn.defaults
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return wrappedHandler
|
|
60
|
-
|
|
61
|
-
function wrappedHandler(route) {
|
|
62
|
-
const ret = fn.apply(this, arguments)
|
|
63
|
-
|
|
64
|
-
return typeof ret === 'function' ? wrapRouteHandler(shim, ret, route && route.path) : ret
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
return original.apply(this, args)
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
shim.wrap(proto, 'route', function wrapRoute(shim, original) {
|
|
73
|
-
return function wrappedRoute() {
|
|
74
|
-
const args = shim.argsToArray.apply(shim, arguments)
|
|
75
|
-
|
|
76
|
-
if (!shim.isObject(args[0])) {
|
|
77
|
-
return original.apply(this, args)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// If route is created via a plugin, pull prefix if it exists
|
|
81
|
-
const prefix =
|
|
82
|
-
(this.realm &&
|
|
83
|
-
this.realm.modifiers &&
|
|
84
|
-
this.realm.modifiers.route &&
|
|
85
|
-
this.realm.modifiers.route.prefix) ||
|
|
86
|
-
''
|
|
87
|
-
|
|
88
|
-
_wrapRoute(shim, args[0])
|
|
89
|
-
|
|
90
|
-
return original.apply(this, args)
|
|
91
|
-
|
|
92
|
-
function _wrapRoute(shim, route) {
|
|
93
|
-
const routePath = prefix + route.path
|
|
94
|
-
if (shim.isArray(route)) {
|
|
95
|
-
for (let i = 0; i < route.length; ++i) {
|
|
96
|
-
_wrapRoute(shim, route[i])
|
|
97
|
-
}
|
|
98
|
-
return
|
|
99
|
-
} else if (route.options) {
|
|
100
|
-
// v17 now prefers `options` property...
|
|
101
|
-
if (route.options.pre) {
|
|
102
|
-
// config objects can also contain multiple OTHER handlers in a `pre` array
|
|
103
|
-
route.options.pre = wrapPreHandlers(shim, route.options.pre, routePath)
|
|
104
|
-
}
|
|
105
|
-
if (route.options.handler) {
|
|
106
|
-
_wrapRouteHandler(shim, route.options, routePath)
|
|
107
|
-
return
|
|
108
|
-
}
|
|
109
|
-
} else if (route.config) {
|
|
110
|
-
// ... but `config` still works
|
|
111
|
-
if (route.config.pre) {
|
|
112
|
-
route.config.pre = wrapPreHandlers(shim, route.config.pre, routePath)
|
|
113
|
-
}
|
|
114
|
-
if (route.config.handler) {
|
|
115
|
-
_wrapRouteHandler(shim, route.config, routePath)
|
|
116
|
-
return
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
_wrapRouteHandler(shim, route, routePath)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function _wrapRouteHandler(shim, container, path) {
|
|
123
|
-
if (typeof container.handler !== 'function') {
|
|
124
|
-
return
|
|
125
|
-
}
|
|
126
|
-
shim.wrap(container, 'handler', function wrapHandler(shim, handler) {
|
|
127
|
-
return wrapRouteHandler(shim, handler, path)
|
|
128
|
-
})
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
shim.wrap(proto, 'ext', function wrapExt(shim, original) {
|
|
134
|
-
return function wrappedExt(event, method) {
|
|
135
|
-
const args = shim.argsToArray.apply(shim, arguments)
|
|
136
|
-
|
|
137
|
-
if (shim.isArray(event)) {
|
|
138
|
-
for (let i = 0; i < event.length; i++) {
|
|
139
|
-
event[i].method = wrapMiddleware(shim, event[i].method, event[i].type)
|
|
140
|
-
}
|
|
141
|
-
} else if (shim.isObject(event)) {
|
|
142
|
-
event.method = wrapMiddleware(shim, event.method, event.type)
|
|
143
|
-
} else if (shim.isString(event)) {
|
|
144
|
-
args[1] = wrapMiddleware(shim, method, event)
|
|
145
|
-
} else {
|
|
146
|
-
shim.logger.debug('Unsupported event type %j', event)
|
|
147
|
-
return
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return original.apply(this, args)
|
|
151
|
-
}
|
|
152
|
-
})
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function wrapPreHandlers(shim, container, path) {
|
|
156
|
-
if (shim.isArray(container)) {
|
|
157
|
-
for (let i = 0; i < container.length; ++i) {
|
|
158
|
-
container[i] = wrapPreHandlers(shim, container[i], path)
|
|
159
|
-
}
|
|
160
|
-
return container
|
|
161
|
-
} else if (shim.isFunction(container)) {
|
|
162
|
-
return wrapPreHandler(shim, container, path)
|
|
163
|
-
} else if (container.method && shim.isFunction(container.method)) {
|
|
164
|
-
return shim.wrap(container, 'method', function wrapHandler(shim, handler) {
|
|
165
|
-
return wrapPreHandler(shim, handler, path)
|
|
166
|
-
})
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function wrapPreHandler(shim, container, path) {
|
|
171
|
-
return shim.record(container, (shim) => {
|
|
172
|
-
return { name: [shim.HAPI, ' pre handler: ', '(', path, ')'].join(''), recorder: record }
|
|
173
|
-
})
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function wrapRouteHandler(shim, handler, path) {
|
|
177
|
-
return shim.recordMiddleware(handler, {
|
|
178
|
-
route: path,
|
|
179
|
-
req: function getReq(shim, fn, fnName, args) {
|
|
180
|
-
const request = args[0]
|
|
181
|
-
if (request && request.raw) {
|
|
182
|
-
return request.raw.req
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
promise: true,
|
|
186
|
-
params: function getParams(shim, fn, fnName, args) {
|
|
187
|
-
const req = args[0]
|
|
188
|
-
return req && req.params
|
|
189
|
-
}
|
|
190
|
-
})
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function wrapMiddleware(shim, middleware, event) {
|
|
194
|
-
if (!shared.ROUTE_EVENTS[event]) {
|
|
195
|
-
return middleware
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return shim.recordMiddleware(middleware, {
|
|
199
|
-
route: event,
|
|
200
|
-
type: event === 'onPreResponse' ? shim.ERRORWARE : shim.MIDDLEWARE,
|
|
201
|
-
promise: true,
|
|
202
|
-
req: function getReq(shim, fn, fnName, args) {
|
|
203
|
-
const req = args[0]
|
|
204
|
-
return req && req.raw && req.raw.req
|
|
205
|
-
}
|
|
206
|
-
})
|
|
207
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
'use strict'
|
|
7
|
-
|
|
8
|
-
// This object defines all the events that we want to wrap extensions
|
|
9
|
-
// for, as they are the only ones associated with requests.
|
|
10
|
-
const ROUTE_EVENTS = {
|
|
11
|
-
onRequest: true,
|
|
12
|
-
onPreAuth: true,
|
|
13
|
-
onCredentials: true,
|
|
14
|
-
onPostAuth: true,
|
|
15
|
-
onPreHandler: true,
|
|
16
|
-
onPostHandler: true,
|
|
17
|
-
onPreResponse: true,
|
|
18
|
-
|
|
19
|
-
// Server events
|
|
20
|
-
onPreStart: false,
|
|
21
|
-
onPostStart: false,
|
|
22
|
-
onPreStop: false,
|
|
23
|
-
onPostStop: false
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
module.exports = {
|
|
27
|
-
ROUTE_EVENTS: ROUTE_EVENTS
|
|
28
|
-
}
|