How to use the @dynatrace/oneagent-sdk.SDKState function in @dynatrace/oneagent-sdk

To help you get started, we’ve selected a few @dynatrace/oneagent-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Dynatrace / OneAgent-SDK-for-NodeJs / samples / RemoteCall / IncomingRemoteCallSample.js View on Github external
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();
github Dynatrace / OneAgent-SDK-for-NodeJs / samples / CustomRequestAttributes / CustomRequestAttributesSample.js View on Github external
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");
github Dynatrace / OneAgent-SDK-for-NodeJs / samples / Database / DatabaseRequestSample.js View on Github external
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) {
github Dynatrace / OneAgent-SDK-for-NodeJs / samples / RemoteCall / OutgoingRemoteCallSample.js View on Github external
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

@dynatrace/oneagent-sdk

Node.js SDK for Dynatrace OneAgent

Apache-2.0
Latest version published 1 year ago

Package Health Score

54 / 100
Full package analysis