This commit is contained in:
Olivier 2026-10-16 19:06:30 +02:00 committed by GitHub
commit 87a0d06411
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 10 deletions

View File

@ -156,8 +156,8 @@ describe('ExpressionEngineConfig', () => {
expect(Container.get(ExpressionEngineConfig).observabilityEnabled).toBe(true);
});
test('tracesEnabled defaults to true', () => {
expect(Container.get(ExpressionEngineConfig).tracesEnabled).toBe(true);
test('tracesEnabled defaults to false', () => {
expect(Container.get(ExpressionEngineConfig).tracesEnabled).toBe(false);
});
test('slowEvaluationThresholdMs defaults to 50', () => {

View File

@ -65,12 +65,13 @@ export class ExpressionEngineConfig {
observabilityEnabled: boolean = true;
/**
* Whether to emit OpenTelemetry spans for expression evaluation.
* Slow evaluations (>slowEvaluationThresholdMs) and errors always emit a span.
* Healthy-path evaluations are sampled at tracesSampleRate.
* Whether n8n sends OpenTelemetry spans for expression evaluations when `N8N_OTEL_ENABLED`
* is true. n8n creates a span for each evaluation that fails or takes longer than
* `N8N_EXPRESSION_ENGINE_SLOW_EVAL_THRESHOLD_MS`, and samples the rest at
* `N8N_EXPRESSION_ENGINE_TRACES_SAMPLE_RATE`.
*/
@Env('N8N_EXPRESSION_ENGINE_TRACES_ENABLED')
tracesEnabled: boolean = true;
tracesEnabled: boolean = false;
/** Threshold in ms above which an evaluation is considered "slow" and gets a span. */
@Env('N8N_EXPRESSION_ENGINE_SLOW_EVAL_THRESHOLD_MS', z.number({ coerce: true }).positive())

View File

@ -699,7 +699,7 @@ describe('GlobalConfig', () => {
bridgeTimeout: 5000,
bridgeMemoryLimit: 128,
observabilityEnabled: true,
tracesEnabled: true,
tracesEnabled: false,
slowEvaluationThresholdMs: 50,
tracesSampleRate: 0.0,
allowWebhookIsolateSkip: true,

View File

@ -23,9 +23,9 @@ const startSpanMock = vi.fn().mockReturnValue({
function buildConfig(overrides: Partial<ExpressionEngineConfig> = {}): ExpressionEngineConfig {
const config = new ExpressionEngineConfig();
// The provider is a no-op unless engine === 'vm'. Default tests to the active
// engine so shared assertions exercise the real code path.
return Object.assign(config, { engine: 'vm' as const, ...overrides });
// The provider is a no-op unless engine is 'vm', and spans are off by default.
// Turn both on so shared assertions exercise the real code path.
return Object.assign(config, { engine: 'vm' as const, tracesEnabled: true, ...overrides });
}
function buildLogger(): Logger {