Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
"use strict";
// tslint:disable:no-console
// ----------------------------------------------------------------------------
const Sdk = require("@dynatrace/oneagent-sdk");
const Api = Sdk.createInstance();
// ----------------------------------------------------------------------------
if (Api.getCurrentState() !== Sdk.SDKState.ACTIVE) {
console.error("IncomingRemoteCallSample: SDK is not active!");
}
// install logging callbacks
Api.setLoggingCallbacks({
warning: (msg) => console.error("IncomingRemoteCallSample SDK warning: " + msg),
error: (msg) => console.error("IncomingRemoteCallSample SDK error: " + msg)
});
// ----------------------------------------------------------------------------
// Function actually processing the message
async function processMessage(message) {
switch (message.method) {
case "toUpper": return message.text.toUpperCase();
case "toLower": return message.text.toLowerCase();
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
"use strict";
// tslint:disable:no-console
// ----------------------------------------------------------------------------
const Sdk = require("@dynatrace/oneagent-sdk");
const Api = Sdk.createInstance();
// ----------------------------------------------------------------------------
if (Api.getCurrentState() !== Sdk.SDKState.ACTIVE) {
console.error("CustomRequestAttributesSample: SDK is not active!");
}
// install logging callbacks
Api.setLoggingCallbacks({
warning: (msg) => console.error("CustomRequestAttributesSample SDK warning: " + msg),
error: (msg) => console.error("CustomRequestAttributesSample SDK error: " + msg)
});
// ----------------------------------------------------------------------------
const http = require("http");
// ----------------------------------------------------------------------------
const server = http.createServer(function onRequest(req, res) {
// set attribute named "fooAttribute" with value "bar"
Api.addCustomRequestAttribute("fooAttribute", "bar");
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
"use strict";
// tslint:disable:no-console
// ----------------------------------------------------------------------------
const Sdk = require("@dynatrace/oneagent-sdk");
const Api = Sdk.createInstance();
// ----------------------------------------------------------------------------
if (Api.getCurrentState() !== Sdk.SDKState.ACTIVE) {
console.error("DatabaseRequestSample: SDK is not active!");
}
// install logging callbacks
Api.setLoggingCallbacks({
warning: (msg) => console.error("DatabaseRequestSample SDK warning: " + msg),
error: (msg) => console.error("DatabaseRequestSample SDK error: " + msg)
});
// ----------------------------------------------------------------------------
const http = require("http");
// ----------------------------------------------------------------------------
// Simple simulation of a database...
class SomeDbConnection {
query(sql, cb) {
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
"use strict";
// tslint:disable:no-console
// ----------------------------------------------------------------------------
const Sdk = require("@dynatrace/oneagent-sdk");
const Api = Sdk.createInstance();
// ----------------------------------------------------------------------------
if (Api.getCurrentState() !== Sdk.SDKState.ACTIVE) {
console.error("OutgoingRemoteCallSample: SDK is not active!");
}
// install logging callbacks
Api.setLoggingCallbacks({
warning: (msg) => console.error("OutgoingRemoteCallSample SDK warning: " + msg),
error: (msg) => console.error("OutgoingRemoteCallSample SDK error: " + msg)
});
// ----------------------------------------------------------------------------
const cp = require("child_process");
let id = 0;
const map = new Map();
// start the remote call server