How to use the @dynatrace/oneagent-sdk.ChannelType 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 / OutgoingRemoteCallSample.js View on Github external
async function tracedOutgoingRemoteCall(method, data) {
  const tracer = Api.traceOutgoingRemoteCall({
    serviceEndpoint: "ChildProcess",
    serviceMethod: method,  // the name of the remote method called
    serviceName: "StringManipulator",
    channelType: Sdk.ChannelType.NAMED_PIPE
  });

  try {
    // start tracer, get dynatrace tag and trigger sending via doOutgoingRemoteCall()
    return await tracer.start(function triggerTaggedRemoteCall() {
      // getting a tag from tracer needs to be done after start()
      const dtTag = tracer.getDynatraceStringTag();
      // now trigger the actual remote call
      return doOutgoingRemoteCall(method, data, dtTag);
    });
  } catch (e) {
    tracer.error(e);
    throw e;
  } finally {
    tracer.end();
  }

@dynatrace/oneagent-sdk

Node.js SDK for Dynatrace OneAgent

Apache-2.0
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis