# opentelemetry.sdk.metrics.view

class opentelemetry.sdk.metrics.view.Aggregation

  Bases: `ABC`

  Base class for all aggregation types.

class opentelemetry.sdk.metrics.view.DefaultAggregation

  Bases: `Aggregation`

  The default aggregation to be used in a `View`.

  This aggregation will create an actual aggregation depending on the instrument type, as specified next:

  Instrument | Aggregation
  --- | ---
  `opentelemetry.sdk.metrics.Counter` | `SumAggregation`
  `opentelemetry.sdk.metrics.UpDownCounter` | `SumAggregation`
  `opentelemetry.sdk.metrics.ObservableCounter` | `SumAggregation`
  `opentelemetry.sdk.metrics.ObservableUpDownCounter` | `SumAggregation`
  `opentelemetry.sdk.metrics.Histogram` | `ExplicitBucketHistogramAggregation`
  `opentelemetry.sdk.metrics.ObservableGauge` | `LastValueAggregation`

class opentelemetry.sdk.metrics.view.DropAggregation

  Bases: `Aggregation`

  Using this aggregation will make all measurements be ignored.

class opentelemetry.sdk.metrics.view.ExplicitBucketHistogramAggregation(boundaries=None, record_min_max=True)

  Bases: `Aggregation`

  This aggregation informs the SDK to collect:

  - Count of Measurement values falling within explicit bucket boundaries.

  - Arithmetic sum of Measurement values in population. This SHOULD NOT be collected when used with instruments that record negative measurements, e.g. UpDownCounter or ObservableGauge.

  - Min (optional) Measurement value in population.

  - Max (optional) Measurement value in population.

  Parameters:

    - boundaries (`Sequence`[`float`] | `None`) – Array of increasing values representing explicit bucket boundary values.

    - record_min_max (`bool`) – Whether to record min and max.

class opentelemetry.sdk.metrics.view.ExponentialBucketHistogramAggregation(max_size=160, max_scale=20)

  Bases: `Aggregation`

class opentelemetry.sdk.metrics.view.LastValueAggregation

  Bases: `Aggregation`

  This aggregation informs the SDK to collect:

  - The last Measurement.

  - The timestamp of the last Measurement.

class opentelemetry.sdk.metrics.view.SumAggregation

  Bases: `Aggregation`

  This aggregation informs the SDK to collect:

  - The arithmetic sum of Measurement values.

class opentelemetry.sdk.metrics.view.View(instrument_type=None, instrument_name=None, meter_name=None, meter_version=None, meter_schema_url=None, name=None, description=None, attribute_keys=None, aggregation=None, exemplar_reservoir_factory=None, instrument_unit=None)

  Bases: `object`

  A `View` configuration parameters can be used for the following purposes:

  1. Match instruments: When an instrument matches a view, measurements received by that instrument will be processed.

  2. Customize metric streams: A metric stream is identified by a match between a view and an instrument and a set of attributes. The metric stream can be customized by certain attributes of the corresponding view.

  The attributes documented next serve one of the previous two purposes.

  Parameters:

    - instrument_type (`Type`[`Instrument`] | `None`) – This is an instrument matching attribute: the class the instrument must be to match the view.

    - instrument_name (`str` | `None`) – This is an instrument matching attribute: the name the instrument must have to match the view. Wild card characters are supported. Wild card characters should not be used with this attribute if the view has also a `name` defined.

    - meter_name (`str` | `None`) – This is an instrument matching attribute: the name the instrument meter must have to match the view.

    - meter_version (`str` | `None`) – This is an instrument matching attribute: the version the instrument meter must have to match the view.

    - meter_schema_url (`str` | `None`) – This is an instrument matching attribute: the schema URL the instrument meter must have to match the view.

    - name (`str` | `None`) – This is a metric stream customizing attribute: the name of the metric stream. If `None`, the name of the instrument will be used.

    - description (`str` | `None`) – This is a metric stream customizing attribute: the description of the metric stream. If `None`, the description of the instrument will be used.

    - attribute_keys (`Set`[`str`] | `None`) – This is a metric stream customizing attribute: this is a set of attribute keys. If not `None` then only the measurement attributes that are in `attribute_keys` will be used to identify the metric stream.

    - aggregation (`Aggregation` | `None`) – This is a metric stream customizing attribute: the aggregation instance to use when data is aggregated for the corresponding metrics stream. If `None` an instance of `DefaultAggregation` will be used.

    - exemplar_reservoir_factory (`Callable`[[`Type`[`_Aggregation`]], `Callable`[[`Dict`[`str`, `Any`]], `ExemplarReservoir`]] | `None`) – This is a metric stream customizing attribute: the exemplar reservoir factory

    - instrument_unit (`str` | `None`) – This is an instrument matching attribute: the unit the instrument must have to match the view.

  This class is not intended to be subclassed by the user.