open-telemetry / open-telemetry/opentelemetry-java-contrib

Deprecate RuleBasedRoutingSampler in favor of ComposableRuleBasedSampler

Open
#3,099 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
269
Forks
196
Avg merge
2d 7h
Merged PRs (30d)
38

Description

Deprecate RuleBasedRoutingSampler in favor of ComposableRuleBasedSampler, which implements the same concept now standardized (although still in development) in the spec.

ComposableRuleBasedSampler is still incubating in the spec and in opentelemetry-java. I don't think we should have a delete time table for RuleBasedRoutingSampler until ComposableRuleBasedSampler is stable. Still, I think we should deprecate to:

  • Stop adding new features to RuleBasedRoutingSampler, instead encouraging development on ComposableRuleBasedSampler and incentivizing stabilization.
  • Start a long deprecation window so users have plenty of time to migrate.

Using the declarative config example snippet from the RuleBasedRoutingSampler readme, here's the before / after switching to ComposableRuleBasedSampler:

RuleBasedRoutingSampler:

tracer_provider:
  sampler:
    parent_based:
      # Configure the parent_based sampler's root sampler to be rule_based_routing sampler.
      root:
        rule_based_routing:
          # Fallback to the always_on sampler if the criteria is not met.
          fallback_sampler:
            always_on:
          # Only apply to SERVER spans.
          span_kind: SERVER
          rules:
            # Drop spans where url.path matches the regex /actuator.* (i.e. spring boot actuator endpoints).
            - action: DROP
              attribute: url.path
              pattern: /actuator.*

ComposableRuleBasedSampler:

tracer_provider:                                                                                                                                                                                                                                                                                                                                                                                                                                          
 sampler:                                                                                                                                                                                                                                                                                                                                                                                                                                                
   parent_based:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
     root:                                                                                                                                                                                                                                                                                                                                                                                                                                               
       composite/development:                                                                                                                                                                                                                                                                                                                                                                                                                            
         rule_based:                                                                                                                                                                                                                                                                                                                                                                                                                                     
           rules:                                                                                                                                                                                                                                                                                                                                                                                                                                        
             # Drop SERVER spans whose url.path matches /actuator* (spring boot actuator endpoints).                                                                                                                                                                                                                                                                                                                                                     
             - span_kinds:                                                                                                                                                                                                                                                                                                                                                                                                                               
                 - server                                                                                                                                                                                                                                                                                                                                                                                                                                
               attribute_patterns:                                                                                                                                                                                                                                                                                                                                                                                                                       
                 key: url.path                                                                                                                                                                                                                                                                                                                                                                                                                           
                 included:                                                                                                                                                                                                                                                                                                                                                                                                                               
                   - /actuator*                                                                                                                                                                                                                                                                                                                                                                                                                          
               sampler:                                                                                                                                                                                                                                                                                                                                                                                                                                  
                 always_off:                                                                                                                                                                                                                                                                                                                                                                                                                             
             # Catch-all: fallback to always_on                                                                                                                                                                                                                                                                                                                                                     
             - sampler:                                                                                                                                                                                                                                                                                                                                                                                                                                  
                 always_on: 

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with samplers/src/main/java/io/opentelemetry/contrib/sampler/RuleBasedRoutingSampler.java and its README configuration example, then compare the linked ComposableRuleBasedSampler API. Check the sampler module's existing deprecation and API tests before documenting the migration path. Done means the older sampler is deprecated with a clear reference to the composable replacement and relevant checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.