Instana

Instana

The community for performance and observability professionals to learn, to share ideas, and to connect with others.

 View Only

Smart Tracing in Node.js: How to Focus on What Matters with Instana

By Arya Mohanan posted 3 days ago

  

Tracing plays a crucial role in application monitoring, especially when using comprehensive tools like IBM Instana. However, tracing everything is not always necessary. You may want to disable tracing when debugging, reducing noise, or testing without extra overhead. Disabling tracing fully or selectively in your Node.js application helps you collect only the data you need, when you need it. The IBM Instana Node.js tracer provides simple configuration options to disable tracing.

This blog explains how to disable tracing by using the Instana Node.js Collector.

When should you disable tracing?

There are a few common scenarios:

  • You are debugging an issue and don’t want extra tracing overhead.

  • You want to reduce noise by excluding certain libraries (like Redis or GraphQL).

  • You need to stay compliant in certain environments.

  • You are using an OpenTelemetry collector that also captures logs, and you want to avoid double-logging or disable log tracing.

Instana Node.js Tracer provides the flexibility to disable tracing fully or partially through various configurations, depending on your requirements.

Option 1: Disable tracing completely

Want to stop all tracing activity in your Node.js application? That’s easy. When tracing is disabled, Instana does not collect or report any tracing spans.

Ideal for:

  • Local development

  • Debugging

  • Testing

Using an environment variable:

A fast and deployment-friendly method. Set the INSTANA_TRACING_DISABLE environment variable to true.

Example:

INSTANA_TRACING_DISABLE=true

When this variable is set, Instana will no longer collect or report any tracing spans.

Using in-code configuration:

Use this approach when you need more granular control over ignoring endpoints directly within your application logic. You can pass the configuration options directly when initializing the Instana Node.js collector in your application.

Example:

require('@instana/collector')({
  tracing: {
    disable: true
  }
});

Option 2: Disabling specific instrumentations

You can disable tracing for certain packages such as Redis or GraphQL. You can disable those selectively without affecting other tracing data.

Ideal for:

  • Cleaning up noisy trace data

  • Keeping performance focused on what matters

To get the exact list of packages that can be disabled, refer to the supported libraries in official documentation and use the corresponding values from the Instrumentation Identifier column.

Using an environment variable:
A fast and deployment-friendly method. Set the INSTANA_TRACING_DISABLE_INSTRUMENTATIONS environment variable.

Example:

INSTANA_TRACING_DISABLE_INSTRUMENTATIONS=redis,graphql

This configuration disables tracing for Redis and GraphQL only. Other instrumentations continue to work as expected.

Using in-code configuration:
Use this approach when you need more granular control over ignoring endpoints directly within your application logic. You can pass the configuration options directly when initialize the Instana Node.js collector in your application.

Example:

require('@instana/collector')({
  tracing: {
    disable: {
      instrumentations: ['redis', 'graphql']
    }
  }
});

Option 3: Disabling tracing by group

You can also disable tracing for entire groups of libraries, such as logging, database and messaging. Instana lets you disable entire categories (groups) with just one line of configuration.

Ideal for:

  • Simplifying configurations

  • Turning off broad categories with minimal setup

Available groups:

Using an environment variable:
A fast and deployment-friendly method. Set the INSTANA_TRACING_DISABLE_GROUPS environment variable.

Example:

INSTANA_TRACING_DISABLE_GROUPS=logging,database

Instana disables tracing for all supported logging and database libraries.

Using in-code configuration:

Use this approach when you need more granular control over ignoring endpoints directly within your application logic. You can pass the configuration options directly when initializing the Instana Node.js collector in your application.

Example:

require('@instana/collector')({
  tracing: {
    disable: {
      groups: ['logging', 'database']
    }
  }
});

Want to apply disabling configuration across all services?

If you are running multiple services and want to apply the same configuration globally, you can do it through the Instana agent configuration.yaml file. By using this method, you do not need to update each application individually.

Example configuration (configuration.yaml):

com.instana.tracing:
  disable:
    redis: true         # Disable Redis instrumentation
    console: false      # Keep console enabled (overrides group setting)
    logging: true       # Disable all logging-related instrumentations

How the configuration works

  • Setting a value to true disables tracing for that specific package or group.

  • Setting a value to false explicitly enables the package, even if its group is disabled.

Result:

  • Redis spans are disabled.

  • All logging libraries such as Winston and Bunyan are turned off, except for console.

Note: These are global settings. To confirm that your tracer supports this configuration, see the official Instana documentaion.

Trace view before and after

Sometimes, the best way to understand the impact of a configuration is to see it in action. Compare the following two trace views from the Instana dashboard showing the difference before and after disabling certain tracing configurations.

Before disabling tracing

In this view, tracing is fully enabled. Complete view of how spans from Redis and logging libraries are being collected:

After disabling Redis and logging traces:

In this view, selective disabling is applied by using either environment variables or agent configuration. Redis and logging traces are now excluded:

Conclusion

IBM Instana provides fine-grained control over tracing behavior in your Node.js applications. You can disable all tracing during development or silence specific libraries in production. You have multiple flexible options to apply these changes by using environment variables, code-level settings, or global agent configuration.

The next time when your traces feel too busy or you just want to turn things off temporarily, you now have clear options to manage and fine-tune tracing behavior.

Further reading


#Tracing

0 comments
8 views

Permalink