Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 1.4 KB

profiling.md

File metadata and controls

50 lines (35 loc) · 1.4 KB

Profiling

🚧  Status: Experimental - profiling is currently considered in alpha status and not suitable for production use.

Continuous profiling of applications.

Configuration

When loading the instrumentation via CLI:

export SPLUNK_PROFILER_ENABLED=true
export SPLUNK_PROFILER_MEMORY_ENABLED=true
node -r @splunk/otel/instrument app.js

Or when using advanced configuration:

const { startProfiling } = require('@splunk/otel');

// NOTE: profiling needs to be started before tracing. This will be fixed in future versions.
startProfiling({
  serviceName: 'my-service',
  // Optional, disabled by default
  memoryProfilingEnabled: true,
});

startTracing({ ... });

Memory profiling

Memory profiling is disabled by default. You can enable it via the memoryProfilingEnabled flag.

Internally the profiler uses V8's sampling heap profiler, where it periodically queries for new allocation samples from the allocation profile.

You can tune V8 heap profiler's parameters using the memoryProfilingOptions configuration field:

startProfiling({
  serviceName: 'my-service',
  memoryProfilingEnabled: true,
  memoryProfilingOptions: {
    maxStackDepth: 128, // default: 256
    sampleIntervalBytes: 1024 * 64, // default: 1024 * 128
  },
});