krakend / krakend-otel

KrakenD component for OpenTelemetry
Apache License 2.0
8 stars 10 forks source link

Operations contains actual path variables #13

Closed rassmate closed 4 months ago

rassmate commented 5 months ago

Hi, I have been trying out the tracing feature in our environment and I end up with operations from the global scope that has the actual path param in the operation name.

In different software showing traces graphically such as tempo and jaeger the operation name is something you use to filter on when finding traces. Usually the operation names does not contain any actual path params but rather the path template name instead.

In the proxy, backend and backend-request stages i can only see the template name in operation name but in krakend.stage=global the operation name contains the actual value of the template variable.

I think i can get rid of this by disabling the traces from the global layer but I wanted to check with you first if this is intended behaviour.

I could create a pr to change here to use the tr.EndPointPatteern instead but wanted to check with you first.

The number of different values of a single path parameters is quite a few and I don't think we want that in the operation name

dhontecillas commented 4 months ago

@rassmate at the global layer the "path pattern matching" has not been applied yet, that is done at the route layer (by the gin.Engine that is the router that is being used). So there is no way of giving that span a name without the parameter values (hence replaced by the parameter names). You can find the traces you are interested in at the router layer, and since those are related with the parent span, then look at the data at that level. I am no sure if I explained it well enough, but, we cannot address that without duplicating code just to have that pattern matching (so I must say that we do not plan to change this).

rassmate commented 4 months ago

According to this as I interpret it, if a low cardinality {http.route} is not available, the span name should only be the {method} It also explicitly recommends NOT using the URI.

Perhaps that is a better approach then and more according to guidelines