How to use the @instana/core.tracing function in @instana/core

To help you get started, we’ve selected a few @instana/core 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 instana / nodejs-sensor / test / aws_lambda / common / tests_common.js View on Github external
/* eslint-env mocha */

'use strict';

const expect = require('chai').expect;
const path = require('path');
const constants = require('@instana/core').tracing.constants;

const config = require('../../config');
const delay = require('../../util/delay');
const expectOneMatching = require('../../util/expect_matching');
const retry = require('../../util/retry');

const functionName = 'functionName';
const unqualifiedArn = `arn:aws:lambda:us-east-2:410797082306:function:${functionName}`;
const version = '$LATEST';
const qualifiedArn = `${unqualifiedArn}:${version}`;

function prelude(opts) {
  this.timeout(config.getTestTimeout());
  this.slow(config.getTestTimeout() / 4);

  if (opts.startBackend == null) {
github instana / nodejs-sensor / packages / collector / src / announceCycle / agentready.js View on Github external
'use strict';

var clone = require('@instana/core').util.clone;
var compression = require('@instana/core').util.compression;
var tracing = require('@instana/core').tracing;

var metrics = require('../metrics');
var uncaught = require('../uncaught');

var logger;
logger = require('../logger').getLogger('announceCycle/agentready', function(newLogger) {
  logger = newLogger;
});
var requestHandler = require('../agent/requestHandler');
var agentConnection = require('../agentConnection');

var ctx;

var resendFullDataEveryXTransmissions = 300; /* about every 5 minutes */

var transmissionsSinceLastFullDataEmit = 0;
github instana / nodejs-sensor / packages / collector / src / uncaught / index.js View on Github external
'use strict';

var serializeError = require('serialize-error');

var logger;
logger = require('../logger').getLogger('util/uncaughtExceptionHandler', function(newLogger) {
  logger = newLogger;
});

var instanaNodeJsCore = require('@instana/core');
var tracing = instanaNodeJsCore.tracing;
var spanBuffer = tracing.spanBuffer;
var stackTraceUtil = instanaNodeJsCore.util.stackTrace;

var downstreamConnection = null;
var processIdentityProvider = null;
var uncaughtExceptionEventName = 'uncaughtException';
var unhandledRejectionEventName = 'unhandledRejection';
var unhandledRejectionDeprecationWarningHasBeenEmitted = false;
var stackTraceLength = 10;
var config;

// see
// https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode /
// https://github.com/nodejs/node/pull/26599
var unhandledRejectionsMode = 'warn/default';
for (var i = 0; i < process.execArgv.length; i++) {
github instana / nodejs-sensor / packages / collector / src / uncaught / index.js View on Github external
'use strict';

var serializeError = require('serialize-error');

var logger;
logger = require('../logger').getLogger('util/uncaughtExceptionHandler', function(newLogger) {
  logger = newLogger;
});

var instanaNodeJsCore = require('@instana/core');
var tracing = instanaNodeJsCore.tracing;
var spanBuffer = tracing.spanBuffer;
var stackTraceUtil = instanaNodeJsCore.util.stackTrace;

var downstreamConnection = null;
var processIdentityProvider = null;
var uncaughtExceptionEventName = 'uncaughtException';
var unhandledRejectionEventName = 'unhandledRejection';
var unhandledRejectionDeprecationWarningHasBeenEmitted = false;
var stackTraceLength = 10;
var config;

// see
// https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode /
// https://github.com/nodejs/node/pull/26599
var unhandledRejectionsMode = 'warn/default';
for (var i = 0; i < process.execArgv.length; i++) {
github instana / nodejs-sensor / packages / collector / src / index.js View on Github external
if (!config.logger) {
    config.logger = logger;
  }

  agentOpts.init(config);
  instanaNodeJsCore.init(config, agentConnection, pidStore);
  uncaught.init(config, agentConnection, pidStore);
  require('./metrics').init(config);
  require('./actions/profiling/cpu').init(config);

  logger.info('@instana/collector module version:', require(path.join(__dirname, '..', 'package.json')).version);
  require('./announceCycle').start();
  return exports;
};

exports.opentracing = instanaNodeJsCore.tracing.opentracing;

exports.currentSpan = function getHandleForCurrentSpan() {
  return instanaNodeJsCore.tracing.getHandleForCurrentSpan();
};

exports.sdk = instanaNodeJsCore.tracing.sdk;

exports.setLogger = function(logger) {
  config.logger = logger;
  log.init(config, true);
};

if (
  process.env.INSTANA_EARLY_INSTRUMENTATION != null &&
  process.env.INSTANA_EARLY_INSTRUMENTATION.toLowerCase() === 'true'
) {
github instana / nodejs-sensor / packages / collector / src / index.js View on Github external
uncaught.init(config, agentConnection, pidStore);
  require('./metrics').init(config);
  require('./actions/profiling/cpu').init(config);

  logger.info('@instana/collector module version:', require(path.join(__dirname, '..', 'package.json')).version);
  require('./announceCycle').start();
  return exports;
};

exports.opentracing = instanaNodeJsCore.tracing.opentracing;

exports.currentSpan = function getHandleForCurrentSpan() {
  return instanaNodeJsCore.tracing.getHandleForCurrentSpan();
};

exports.sdk = instanaNodeJsCore.tracing.sdk;

exports.setLogger = function(logger) {
  config.logger = logger;
  log.init(config, true);
};

if (
  process.env.INSTANA_EARLY_INSTRUMENTATION != null &&
  process.env.INSTANA_EARLY_INSTRUMENTATION.toLowerCase() === 'true'
) {
  instanaNodeJsCore.preInit();
}
github instana / nodejs-sensor / packages / aws-lambda / src / triggers.js View on Github external
'use strict';

const tracingConstants = require('@instana/core').tracing.constants;
const zlib = require('zlib');

const maxCloudwatchEventsResources = 3;
const maxCloudwatchEventsLength = 200;
const maxCloudwatchLogsEvents = 3;
const maxCloudwatchLogsEventLength = 200;
const maxS3Records = 3;
const maxS3ObjectKeyLength = 200;
const maxSQSRecords = 3;

let extraHttpHeadersToCapture = null;

exports.enrichSpanWithTriggerData = function enrichSpanWithTriggerData(event, span) {
  if (isApiGatewayProxyTrigger(event)) {
    span.data.lambda.trigger = 'aws:api.gateway';
    extractHttpFromApiGatewwayProxyEvent(event, span);
github instana / nodejs-sensor / packages / collector / src / announceCycle / unannounced.js View on Github external
'use strict';

var secrets = require('@instana/core').secrets;
var tracing = require('@instana/core').tracing;

var logger;
logger = require('../logger').getLogger('announceCycle/unannounced', function(newLogger) {
  logger = newLogger;
});
var agentConnection = require('../agentConnection');
var agentOpts = require('../agent/opts');
var pidStore = require('../pidStore');

var retryDelay = 60 * 1000;

module.exports = {
  enter: function(ctx) {
    tryToAnnounce(ctx);
  },