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
"name-b*"
        );
        Settings settings = Settings.builder()
            .put(APM_ENABLED_SETTING.getKey(), true)
            .putList(APM_TRACING_NAMES_INCLUDE_SETTING.getKey(), includePatterns)
            .build();
        APMTracer apmTracer = buildTracer(settings);
        apmTracer.startTrace(new ThreadContext(settings), "id1", "name-aaa", null);
        apmTracer.startTrace(new ThreadContext(settings), "id2", "name-bbb", null);
        apmTracer.startTrace(new ThreadContext(settings), "id3", "name-ccc", null);
        assertThat(apmTracer.getSpans(), hasKey("id1"));
        assertThat(apmTracer.getSpans(), hasKey("id2"));
        assertThat(apmTracer.getSpans(), not(hasKey("id3")));
    }
    /**
     * Check that when a tracer has a list of include and exclude names configured, and
     * a span matches both, then the exclude filters take precedence.
     */
    public void test_whenTraceStarted_andSpanNameIncludedAndExcluded_thenSpanIsNotStarted() {
        final List<String> includePatterns = List.of("name-a*");
        final List<String> excludePatterns = List.of("name-a*");
        Settings settings = Settings.builder()
            .put(APM_ENABLED_SETTING.getKey(), true)
            .putList(APM_TRACING_NAMES_INCLUDE_SETTING.getKey(), includePatterns)
            .putList(APM_TRACING_NAMES_EXCLUDE_SETTING.getKey(), excludePatterns)
            .build();
        APMTracer apmTracer = buildTracer(settings);
        apmTracer.startTrace(new ThreadContext(settings), "id1", "name-aaa", null);
        assertThat(apmTracer.getSpans(), not(hasKey("id1")));
    }