Class ExporterMetrics


  • public class ExporterMetrics
    extends java.lang.Object
    Helper for recording metrics from exporters.

    This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

    • Field Detail

      • ATTRIBUTE_KEY_TYPE

        private static final AttributeKey<java.lang.String> ATTRIBUTE_KEY_TYPE
      • ATTRIBUTE_KEY_SUCCESS

        private static final AttributeKey<java.lang.Boolean> ATTRIBUTE_KEY_SUCCESS
      • meterProviderSupplier

        private final java.util.function.Supplier<MeterProvider> meterProviderSupplier
      • exporterName

        private final java.lang.String exporterName
      • transportName

        private final java.lang.String transportName
      • successAttrs

        private final Attributes successAttrs
      • failedAttrs

        private final Attributes failedAttrs
    • Constructor Detail

      • ExporterMetrics

        private ExporterMetrics​(java.util.function.Supplier<MeterProvider> meterProviderSupplier,
                                java.lang.String exporterName,
                                java.lang.String type,
                                java.lang.String transportName)
    • Method Detail

      • addSeen

        public void addSeen​(long value)
        Record number of records seen.
      • addSuccess

        public void addSuccess​(long value)
        Record number of records which successfully exported.
      • addFailed

        public void addFailed​(long value)
        Record number of records which failed to export.
      • meter

        private Meter meter()
      • createGrpc

        public static ExporterMetrics createGrpc​(java.lang.String exporterName,
                                                 java.lang.String type,
                                                 java.util.function.Supplier<MeterProvider> meterProvider)
        Create an instance for recording exporter metrics under the meter "io.opentelemetry.exporters." + exporterName + "-grpc".
      • createGrpcOkHttp

        public static ExporterMetrics createGrpcOkHttp​(java.lang.String exporterName,
                                                       java.lang.String type,
                                                       java.util.function.Supplier<MeterProvider> meterProvider)
        Create an instance for recording exporter metrics under the meter "io.opentelemetry.exporters." + exporterName + "-grpc-okhttp".
      • createHttpProtobuf

        public static ExporterMetrics createHttpProtobuf​(java.lang.String exporterName,
                                                         java.lang.String type,
                                                         java.util.function.Supplier<MeterProvider> meterProvider)
        Create an instance for recording exporter metrics under the meter "io.opentelemetry.exporters." + exporterName + "-http".
      • createHttpJson

        public static ExporterMetrics createHttpJson​(java.lang.String exporterName,
                                                     java.lang.String type,
                                                     java.util.function.Supplier<MeterProvider> meterProvider)
        Create an instance for recording exporter metrics under the meter "io.opentelemetry.exporters." + exporterName + "-http-json".