Adding a namespace variable into prometheus query

In order to split metrics for different namespaces, we need to add a variable for namespace, then update each query to use the variable for kubernetes_namespace in the prometheus query.how to achieve this.