Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@supertenant/collector / src / immediate.js
Size: Mime:
// (c) Copyright 2023 Supertenant Ltd. - all rights reserved.
// See LICENSE file in project root for license terms.

'use strict';

const { isNodeJsTooOld, minimumNodeJsVersion } = require('@supertenant/core/src/util/nodeJsVersionCheck');

if (isNodeJsTooOld()) {
  // eslint-disable-next-line no-console
  console.error(
    `[supertenant-supermeter] ERROR: @supertenant/collector requires at least Node.js ${minimumNodeJsVersion} but this process is ` +
    `running Node.js ${process.version}.`
  );
} else {
  const { util: coreUtil } = require('@supertenant/core');

  // This file can be used with NODE_OPTIONS or `node --require` to instrument a Node.js app with Instana without
  // modifying the source code. See
  // eslint-disable-next-line max-len
  // https://www.ibm.com/docs/de/obi/current?topic=nodejs-collector-installation#installation-without-modifying-the-source-code

  const isExcludedFromInstrumentation = coreUtil.excludedFromInstrumentation && coreUtil.excludedFromInstrumentation();

  // In case this is a child process of an instrumented parent process we might receive the agent uuid from the parent
  // process to be able to produce and collect spans immediately without waiting for a connection to the agent in this
  // process.
  const parentProcessAgentUuid = process.env.INSTANA_AGENT_UUID;

  if (!isExcludedFromInstrumentation) {
    if (parentProcessAgentUuid) {
      require('./index')({
        tracing: {
          forceTransmissionStartingAt: 1
        }
      });
    } else {
      require('./index')();
    }
  }
}