opentracing-contrib / java-web-servlet-filter

OpenTracing Java Web Servlet Filter Instrumentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to set Sampling Configuration for same operation name with different request URI

hotdust opened this issue · comments

Reqirement

for example, I have a service. Service have two http interface, and both are POST method:

I want to set different sampling for interfaces above:

{
  "service_strategies": [
    {
      "service": "myservice",
      "type": "probabilistic",
      "param": 0.8,
      "operation_strategies": [
        {
          "operation": "encrypt",
          "type": "probabilistic",
          "param": 0.4
        },
        {
          "operation": "decrypt",
          "type": "probabilistic",
          "param": 0.6
        }
      ]
    }
  ]
}

Main Question

Because all operation name are http method, how can I set different sampling configuration for them?

Thinking

1, I want to change operation name by ServletFilterSpanDecorator, but it performs after sampler action.

2, According to #42 and #45, it is not recommended to change operation name. Two reasons as following:

  • request URI may have multiple pattern. /user/{id}
  • high cardinality

(1) request URI may have multiple pattern.
If resolves multiple pattern problem, jaeger-client maybe need to implement pattern resolver.

(2) high cardinality. It is appreciated that talk more details about high cardinality, such as high cardinality affects what(storage? query? or others?) @pavolloffay

(2) basically, it violates the semantics. Different components in a tracing system might rely on it - for instance analytics pipeline which aggregates data.

One solution would be to set sampling.priority tag on the span. However this will sample all spans.

We didn't think about sampling indications when designing span decorator, otherwise, we could have passed span builder instead of span.

The other solution might be to support tag_srategies in jaeger. cc) @yurishkuro

@pavolloffay thanks for quick reply. Two more questions.
1, that looks like there is no solution form how can I set different sampling configuration for them? question, is that right?

2, One of goal of Adaptive Sampler is to resolve starvation problem. Even if Adaptive Sampler is avalible, it can not resolve this quesiton. Because it bases on span operation name too. Is that right?

1, that looks like there is no solution form how can I set different sampling configuration for them? question, is that right?

If the operation name is always the same no.

2, One of goal of Adaptive Sampler is to resolve starvation problem. Even if Adaptive Sampler is avalible, it can not resolve this quesiton. Because it bases on span operation name too. Is that right?

It could work, we would add URL tag to span builder.

thanks for replay. no more question.