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/main/java/org/elasticsearch/tracing/apm/APMTracer.java
* exists to make it possible to use scopes in the few situation where it makes sense.
     *
     * @param spanId the ID of a currently-open span for which to open a scope.
     * @return a method to close the scope when you are finished with it.
     */
    @Override
    public Releasable withScope(String spanId) {
        final Context context = spans.get(spanId);
        if (context != null) {
            var scope = context.makeCurrent();
            return scope::close;
        }
        return () -> {};
    }
    private void setSpanAttributes(@Nullable Map<String, Object> spanAttributes, SpanBuilder spanBuilder) {
        if (spanAttributes != null) {
            for (Map.Entry<String, Object> entry : spanAttributes.entrySet()) {
                final String key = entry.getKey();
                final Object value = entry.getValue();
                if (value instanceof String) {
                    spanBuilder.setAttribute(key, (String) value);
                } else if (value instanceof Long) {
                    spanBuilder.setAttribute(key, (Long) value);
                } else if (value instanceof Integer) {
                    spanBuilder.setAttribute(key, (Integer) value);
                } else if (value instanceof Double) {
                    spanBuilder.setAttribute(key, (Double) value);
                } else if (value instanceof Boolean) {
                    spanBuilder.setAttribute(key, (Boolean) value);
                } else {