Related: #92337. When tracing REST requests with APM, we capture HTTP headers as labels on the trace, but redact sensitive values. However, we can't know ahead of time what are all possible sensitive values. It would be better if it was possible to configure additional patterns to redact.
modules/apm/src/test/java/org/elasticsearch/tracing/apm/APMTracerTests.java
Settings settings = Settings.builder().put(APM_ENABLED_SETTING.getKey(), false).build();
        APMTracer apmTracer = buildTracer(settings);
        apmTracer.startTrace(new ThreadContext(settings), "id1", "name1", null);
        assertThat(apmTracer.getSpans(), anEmptyMap());
    }
    /**
     * Check that the tracer doesn't create spans if a Traceable's span name is filtered out.
     */
    public void test_onTraceStarted_withSpanNameOmitted_doesNotStartTrace() {
        Settings settings = Settings.builder()
            .put(APM_ENABLED_SETTING.getKey(), true)
            .putList(APM_TRACING_NAMES_INCLUDE_SETTING.getKey(), List.of("filtered*"))
            .build();
        APMTracer apmTracer = buildTracer(settings);
        apmTracer.startTrace(new ThreadContext(settings), "id1", "name1", null);
        assertThat(apmTracer.getSpans(), anEmptyMap());
    }
    /**
     * Check that when a trace is started, the tracer starts a span and records it.
     */
    public void test_onTraceStarted_startsTrace() {
        Settings settings = Settings.builder().put(APM_ENABLED_SETTING.getKey(), true).build();
        APMTracer apmTracer = buildTracer(settings);
        apmTracer.startTrace(new ThreadContext(settings), "id1", "name1", null);
        assertThat(apmTracer.getSpans(), aMapWithSize(1));
        assertThat(apmTracer.getSpans(), hasKey("id1"));
    }
    /**
     * Check that when a trace is started, the tracer ends the span and removes the record of it.
     */