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

@dynatrace/agent-api

Package Overview
Dependencies
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dynatrace/agent-api - npm Package Compare versions

Comparing version 1.1.3 to 1.2.0

25

lib/index.js
"use strict";
const debug = require("debug")("dynatrace-agent-api");
const path = require("path");
var debug = require("debug")("dynatrace-agent-api");
var path = require("path");

@@ -16,13 +16,20 @@ // Dummy AgentApi, which acts as a nop

function findAgent() {
return Object.keys(require("module")._cache).find((m) => {
if(m.includes("nodejsagent.js") && (m.includes("dynatrace") || m.includes("ruxit"))) return m;
}) || null;
var cache = Object.keys(require("module")._cache);
var i = 0;
while (i < cache.length) {
var m = cache[i];
if ((m.indexOf("nodejsagent.js") !== -1) && ((m.indexOf("dynatrace") !== -1) || (m.indexOf("ruxit") !== -1))) {
return m;
}
i++;
}
return null;
}
function getLegacyAgentApi() {
const agentPath = findAgent();
var agentPath = findAgent();
if(agentPath) {
if (agentPath) {
try {
const directAsyncWrap = require(path.dirname(agentPath) + "/lib/core").directAsyncWrap;
var directAsyncWrap = require(path.dirname(agentPath) + "/lib/core").directAsyncWrap;
if (typeof(directAsyncWrap) !== "function") {

@@ -40,3 +47,3 @@ debug("Failed to get core.directAsyncWrap() from agent");

passContext: function passContext(f) {
const fname = f.prototype ? f.prototype.name : "anonymous function";
var fname = f.prototype ? f.prototype.name : "anonymous function";
return directAsyncWrap(f, {}, "callback for " + fname);

@@ -43,0 +50,0 @@ }

{
"name": "@dynatrace/agent-api",
"version": "1.1.3",
"version": "1.2.0",
"description": "Node.js bindings for Dynatrace OneAgent",
"engines":{"node": ">= 4.0.0"},
"engines":{"node": ">= 0.10.0"},
"main": "./lib/index.js",

@@ -7,0 +7,0 @@ "scripts": {

@@ -31,6 +31,6 @@ # Node.js API for Dynatrace OneAgent

```js
const dta = require('dynatrace-agent-api')();
const dta = require('@dynatrace/agent-api')();
function couchMiddleware(req, res, next) {
couch.get("testdb", "123a3354452ddfa2973ec0a477000f7a").then(dta.passContext(couchCallback), err => {
couch.get('testdb', '123a3354452ddfa2973ec0a477000f7a').then(dta.passContext(couchCallback), err => {
if(err) throw err;

@@ -37,0 +37,0 @@ }).then(dta.passContext(next));

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