title: How do I make spring boot RestTemplate client metrics not create a new tag for query parameters
body: <p>I've got a spring boot application that is defining a <code>RestTemplate</code> bean as follows:</p>
  
  <pre><code>@Bean
  public RestTemplate restTemplate(RestTemplateBuilder builder) {
      return builder.build();
  }
  </code></pre>
  
  <p>Also, pulling in <code>spring-boot-starter-actuator</code> and <code>io.micrometer:micrometer-registry-prometheus</code>.</p>
  
  <p>When I use the injected RestTemplate as follows:</p>
  
  <pre><code>@Autowired
  private RestTemplate restTemplate;
  
  private String uriTemplate = "http://my.domain.com/bookstore-api/books";
  
  public List&lt;Book&gt; getBooksByAuthor(String author) {
      // create URI for "http://my.domain.com/bookstore-api/books?author={authorId}"
      UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder
              .fromUriString(uriTemplate)
              .queryParam("author", author);
  
      // make the GET 
      ResponseEntity&lt;Book[]&gt; responseEntity = restTemplate.getForEntity(uriComponentsBuilder.toUriString(),Book[].class);
  
      // rest ommitted for brevity
  }
  </code></pre>
  
  <p>When <code>getBooksByAuthor("Tolkien")</code> is called, we can then hit <code>/metrics/prometheus</code> and see the following:</p>
  
  <pre><code>http_client_requests_seconds_count{clientName="my.domain.com",method="GET",status="200",uri="/bookstore-api/books?author=Tolkien",} 2.0
  http_client_requests_seconds_sum{clientName="my.domain.com",method="GET",status="200",uri="/bookstore-api/books?author=Tolkien",} 0.253227898
  </code></pre>
  
  <p>This would be fine, except that there are lots of authors out there, and eventually I will get the "too many tags" exception.</p>
  
  <p>I would prefer to have the following (similar to how path variables get templated):</p>
  
  <pre><code>http_client_requests_seconds_count{clientName="my.domain.com",method="GET",status="200",uri="/bookstore-api/books?author={author}",} 2.0
  http_client_requests_seconds_sum{clientName="my.domain.com",method="GET",status="200",uri="/bookstore-api/books?author={author}",} 0.253227898
  </code></pre>
  
  <p>Is this possible to achieve by modifying the way I use <code>UriComponentsBuilder</code>?  The closest thing I've found is to define my own <code>RestTemplateExchangeTagsProvider</code>, and override the default to do some crazy regex replacement.</p>