newrelic 6.5.0 → 6.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/.eslintignore CHANGED
@@ -1 +1 @@
1
- **/node_modules/**
1
+ **/node_modules/**
package/NEWS.md CHANGED
@@ -1,3 +1,23 @@
1
+ ### 6.6.0 (2020-04-20):
2
+
3
+ * Added support for [Infinite Tracing on New Relic
4
+ Edge](https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/enable-configure/enable-distributed-tracing).
5
+
6
+ Infinite Tracing observes 100% of your distributed traces and provides
7
+ visualizations for the most actionable data so you have the examples of errors
8
+ and long-running traces so you can better diagnose and troubleshoot your systems.
9
+
10
+ You configure your agent to send traces to a trace observer in New Relic Edge.
11
+ You view your distributed traces through the New Relic’s UI. There is no need to
12
+ install a collector on your network.
13
+
14
+ Infinite Tracing is currently available on a sign-up basis. If you would like to
15
+ participate, please contact your sales representative.
16
+
17
+ * Added `function_version` to lambda metadata payload.
18
+
19
+ This is pulled from an invocation's `context.functionVersion` value.
20
+
1
21
  ### 6.5.0 (2020-03-18):
2
22
 
3
23
  * Added error attributes to spans.
@@ -237,3 +237,423 @@ THE SOFTWARE.
237
237
  ```
238
238
 
239
239
  Portions copyright [Node.js] contributors. Depending on your existing libraries and package management settings, your systems may call externally maintained libraries in addition to those listed above. See [here](https://nodejs.org/en/docs/meta/topics/dependencies/) and [here](https://github.com/nodejs/node/blob/v4.3.1/LICENSE) for additional details regarding externally maintained libraries and certain related licenses and notices.
240
+
241
+ ## @grpc/grpc-js
242
+
243
+ This product includes source derived from
244
+ [@grpc/grpc-js](https://github.com/grpc/grpc-node/tree/master/packages/grpc-js), distributed under the
245
+ [Apache-2.0 license](https://github.com/grpc/grpc-node/blob/%40grpc/grpc-js%400.6.12/packages/grpc-js/LICENSE):
246
+
247
+ ```
248
+ Apache License
249
+ Version 2.0, January 2004
250
+ http://www.apache.org/licenses/
251
+
252
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
253
+
254
+ 1. Definitions.
255
+
256
+ "License" shall mean the terms and conditions for use, reproduction,
257
+ and distribution as defined by Sections 1 through 9 of this document.
258
+
259
+ "Licensor" shall mean the copyright owner or entity authorized by
260
+ the copyright owner that is granting the License.
261
+
262
+ "Legal Entity" shall mean the union of the acting entity and all
263
+ other entities that control, are controlled by, or are under common
264
+ control with that entity. For the purposes of this definition,
265
+ "control" means (i) the power, direct or indirect, to cause the
266
+ direction or management of such entity, whether by contract or
267
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
268
+ outstanding shares, or (iii) beneficial ownership of such entity.
269
+
270
+ "You" (or "Your") shall mean an individual or Legal Entity
271
+ exercising permissions granted by this License.
272
+
273
+ "Source" form shall mean the preferred form for making modifications,
274
+ including but not limited to software source code, documentation
275
+ source, and configuration files.
276
+
277
+ "Object" form shall mean any form resulting from mechanical
278
+ transformation or translation of a Source form, including but
279
+ not limited to compiled object code, generated documentation,
280
+ and conversions to other media types.
281
+
282
+ "Work" shall mean the work of authorship, whether in Source or
283
+ Object form, made available under the License, as indicated by a
284
+ copyright notice that is included in or attached to the work
285
+ (an example is provided in the Appendix below).
286
+
287
+ "Derivative Works" shall mean any work, whether in Source or Object
288
+ form, that is based on (or derived from) the Work and for which the
289
+ editorial revisions, annotations, elaborations, or other modifications
290
+ represent, as a whole, an original work of authorship. For the purposes
291
+ of this License, Derivative Works shall not include works that remain
292
+ separable from, or merely link (or bind by name) to the interfaces of,
293
+ the Work and Derivative Works thereof.
294
+
295
+ "Contribution" shall mean any work of authorship, including
296
+ the original version of the Work and any modifications or additions
297
+ to that Work or Derivative Works thereof, that is intentionally
298
+ submitted to Licensor for inclusion in the Work by the copyright owner
299
+ or by an individual or Legal Entity authorized to submit on behalf of
300
+ the copyright owner. For the purposes of this definition, "submitted"
301
+ means any form of electronic, verbal, or written communication sent
302
+ to the Licensor or its representatives, including but not limited to
303
+ communication on electronic mailing lists, source code control systems,
304
+ and issue tracking systems that are managed by, or on behalf of, the
305
+ Licensor for the purpose of discussing and improving the Work, but
306
+ excluding communication that is conspicuously marked or otherwise
307
+ designated in writing by the copyright owner as "Not a Contribution."
308
+
309
+ "Contributor" shall mean Licensor and any individual or Legal Entity
310
+ on behalf of whom a Contribution has been received by Licensor and
311
+ subsequently incorporated within the Work.
312
+
313
+ 2. Grant of Copyright License. Subject to the terms and conditions of
314
+ this License, each Contributor hereby grants to You a perpetual,
315
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
316
+ copyright license to reproduce, prepare Derivative Works of,
317
+ publicly display, publicly perform, sublicense, and distribute the
318
+ Work and such Derivative Works in Source or Object form.
319
+
320
+ 3. Grant of Patent License. Subject to the terms and conditions of
321
+ this License, each Contributor hereby grants to You a perpetual,
322
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
323
+ (except as stated in this section) patent license to make, have made,
324
+ use, offer to sell, sell, import, and otherwise transfer the Work,
325
+ where such license applies only to those patent claims licensable
326
+ by such Contributor that are necessarily infringed by their
327
+ Contribution(s) alone or by combination of their Contribution(s)
328
+ with the Work to which such Contribution(s) was submitted. If You
329
+ institute patent litigation against any entity (including a
330
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
331
+ or a Contribution incorporated within the Work constitutes direct
332
+ or contributory patent infringement, then any patent licenses
333
+ granted to You under this License for that Work shall terminate
334
+ as of the date such litigation is filed.
335
+
336
+ 4. Redistribution. You may reproduce and distribute copies of the
337
+ Work or Derivative Works thereof in any medium, with or without
338
+ modifications, and in Source or Object form, provided that You
339
+ meet the following conditions:
340
+
341
+ (a) You must give any other recipients of the Work or
342
+ Derivative Works a copy of this License; and
343
+
344
+ (b) You must cause any modified files to carry prominent notices
345
+ stating that You changed the files; and
346
+
347
+ (c) You must retain, in the Source form of any Derivative Works
348
+ that You distribute, all copyright, patent, trademark, and
349
+ attribution notices from the Source form of the Work,
350
+ excluding those notices that do not pertain to any part of
351
+ the Derivative Works; and
352
+
353
+ (d) If the Work includes a "NOTICE" text file as part of its
354
+ distribution, then any Derivative Works that You distribute must
355
+ include a readable copy of the attribution notices contained
356
+ within such NOTICE file, excluding those notices that do not
357
+ pertain to any part of the Derivative Works, in at least one
358
+ of the following places: within a NOTICE text file distributed
359
+ as part of the Derivative Works; within the Source form or
360
+ documentation, if provided along with the Derivative Works; or,
361
+ within a display generated by the Derivative Works, if and
362
+ wherever such third-party notices normally appear. The contents
363
+ of the NOTICE file are for informational purposes only and
364
+ do not modify the License. You may add Your own attribution
365
+ notices within Derivative Works that You distribute, alongside
366
+ or as an addendum to the NOTICE text from the Work, provided
367
+ that such additional attribution notices cannot be construed
368
+ as modifying the License.
369
+
370
+ You may add Your own copyright statement to Your modifications and
371
+ may provide additional or different license terms and conditions
372
+ for use, reproduction, or distribution of Your modifications, or
373
+ for any such Derivative Works as a whole, provided Your use,
374
+ reproduction, and distribution of the Work otherwise complies with
375
+ the conditions stated in this License.
376
+
377
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
378
+ any Contribution intentionally submitted for inclusion in the Work
379
+ by You to the Licensor shall be under the terms and conditions of
380
+ this License, without any additional terms or conditions.
381
+ Notwithstanding the above, nothing herein shall supersede or modify
382
+ the terms of any separate license agreement you may have executed
383
+ with Licensor regarding such Contributions.
384
+
385
+ 6. Trademarks. This License does not grant permission to use the trade
386
+ names, trademarks, service marks, or product names of the Licensor,
387
+ except as required for reasonable and customary use in describing the
388
+ origin of the Work and reproducing the content of the NOTICE file.
389
+
390
+ 7. Disclaimer of Warranty. Unless required by applicable law or
391
+ agreed to in writing, Licensor provides the Work (and each
392
+ Contributor provides its Contributions) on an "AS IS" BASIS,
393
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
394
+ implied, including, without limitation, any warranties or conditions
395
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
396
+ PARTICULAR PURPOSE. You are solely responsible for determining the
397
+ appropriateness of using or redistributing the Work and assume any
398
+ risks associated with Your exercise of permissions under this License.
399
+
400
+ 8. Limitation of Liability. In no event and under no legal theory,
401
+ whether in tort (including negligence), contract, or otherwise,
402
+ unless required by applicable law (such as deliberate and grossly
403
+ negligent acts) or agreed to in writing, shall any Contributor be
404
+ liable to You for damages, including any direct, indirect, special,
405
+ incidental, or consequential damages of any character arising as a
406
+ result of this License or out of the use or inability to use the
407
+ Work (including but not limited to damages for loss of goodwill,
408
+ work stoppage, computer failure or malfunction, or any and all
409
+ other commercial damages or losses), even if such Contributor
410
+ has been advised of the possibility of such damages.
411
+
412
+ 9. Accepting Warranty or Additional Liability. While redistributing
413
+ the Work or Derivative Works thereof, You may choose to offer,
414
+ and charge a fee for, acceptance of support, warranty, indemnity,
415
+ or other liability obligations and/or rights consistent with this
416
+ License. However, in accepting such obligations, You may act only
417
+ on Your own behalf and on Your sole responsibility, not on behalf
418
+ of any other Contributor, and only if You agree to indemnify,
419
+ defend, and hold each Contributor harmless for any liability
420
+ incurred by, or claims asserted against, such Contributor by reason
421
+ of your accepting any such warranty or additional liability.
422
+
423
+ END OF TERMS AND CONDITIONS
424
+
425
+ APPENDIX: How to apply the Apache License to your work.
426
+
427
+ To apply the Apache License to your work, attach the following
428
+ boilerplate notice, with the fields enclosed by brackets "{}"
429
+ replaced with your own identifying information. (Don't include
430
+ the brackets!) The text should be enclosed in the appropriate
431
+ comment syntax for the file format. We also recommend that a
432
+ file or class name and description of purpose be included on the
433
+ same "printed page" as the copyright notice for easier
434
+ identification within third-party archives.
435
+
436
+ Copyright {yyyy} {name of copyright owner}
437
+
438
+ Licensed under the Apache License, Version 2.0 (the "License");
439
+ you may not use this file except in compliance with the License.
440
+ You may obtain a copy of the License at
441
+
442
+ http://www.apache.org/licenses/LICENSE-2.0
443
+
444
+ Unless required by applicable law or agreed to in writing, software
445
+ distributed under the License is distributed on an "AS IS" BASIS,
446
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
447
+ See the License for the specific language governing permissions and
448
+ limitations under the License.
449
+ ```
450
+
451
+ ## @grpc/proto-loader
452
+
453
+ This product includes source derived from
454
+ [@grpc/proto-loader](https://github.com/grpc/grpc-node/tree/master/packages/proto-loader), distributed under the
455
+ [Apache-2.0 license](https://github.com/grpc/grpc-node/blob/%40grpc/proto-loader%400.5.2/packages/proto-loader/LICENSE):
456
+
457
+ ```
458
+ Apache License
459
+ Version 2.0, January 2004
460
+ http://www.apache.org/licenses/
461
+
462
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
463
+
464
+ 1. Definitions.
465
+
466
+ "License" shall mean the terms and conditions for use, reproduction,
467
+ and distribution as defined by Sections 1 through 9 of this document.
468
+
469
+ "Licensor" shall mean the copyright owner or entity authorized by
470
+ the copyright owner that is granting the License.
471
+
472
+ "Legal Entity" shall mean the union of the acting entity and all
473
+ other entities that control, are controlled by, or are under common
474
+ control with that entity. For the purposes of this definition,
475
+ "control" means (i) the power, direct or indirect, to cause the
476
+ direction or management of such entity, whether by contract or
477
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
478
+ outstanding shares, or (iii) beneficial ownership of such entity.
479
+
480
+ "You" (or "Your") shall mean an individual or Legal Entity
481
+ exercising permissions granted by this License.
482
+
483
+ "Source" form shall mean the preferred form for making modifications,
484
+ including but not limited to software source code, documentation
485
+ source, and configuration files.
486
+
487
+ "Object" form shall mean any form resulting from mechanical
488
+ transformation or translation of a Source form, including but
489
+ not limited to compiled object code, generated documentation,
490
+ and conversions to other media types.
491
+
492
+ "Work" shall mean the work of authorship, whether in Source or
493
+ Object form, made available under the License, as indicated by a
494
+ copyright notice that is included in or attached to the work
495
+ (an example is provided in the Appendix below).
496
+
497
+ "Derivative Works" shall mean any work, whether in Source or Object
498
+ form, that is based on (or derived from) the Work and for which the
499
+ editorial revisions, annotations, elaborations, or other modifications
500
+ represent, as a whole, an original work of authorship. For the purposes
501
+ of this License, Derivative Works shall not include works that remain
502
+ separable from, or merely link (or bind by name) to the interfaces of,
503
+ the Work and Derivative Works thereof.
504
+
505
+ "Contribution" shall mean any work of authorship, including
506
+ the original version of the Work and any modifications or additions
507
+ to that Work or Derivative Works thereof, that is intentionally
508
+ submitted to Licensor for inclusion in the Work by the copyright owner
509
+ or by an individual or Legal Entity authorized to submit on behalf of
510
+ the copyright owner. For the purposes of this definition, "submitted"
511
+ means any form of electronic, verbal, or written communication sent
512
+ to the Licensor or its representatives, including but not limited to
513
+ communication on electronic mailing lists, source code control systems,
514
+ and issue tracking systems that are managed by, or on behalf of, the
515
+ Licensor for the purpose of discussing and improving the Work, but
516
+ excluding communication that is conspicuously marked or otherwise
517
+ designated in writing by the copyright owner as "Not a Contribution."
518
+
519
+ "Contributor" shall mean Licensor and any individual or Legal Entity
520
+ on behalf of whom a Contribution has been received by Licensor and
521
+ subsequently incorporated within the Work.
522
+
523
+ 2. Grant of Copyright License. Subject to the terms and conditions of
524
+ this License, each Contributor hereby grants to You a perpetual,
525
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
526
+ copyright license to reproduce, prepare Derivative Works of,
527
+ publicly display, publicly perform, sublicense, and distribute the
528
+ Work and such Derivative Works in Source or Object form.
529
+
530
+ 3. Grant of Patent License. Subject to the terms and conditions of
531
+ this License, each Contributor hereby grants to You a perpetual,
532
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
533
+ (except as stated in this section) patent license to make, have made,
534
+ use, offer to sell, sell, import, and otherwise transfer the Work,
535
+ where such license applies only to those patent claims licensable
536
+ by such Contributor that are necessarily infringed by their
537
+ Contribution(s) alone or by combination of their Contribution(s)
538
+ with the Work to which such Contribution(s) was submitted. If You
539
+ institute patent litigation against any entity (including a
540
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
541
+ or a Contribution incorporated within the Work constitutes direct
542
+ or contributory patent infringement, then any patent licenses
543
+ granted to You under this License for that Work shall terminate
544
+ as of the date such litigation is filed.
545
+
546
+ 4. Redistribution. You may reproduce and distribute copies of the
547
+ Work or Derivative Works thereof in any medium, with or without
548
+ modifications, and in Source or Object form, provided that You
549
+ meet the following conditions:
550
+
551
+ (a) You must give any other recipients of the Work or
552
+ Derivative Works a copy of this License; and
553
+
554
+ (b) You must cause any modified files to carry prominent notices
555
+ stating that You changed the files; and
556
+
557
+ (c) You must retain, in the Source form of any Derivative Works
558
+ that You distribute, all copyright, patent, trademark, and
559
+ attribution notices from the Source form of the Work,
560
+ excluding those notices that do not pertain to any part of
561
+ the Derivative Works; and
562
+
563
+ (d) If the Work includes a "NOTICE" text file as part of its
564
+ distribution, then any Derivative Works that You distribute must
565
+ include a readable copy of the attribution notices contained
566
+ within such NOTICE file, excluding those notices that do not
567
+ pertain to any part of the Derivative Works, in at least one
568
+ of the following places: within a NOTICE text file distributed
569
+ as part of the Derivative Works; within the Source form or
570
+ documentation, if provided along with the Derivative Works; or,
571
+ within a display generated by the Derivative Works, if and
572
+ wherever such third-party notices normally appear. The contents
573
+ of the NOTICE file are for informational purposes only and
574
+ do not modify the License. You may add Your own attribution
575
+ notices within Derivative Works that You distribute, alongside
576
+ or as an addendum to the NOTICE text from the Work, provided
577
+ that such additional attribution notices cannot be construed
578
+ as modifying the License.
579
+
580
+ You may add Your own copyright statement to Your modifications and
581
+ may provide additional or different license terms and conditions
582
+ for use, reproduction, or distribution of Your modifications, or
583
+ for any such Derivative Works as a whole, provided Your use,
584
+ reproduction, and distribution of the Work otherwise complies with
585
+ the conditions stated in this License.
586
+
587
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
588
+ any Contribution intentionally submitted for inclusion in the Work
589
+ by You to the Licensor shall be under the terms and conditions of
590
+ this License, without any additional terms or conditions.
591
+ Notwithstanding the above, nothing herein shall supersede or modify
592
+ the terms of any separate license agreement you may have executed
593
+ with Licensor regarding such Contributions.
594
+
595
+ 6. Trademarks. This License does not grant permission to use the trade
596
+ names, trademarks, service marks, or product names of the Licensor,
597
+ except as required for reasonable and customary use in describing the
598
+ origin of the Work and reproducing the content of the NOTICE file.
599
+
600
+ 7. Disclaimer of Warranty. Unless required by applicable law or
601
+ agreed to in writing, Licensor provides the Work (and each
602
+ Contributor provides its Contributions) on an "AS IS" BASIS,
603
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
604
+ implied, including, without limitation, any warranties or conditions
605
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
606
+ PARTICULAR PURPOSE. You are solely responsible for determining the
607
+ appropriateness of using or redistributing the Work and assume any
608
+ risks associated with Your exercise of permissions under this License.
609
+
610
+ 8. Limitation of Liability. In no event and under no legal theory,
611
+ whether in tort (including negligence), contract, or otherwise,
612
+ unless required by applicable law (such as deliberate and grossly
613
+ negligent acts) or agreed to in writing, shall any Contributor be
614
+ liable to You for damages, including any direct, indirect, special,
615
+ incidental, or consequential damages of any character arising as a
616
+ result of this License or out of the use or inability to use the
617
+ Work (including but not limited to damages for loss of goodwill,
618
+ work stoppage, computer failure or malfunction, or any and all
619
+ other commercial damages or losses), even if such Contributor
620
+ has been advised of the possibility of such damages.
621
+
622
+ 9. Accepting Warranty or Additional Liability. While redistributing
623
+ the Work or Derivative Works thereof, You may choose to offer,
624
+ and charge a fee for, acceptance of support, warranty, indemnity,
625
+ or other liability obligations and/or rights consistent with this
626
+ License. However, in accepting such obligations, You may act only
627
+ on Your own behalf and on Your sole responsibility, not on behalf
628
+ of any other Contributor, and only if You agree to indemnify,
629
+ defend, and hold each Contributor harmless for any liability
630
+ incurred by, or claims asserted against, such Contributor by reason
631
+ of your accepting any such warranty or additional liability.
632
+
633
+ END OF TERMS AND CONDITIONS
634
+
635
+ APPENDIX: How to apply the Apache License to your work.
636
+
637
+ To apply the Apache License to your work, attach the following
638
+ boilerplate notice, with the fields enclosed by brackets "{}"
639
+ replaced with your own identifying information. (Don't include
640
+ the brackets!) The text should be enclosed in the appropriate
641
+ comment syntax for the file format. We also recommend that a
642
+ file or class name and description of purpose be included on the
643
+ same "printed page" as the copyright notice for easier
644
+ identification within third-party archives.
645
+
646
+ Copyright {yyyy} {name of copyright owner}
647
+
648
+ Licensed under the Apache License, Version 2.0 (the "License");
649
+ you may not use this file except in compliance with the License.
650
+ You may obtain a copy of the License at
651
+
652
+ http://www.apache.org/licenses/LICENSE-2.0
653
+
654
+ Unless required by applicable law or agreed to in writing, software
655
+ distributed under the License is distributed on an "AS IS" BASIS,
656
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
657
+ See the License for the specific language governing permissions and
658
+ limitations under the License.
659
+ ```
package/lib/agent.js CHANGED
@@ -18,12 +18,12 @@ const NAMES = require('./metrics/names')
18
18
  const QueryTraceAggregator = require('./db/query-trace-aggregator')
19
19
  const sampler = require('./sampler')
20
20
  const TransactionTraceAggregator = require('./transaction/trace/aggregator')
21
- const SpanEventAggregator = require('./spans/span-event-aggregator')
22
21
  const TransactionEventAggregator = require('./transaction/transaction-event-aggregator')
23
22
  const Tracer = require('./transaction/tracer')
24
23
  const TxSegmentNormalizer = require('./metrics/normalizer/tx_segment')
25
24
  const uninstrumented = require('./uninstrumented')
26
25
  const util = require('util')
26
+ const createSpanEventAggregator = require('./spans/create-span-event-aggregator')
27
27
 
28
28
  // Map of valid states to whether or not data collection is valid
29
29
  const STATES = {
@@ -84,13 +84,7 @@ function Agent(config) {
84
84
  this._beforeMetricDataSend.bind(this)
85
85
  )
86
86
 
87
- // Open tracing.
88
- this.spanEventAggregator = new SpanEventAggregator({
89
- periodMs: config.event_harvest_config.report_period_ms,
90
- limit: config.event_harvest_config.harvest_limits.span_event_data
91
- },
92
- this.collector,
93
- this.metrics)
87
+ this.spanEventAggregator = createSpanEventAggregator(config, this.collector, this.metrics)
94
88
 
95
89
  this.transactionNameNormalizer = new MetricNormalizer(this.config, 'transaction name')
96
90
  // Segment term based tx renaming for MGI mitigation.
@@ -249,6 +243,10 @@ Agent.prototype.start = function start(callback) {
249
243
  agent.startAggregators()
250
244
  callback(null, config)
251
245
  } else {
246
+ // For data collection that streams immediately, dont delay capture/sending until
247
+ // the harvest of everything else has completed.
248
+ agent.startStreaming()
249
+
252
250
  // Harvest immediately for quicker data display, but after at least 1
253
251
  // second or the collector will throw away the data.
254
252
  //
@@ -409,6 +407,16 @@ Agent.prototype.stopAggregators = function stopAggregators() {
409
407
  this.customEventAggregator.stop()
410
408
  }
411
409
 
410
+ Agent.prototype.startStreaming = function startStreaming() {
411
+ if (
412
+ this.spanEventAggregator.isStream &&
413
+ this.config.distributed_tracing.enabled &&
414
+ this.config.span_events.enabled
415
+ ) {
416
+ this.spanEventAggregator.start()
417
+ }
418
+ }
419
+
412
420
  Agent.prototype.startAggregators = function startAggregators() {
413
421
  this.metrics.start()
414
422
  this.errors.start()
@@ -798,6 +806,12 @@ Agent.prototype.setLambdaArn = function setLambdaArn(arn) {
798
806
  }
799
807
  }
800
808
 
809
+ Agent.prototype.setLambdaFunctionVersion = function setLambdaFunctionVersion(function_version) {
810
+ if (this.collector instanceof ServerlessCollector) {
811
+ this.collector.setLambdaFunctionVersion(function_version)
812
+ }
813
+ }
814
+
801
815
  /**
802
816
  * Get the current transaction (if there is one) from the tracer.
803
817
  *
@@ -24,6 +24,7 @@ class ServerlessCollector {
24
24
  this.enabled = true
25
25
  this.metadata = {
26
26
  arn: null,
27
+ function_version: null,
27
28
  execution_environment: process.env.AWS_EXECUTION_ENV,
28
29
  protocol_version: 16,
29
30
  agent_version: agent.version
@@ -38,6 +39,13 @@ class ServerlessCollector {
38
39
  this.metadata.arn = arn
39
40
  }
40
41
 
42
+ /**
43
+ * Sets the function_version to be sent up in the metadata.
44
+ */
45
+ setLambdaFunctionVersion(function_version) {
46
+ this.metadata.function_version = function_version
47
+ }
48
+
41
49
  /**
42
50
  * Checks if the collector is currently collecting.
43
51
  *
@@ -456,6 +456,8 @@ exports.config = () => ({
456
456
  * or 'obfuscated' and other criteria (slow_sql.enabled etc) are met
457
457
  * for a query. The raw or obfuscated sql will be included in the
458
458
  * transaction trace and a slow query sample will be collected.
459
+ *
460
+ * @env NEW_RELIC_RECORD_SQL
459
461
  */
460
462
  record_sql: 'off',
461
463
 
@@ -882,6 +884,26 @@ exports.config = () => ({
882
884
  segment_parameters: {enabled: true}
883
885
  },
884
886
 
887
+ /**
888
+ * Controls the use of infinite tracing.
889
+ */
890
+ infinite_tracing: {
891
+ trace_observer: {
892
+ /**
893
+ * The URI HOST of the observer. Setting this enables infinite tracing.
894
+ *
895
+ * @env NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_HOST
896
+ */
897
+ host: '',
898
+ /**
899
+ * The URI PORT of the observer.
900
+ *
901
+ * @env NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_PORT
902
+ */
903
+ port: '443'
904
+ }
905
+ },
906
+
885
907
  /**
886
908
  * Specifies whether the agent will be used to monitor serverless functions.
887
909
  * For example: AWS Lambda
@@ -898,5 +920,5 @@ exports.config = () => ({
898
920
  * loop data.
899
921
  */
900
922
  native_metrics: {enabled: true}
901
- },
923
+ }
902
924
  })
package/lib/config/env.js CHANGED
@@ -152,7 +152,13 @@ const ENV_MAPPING = {
152
152
  },
153
153
  trusted_account_key: 'NEW_RELIC_TRUSTED_ACCOUNT_KEY',
154
154
  primary_application_id: 'NEW_RELIC_PRIMARY_APPLICATION_ID',
155
- account_id: 'NEW_RELIC_ACCOUNT_ID'
155
+ account_id: 'NEW_RELIC_ACCOUNT_ID',
156
+ infinite_tracing: {
157
+ trace_observer: {
158
+ host: 'NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_HOST',
159
+ port: 'NEW_RELIC_INFINITE_TRACING_TRACE_OBSERVER_PORT'
160
+ }
161
+ }
156
162
  }
157
163
 
158
164
  // List of environment values which are comma-delimited lists.
@@ -1201,6 +1201,12 @@ Config.prototype._enforceServerless = function _enforceServerless(inputConfig) {
1201
1201
  logger.info('Cross application tracing is explicitly disabled in serverless_mode.')
1202
1202
  }
1203
1203
 
1204
+ if (this.infinite_tracing.trace_observer.host) {
1205
+ this.infinite_tracing.trace_observer.host = ''
1206
+ this.infinite_tracing.trace_observer.port = ''
1207
+ logger.info('Infinite tracing is explicitly disabled in serverless_mode.')
1208
+ }
1209
+
1204
1210
  if (!this._loggingManuallySet(inputConfig)) {
1205
1211
  this.logging.enabled = false
1206
1212
 
@@ -1253,6 +1259,7 @@ Config.prototype._enforceServerless = function _enforceServerless(inputConfig) {
1253
1259
 
1254
1260
  return
1255
1261
  }
1262
+
1256
1263
  const DT_KEYS = ['account_id', 'primary_application_id', 'trusted_account_key']
1257
1264
  // Don't allow DT config settings to be set if serverless_mode is disabled
1258
1265
  DT_KEYS.forEach((key) => {
@@ -0,0 +1,9 @@
1
+ 'use strict'
2
+ module.exports = {
3
+ disconnected:0,
4
+ connecting:1,
5
+ connected:2,
6
+ 0:'disconnected',
7
+ 1:'connecting',
8
+ 2:'connected'
9
+ }