feign icon indicating copy to clipboard operation
feign copied to clipboard

Micrometer metric tag for http method

Open divsmith opened this issue 3 years ago • 0 comments

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.

divsmith avatar Jun 10 '22 22:06 divsmith