opentelemetry-collector
                                
                                
                                
                                    opentelemetry-collector copied to clipboard
                            
                            
                            
                        [mdatagen] Re-Aggregate Metric by Attributes
Reopens 13431
Description
Modified cmd/mdatagen to allow for two new fields in the configuration yaml of metrics. These new configuration options would allow for a user to enable or disable attributes (i.e. reduce dimensionality of metrics being generated) from their collector configuration. The modified MetricsBuilder generated by mdatagen automatically re-aggregates metrics based on the enabled set of attributes. Additionally, different aggregation strategies are supported and can be specified by the collector administrator.
The changes to the config.yaml are:
receiver:
  someMetricReceiver:
    ...
    metrics:
    ...
    attributes: # new field
      some.attribute.name:
         enabled: < true | false >
      aggregation_strategy: < sum | avg | min | max >
A new optional field has been added to metadata.yaml which will allow users to define default "enabled" behavior for attributes. For backwards compatibility any attribute defined in the metadata.yaml will have a default value of enabled: true.
...
attributes:
  some.attribute:
    description: example attributes are interesting
    type: string
    enabled: false # new field, optional
Link to tracking issue
Fixes 10726
Testing
Some testing has been done using the modified mdatagen with existing contrib receivers (i.e. hostmetricsreceiver). Generated tests have been updated to test new aggregation behavior.
Documentation
Updated metadata-schema.yaml to include new optional field.
ran make gogenerate
ran make generate