feign
feign copied to clipboard
Micrometer metric tag for http method
Description
The method tag added by feign-micrometer is the method name of the interface, not the http method. For example, metrics for requests made with the following client:
interface GitHub() {
@RequestLine("GET /repos/{owner}/{repo}/issues")
List<Issue> getIssues(@Param("owner") String owner, @Param("repo") String repo);
}
will have a method tag with a value of getIssues.
This becomes problematic when the same URI is used with multiple http methods:
interface GitHub() {
@RequestLine("GET /repos/{owner}/{repo}/issues")
List<Issue> getIssues(@Param("owner") String owner, @Param("repo") String repo);
@RequestLine("POST /repos/{owner}/{repo}/issues")
void createIssue(Issue issue, @Param("owner") String owner, @Param("repo") String repo);
}
Metrics for these requests will have a method tag of getIssues or createIssues respectively, but both have the same uri tag with a value of /repos/{owner}/{repo}/issues. This makes it difficult to separate the two metrics intuitively without knowledge of the specific client implementation.
Proposal:
Add a tag named http_method (or something similar) with the value of the http method for the request.