# Buggy code
def _get_data_points(
    sdk_metric: MetricRecord, data_point_class: Type[DataPointT]
) -> List[DataPointT]:
    data_points = []

    for (
        label,
        bound_counter,
    ) in sdk_metric.instrument.bound_instruments.items():
        string_key_values = []

        for label_key, label_value in label:
            string_key_values.append(StringKeyValue(key=label_key, value=label_value))

        for view_data in bound_counter.view_datas:
            if view_data.labels == label:
                data_points.append(
                    data_point_class(
                        labels=string_key_values,
                        value=view_data.aggregator.current,
                        start_time_unix_nano=(
                            view_data.aggregator.last_checkpoint_timestamp
                        ),
                        time_unix_nano=(view_data.aggregator.last_update_timestamp),
                    )
                )
                break

    return data_points


# Traceback (AttributeError)
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/ocelotl/.pyenv/versions/3.8.3/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/ocelotl/codeboten/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py", line 48, in run
self.tick()
File "/home/ocelotl/codeboten/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py", line 60, in tick
self.exporter.export(self.meter.processor.checkpoint_set())
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 248, in export
return self._export(metrics)
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/exporter.py", line 166, in _export
request=self._translate_data(data),
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 201, in _translate_data
data_points=_get_data_points(sdk_metric, data_point_class),
File "/home/ocelotl/codeboten/opentelemetry-python/exporter/opentelemetry-exporter-otlp/src/opentelemetry/exporter/otlp/metrics_exporter/__init__.py", line 71, in _get_data_points
) in sdk_metric.instrument.bound_instruments.items():
AttributeError: 'SumObserver' object has no attribute 'bound_instruments'

# Fixed code
def _get_data_points(
    sdk_metric_record: MetricRecord, data_point_class: Type[DataPointT]
) -> List[DataPointT]:
    if isinstance(sdk_metric_record.aggregator, SumAggregator):
        value = sdk_metric_record.aggregator.checkpoint

    elif isinstance(sdk_metric_record.aggregator, MinMaxSumCountAggregator):
        # FIXME: How are values to be interpreted from this aggregator?
        raise Exception("MinMaxSumCount aggregator data not supported")

    elif isinstance(sdk_metric_record.aggregator, HistogramAggregator):
        # FIXME: How are values to be interpreted from this aggregator?
        raise Exception("Histogram aggregator data not supported")

    elif isinstance(sdk_metric_record.aggregator, LastValueAggregator):
        value = sdk_metric_record.aggregator.checkpoint

    elif isinstance(sdk_metric_record.aggregator, ValueObserverAggregator):
        value = sdk_metric_record.aggregator.checkpoint.last

    return [
        data_point_class(
            labels=[
                StringKeyValue(key=str(label_key), value=str(label_value))
                for label_key, label_value in sdk_metric_record.labels
            ],
            value=value,
            start_time_unix_nano=(
                sdk_metric_record.aggregator.initial_checkpoint_timestamp
            ),
            time_unix_nano=(sdk_metric_record.aggregator.last_update_timestamp),
        )
    ]