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

applicationinsights-native-metrics

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

applicationinsights-native-metrics - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

24

lib/main.ts
const events = require("events");
const os = require("os");
const natives = require("../build/Release/native_metrics.node");

@@ -6,2 +7,3 @@

| "Scavenge"
| "MinorMarkCompact"
| "MarkSweepCompact"

@@ -23,2 +25,13 @@ | "IncrementalMarking"

// Node 18 and newer
// https://v8docs.nodesource.com/node-18.2/db/d88/v8-callbacks_8h_source.html
private static GC_TYPES_NEW: { [key: number]: gcTypes } = {
1: "Scavenge",
2: "MinorMarkCompact",
4: "MarkSweepCompact",
8: "IncrementalMarking",
16: "ProcessWeakCallbacks",
31: "All"
};
private static DEFAULT_INTERVAL = 15000;

@@ -31,2 +44,3 @@

private _resourceProfiler: any;
private _nodeMajVer: number;

@@ -36,2 +50,4 @@ constructor(options: any) {

this._nodeMajVer = parseInt(process.versions.node.split('.')[0], 10);
options = options || { timeout: NativeMetricEmitter.DEFAULT_INTERVAL };

@@ -65,3 +81,9 @@ this.enabled = false;

if (gcMetrics.hasOwnProperty(typeId) && gcMetrics[typeId].count > 0) {
const typeName = NativeMetricEmitter.GC_TYPES[typeId];
let typeName = "";
if (this._nodeMajVer >= 18) {
typeName = NativeMetricEmitter.GC_TYPES_NEW[typeId];
}
else {
typeName = NativeMetricEmitter.GC_TYPES[typeId];
}
results[typeName] = {

@@ -68,0 +90,0 @@ typeId: parseInt(typeId, 10),

declare const events: any;
declare class NativeMetricEmitter extends events.EventEmitter {
private static GC_TYPES;
private static GC_TYPES_NEW;
private static DEFAULT_INTERVAL;

@@ -10,2 +11,3 @@ private enabled;

private _resourceProfiler;
private _nodeMajVer;
constructor(options: any);

@@ -12,0 +14,0 @@ enable(enable?: boolean, pollInterval?: number): void;

@@ -16,2 +16,3 @@ "use strict";

var events = require("events");
var os = require("os");
var natives = require("../build/Release/native_metrics.node");

@@ -22,2 +23,3 @@ var NativeMetricEmitter = /** @class */ (function (_super) {

var _this = _super.call(this, options) || this;
_this._nodeMajVer = parseInt(process.versions.node.split('.')[0], 10);
options = options || { timeout: NativeMetricEmitter.DEFAULT_INTERVAL };

@@ -49,3 +51,9 @@ _this.enabled = false;

if (gcMetrics.hasOwnProperty(typeId) && gcMetrics[typeId].count > 0) {
var typeName = NativeMetricEmitter.GC_TYPES[typeId];
var typeName = "";
if (this._nodeMajVer >= 18) {
typeName = NativeMetricEmitter.GC_TYPES_NEW[typeId];
}
else {
typeName = NativeMetricEmitter.GC_TYPES[typeId];
}
results[typeName] = {

@@ -99,2 +107,12 @@ typeId: parseInt(typeId, 10),

};
// Node 18 and newer
// https://v8docs.nodesource.com/node-18.2/db/d88/v8-callbacks_8h_source.html
NativeMetricEmitter.GC_TYPES_NEW = {
1: "Scavenge",
2: "MinorMarkCompact",
4: "MarkSweepCompact",
8: "IncrementalMarking",
16: "ProcessWeakCallbacks",
31: "All"
};
NativeMetricEmitter.DEFAULT_INTERVAL = 15000;

@@ -101,0 +119,0 @@ return NativeMetricEmitter;

2

package.json
{
"name": "applicationinsights-native-metrics",
"description": "Native APM agent for the Application Insights Node.js SDK",
"version": "0.0.10",
"version": "0.0.11",
"engines": {

@@ -6,0 +6,0 @@ "node": ">=6.0.0",

Sorry, the diff of this file is not supported yet

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