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
public void test_onTraceStopped_stopsTrace() {
        Settings settings = Settings.builder().put(APM_ENABLED_SETTING.getKey(), true).build();
        APMTracer apmTracer = buildTracer(settings);
        apmTracer.startTrace(new ThreadContext(settings), "id1", "name1", null);
        apmTracer.stopTrace("id1");
        assertThat(apmTracer.getSpans(), anEmptyMap());
    }
    /**
     * Check that when a trace is started, then the thread context is updated with tracing information.
     * <p>
     * We expect the APM agent to inject the {@link Task#TRACE_PARENT_HTTP_HEADER} and {@link Task#TRACE_STATE}
     * headers into the context, and it does, but this doesn't happen in the unit tests. We can
     * check that the local context object is added, however.
     */
    public void test_whenTraceStarted_threadContextIsPopulated() {
        Settings settings = Settings.builder().put(APM_ENABLED_SETTING.getKey(), true).build();
        APMTracer apmTracer = buildTracer(settings);
        ThreadContext threadContext = new ThreadContext(settings);
        apmTracer.startTrace(threadContext, "id1", "name1", null);
        assertThat(threadContext.getTransient(Task.APM_TRACE_CONTEXT), notNullValue());
    }
    /**
     * Check that when a tracer has a list of include names configured, then those
     * names are used to filter spans.
     */
    public void test_whenTraceStarted_andSpanNameIncluded_thenSpanIsStarted() {
        final List<String> includePatterns = List.of(
            
            "name-aaa",