APM view not supporting Namespace rerouting and RBAC based on datastreams

Kibana version: 8.11.2

Elasticsearch version: 8.11.2

APM Server version: 8.11.2

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.

I have used the reroute processor to change the namespace based on a field in the document for the datastreams for APM. I added the reroute processor to a pipeline and used a pipeline processor on every @custom pipeline hook in traces-apm*, logs-apm*, and metrics-apm*

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):

Steps to reproduce:

  1. Generate a bunch of APM data with the above described pipelines
  2. Log in with the Viewer role
  3. See that the APM trace data is not there in the APM Service view
  4. Log in with a user that has read permissions on just *-*-namespacename
  5. See that the APM trace data is now viewable in the APM Service view