Add additionally labels to prometheus metrics based on middleware/ingress

Is there a way to dynamically control what headers are used for creating prometheus metrics? For example:

  • For all requests, make the X-Foo header a prometheus label
  • For requests to Bar ingress, add the value of the X-Baz header to the set of prometheus labels