eclipse-vertx / vertx-tracing

Vertx integration with tracing libraries
Other
42 stars 34 forks source link

Working with Vert.x openTrace and Jaeger #33

Closed DaniShMyGit closed 11 months ago

DaniShMyGit commented 3 years ago

Hello, Well I'm not sure if it's a bug or misused: I've a kotlin project which integrated with Vert.x, OpenTrace and Jaeger. I used this link for start. I download Jaeger all in one, and run it locally with sample strategy file. I want to exclude some of the endpoints being traced by Jaeger. To do that, I needed to type the operation names of the endpoints I want to exclude inside the sample strategy file. for example "/health" endpoint has the operation name "/health". and the strategy json file looks like:

{
   "default_strategy": {
      "type": "probabilistic",
      "param": 1.0,
      "operation_strategies": [
         {
            "operation": "/health",
            "type": "probabilistic",
            "param": 0.0
         }
      ]
   }
}

The json parsed successfully, and Jaeger run ok but the endpoint is not excluded. While debugging i saw where the problem occurs. It's connected to OpenTracingTracer class:

public class OpenTracingTracer implements io.vertx.core.spi.tracing.VertxTracer<Span, Span>

and specifically in the function : public Span receiveRequest(Context context, SpanKind kind, TracingPolicy policy, R request, String operation, Iterable<Map.Entry<String, String>> headers, TagExtractor tagExtractor)

This function gets as operation argument not the "/health" operation name but the http method which in this case is "GET".

So if I put "operation": "GET" in the strategy file it will exclude all endpoints with http method GET.

How can I bypass this situation so it would exclude by given operation name and not by http method name?

tsegismont commented 11 months ago

Indeed, the operation parameter is used to create the span name indeed. For HTTP, operation is the name of the method, for SQL it is Query, ... etc.

I don't know how the json file can be configured but the request path is stored in a span attribute, http.url.