Skip to content

Annotations logged to the wrong spans #242

@Koizumi85

Description

@Koizumi85

I am facing the issue, that I have two spans in a trace (which is totally right), but all annotations of the second span seem to be logged to the parent span. (which is breaking the dependency link view in zipkin for example)

I have the following setup:

  • eureka
  • frontend-service (serves static files directly and proxies /rest/** to other microservices using Zuul)
  • user-service (is a REST webservice with standard spring boot/cloud/sleuth setup without any notable modifications)

If I call "/rest/user-service/user/" on the frontend-service, the call is proxied to user-service by Zuul as expected. Sleuth is creating two Spans:

{  
      "traceId":"7812fede5b61e83a",
      "name":"http:/rest/user-service/user/",
      "id":"7812fede5b61e83a",
      "timestamp":1459495267893000,
      "duration":182000,
      "annotations":[  
         {  
            "endpoint":{  
               "serviceName":"frontend-service",
               "ipv4":"127.0.0.1",
               "port":8080
            },
            "timestamp":1459495267893000,
            "value":"sr"
         },
         {  
            "endpoint":{  
               "serviceName":"frontend-service",
               "ipv4":"127.0.0.1",
               "port":8080
            },
            "timestamp":1459495267925000,
            "value":"cs"
         },
         {  
            "endpoint":{  
               "serviceName":"user-service",
               "ipv4":"127.0.0.1",
               "port":35321
            },
            "timestamp":1459495267931000,
            "value":"sr"
         },
         {  
            "endpoint":{  
               "serviceName":"frontend-service",
               "ipv4":"127.0.0.1",
               "port":8080
            },
            "timestamp":1459495267989000,
            "value":"cr"
         },
         {  
            "endpoint":{  
               "serviceName":"user-service",
               "ipv4":"127.0.0.1",
               "port":35321
            },
            "timestamp":1459495268049000,
            "value":"ss"
         },
         {  
            "endpoint":{  
               "serviceName":"frontend-service",
               "ipv4":"127.0.0.1",
               "port":8080
            },
            "timestamp":1459495268075000,
            "value":"ss"
         }
      ],
      "binaryAnnotations":[  ]
   }

second:

{  
      "traceId":"7812fede5b61e83a",
      "name":"http:/user/",
      "id":"76ef2d027c4d1007",
      "parentId":"7812fede5b61e83a",
      "timestamp":1459495267931000,
      "duration":118000,
      "annotations":[  ],
      "binaryAnnotations":[  
         {  
            "key":"http.host",
            "value":"localhost",
            "endpoint":{  
               "serviceName":"user-service",
               "ipv4":"127.0.0.1",
               "port":35321
            }
         },
         {  
            "key":"http.method",
            "value":"GET",
            "endpoint":{  
               "serviceName":"user-service",
               "ipv4":"127.0.0.1",
               "port":35321
            }
         },
         {  
            "key":"http.path",
            "value":"/user/",
            "endpoint":{  
               "serviceName":"user-service",
               "ipv4":"127.0.0.1",
               "port":35321
            }
         },
         {  
            "key":"http.url",
            "value":"http://localhost:35321/user/",
            "endpoint":{  
               "serviceName":"user-service",
               "ipv4":"127.0.0.1",
               "port":35321
            }
         },
         {  
            "key":"lc",
            "value":"unknown",
            "endpoint":{  
               "serviceName":"user-service",
               "ipv4":"127.0.0.1",
               "port":35321
            }
         }
      ]
   }

As you can see, there are no annotations on the second span (the one created by user-service). Instead there are two annotations on the first span (created by frontend-service), which obviously should belong to the user-service:

{  
   "endpoint":{  
      "serviceName":"user-service",
      "ipv4":"127.0.0.1",
      "port":35321
   },
   "timestamp":1459495267931000,
   "value":"sr"
}
{  
   "endpoint":{  
       "serviceName":"user-service",
       "ipv4":"127.0.0.1",
       "port":35321
   },
   "timestamp":1459495268049000,
   "value":"ss"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions