Skip to content

RestTemplate client misses placeholdered URI's in metrics and logs a pre-build one (with replaced variables) #3499

@unintended

Description

@unintended
Description

Common practice of using resttemplate is to use methods that handle templated paths with variables either use restTemplate.getUriTemplateHandler().expand() to expand path variables, so resttemplate can store and reuse original template path while logging metrics (e.g. via org.springframework.boot.actuate.metrics.web.client.MetricsClientHttpRequestInterceptor in Spring Boot 2), etc.

openapi-generator version

master

OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

I suggest to replace static call in Api client method from:

UriComponentsBuilder.fromPath("/pet/{petId}").buildAndExpand(uriVariables).toUriString()

with one that addresses uriTemplateHandler of restTemplate, eg :

restTemplate.getUriTemplateHandler().expand("/pet/{petId}", uriVariables).toString();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions