Skip to content

[Feature]: metrics views per reader #3437

@BrynCooke

Description

@BrynCooke

Related Problems?

I've been looking at the yaml config for otel: https://github.com/open-telemetry/opentelemetry-configuration/blob/main/schema/meter_provider.yaml#L44-L99

It looks like cardinality limits are specified at the reader level. This means that currently cardinality config cannot be supported by views as these are global to a meter.

 meter_provider:                                                                                                                                                                                                                                                                                                         
    readers:                                                                                                                                                                                                                                                                                                                
      - periodic:                                                                                                                                                                                                                                                                                                         
          exporter:                                                                                                                                                                                                                                                                                                         
            otlp_http:                                                                                                                                                                                                                                                                                                    
              endpoint: http://apm1:4318                                                                                                                                                                                                                                                                               
          cardinality_limits: # reader level            
            default: 500        
      - periodic:                                                                                                                                                                                                                                                                                                         
          exporter:                                                                                                                                                                                                                                                                                                         
            otlp_http:                                                                                                                                                                                                                                                                                                    
              endpoint: http://apm2:4318                                                                                                                                                                                                                                                                               
          cardinality_limits: # reader level
            default: 800        
    views:                   # meter level                                                                    
      - selector:                                                                                                                                                                                                                                                                                                           
          instrument_name: 'http.*'
        stream:                                                                                                                                                                                                                                                                                                             
          attribute_keys:                                                                    
            included:    
              - method                    
              - status_code    

It would be great to be able to specify views at the reader level as there are definitely times when you want to send some metrics one way and other metrics another way. It would also make supporting cardinality limits at the reader level possible.

Describe the solution you'd like:

Reader specific views are supported. e.g.

 let reader = PeriodicReader::builder(exporter)
                .with_interval(interval)
                .with_view(view) // Reader specific views, layers on top of meter level views.
                .build();

Considered Alternatives

No response

Additional Context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions