Class GoogleCloudMetricExporter

  • All Implemented Interfaces:
    io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector, io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector, io.opentelemetry.sdk.metrics.export.MetricExporter, java.io.Closeable, java.lang.AutoCloseable

    public class GoogleCloudMetricExporter
    extends java.lang.Object
    implements io.opentelemetry.sdk.metrics.export.MetricExporter
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static io.opentelemetry.sdk.metrics.export.MetricExporter createWithConfiguration​(MetricConfiguration configuration)
      Method that generates an instance of GoogleCloudMetricExporter using a MetricConfiguration that allows the user to provide custom configuration for Traces.
      static io.opentelemetry.sdk.metrics.export.MetricExporter createWithDefaultConfiguration()
      Method that generates an instance of GoogleCloudMetricExporter using a minimally configured MetricConfiguration object that requires no input from the user.
      io.opentelemetry.sdk.common.CompletableResultCode export​(java.util.Collection<io.opentelemetry.sdk.metrics.data.MetricData> metrics)  
      io.opentelemetry.sdk.common.CompletableResultCode flush()  
      io.opentelemetry.sdk.metrics.data.AggregationTemporality getAggregationTemporality​(io.opentelemetry.sdk.metrics.InstrumentType instrumentType)  
      io.opentelemetry.sdk.common.CompletableResultCode shutdown()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector

        with
      • Methods inherited from interface io.opentelemetry.sdk.metrics.export.MetricExporter

        close, getDefaultAggregation, getMemoryMode
    • Method Detail

      • createWithDefaultConfiguration

        public static io.opentelemetry.sdk.metrics.export.MetricExporter createWithDefaultConfiguration()
        Method that generates an instance of GoogleCloudMetricExporter using a minimally configured MetricConfiguration object that requires no input from the user. Since no project ID is specified, default project ID is used instead. See ServiceOptions.getDefaultProjectId() for details.

        This method defers the initialization of an actual GoogleCloudMetricExporter to a point when it is actually needed - which is when the metrics need to be exported. As a result, while this method does not throw any exception, an exception may still be thrown during the attempt to generate the actual GoogleCloudMetricExporter.

        Returns:
        A configured instance of GoogleCloudMetricExporter as a MetricExporter which gets initialized lazily once export(Collection) is called.
      • createWithConfiguration

        public static io.opentelemetry.sdk.metrics.export.MetricExporter createWithConfiguration​(MetricConfiguration configuration)
        Method that generates an instance of GoogleCloudMetricExporter using a MetricConfiguration that allows the user to provide custom configuration for Traces.

        This method defers the initialization of an actual GoogleCloudMetricExporter to a point when it is actually needed - which is when the metrics need to be exported. As a result, while this method does not throw any exception, an exception may still be thrown during the attempt to generate the actual GoogleCloudMetricExporter.

        Parameters:
        configuration - The MetricConfiguration object that determines the user preferences for metrics.
        Returns:
        An instance of GoogleCloudMetricExporter as a MetricExporter object.
      • export

        public io.opentelemetry.sdk.common.CompletableResultCode export​(@Nonnull
                                                                        java.util.Collection<io.opentelemetry.sdk.metrics.data.MetricData> metrics)
        Specified by:
        export in interface io.opentelemetry.sdk.metrics.export.MetricExporter
      • flush

        public io.opentelemetry.sdk.common.CompletableResultCode flush()
        Specified by:
        flush in interface io.opentelemetry.sdk.metrics.export.MetricExporter
      • shutdown

        public io.opentelemetry.sdk.common.CompletableResultCode shutdown()
        Specified by:
        shutdown in interface io.opentelemetry.sdk.metrics.export.MetricExporter
      • getAggregationTemporality

        public io.opentelemetry.sdk.metrics.data.AggregationTemporality getAggregationTemporality​(@Nonnull
                                                                                                  io.opentelemetry.sdk.metrics.InstrumentType instrumentType)
        Specified by:
        getAggregationTemporality in interface io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector