Skip to content

Commit

Permalink
Fix Aggregation import
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Feb 13, 2024
1 parent cb825d9 commit 479e28e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
# limitations under the License.
import logging

# This kind of import is needed to avoid Sphinx errors.
import opentelemetry.sdk.metrics._internal
from opentelemetry.sdk.metrics.export import (
MetricExporter,
)
from opentelemetry.sdk.metrics.view import Aggregation
from os import environ
from opentelemetry.sdk.metrics import (
Counter,
Expand Down Expand Up @@ -67,9 +66,7 @@ class OTLPMetricExporterMixin:
def _common_configuration(
self,
preferred_temporality: Dict[type, AggregationTemporality] = None,
preferred_aggregation: Dict[
type, "opentelemetry.sdk.metrics.view.Aggregation"
] = None,
preferred_aggregation: Dict[type, Aggregation] = None,
) -> None:

MetricExporter.__init__(
Expand Down Expand Up @@ -136,10 +133,8 @@ def get_temporality(

def get_aggregation(
self,
preferred_aggregation: Dict[
type, "opentelemetry.sdk.metrics.view.Aggregation"
],
) -> Dict[type, "opentelemetry.sdk.metrics.view.Aggregation"]:
preferred_aggregation: Dict[type, Aggregation],
) -> Dict[type, Aggregation]:

otel_exporter_otlp_metrics_default_histogram_aggregation = environ.get(
OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,8 @@ def test_preferred_aggregation_override(self):

self.assertEqual(
# pylint: disable=protected-access
exporter._preferred_aggregation[Histogram], histogram_aggregation
exporter._preferred_aggregation[Histogram],
histogram_aggregation,
)


Expand Down

0 comments on commit 479e28e

Please sign in to comment.