{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE StrictData #-}

{- |
Module      : OpenTelemetry.Internal.Metric.Types
Copyright   : (c) Ian Duncan, 2026
License     : BSD-3
Description : Internal types for the OpenTelemetry Metrics API.
Stability   : experimental

Core metric types: instrument kinds, counters, histograms, gauges (sync and
async), meters, and meter providers. Not intended for direct import; use
"OpenTelemetry.Metric.Core" instead.

Spec: <https://opentelemetry.io/docs/specs/otel/metrics/api/>
-}
module OpenTelemetry.Internal.Metric.Types (
  InstrumentKind (..),
  HistogramAggregation (..),
  AdvisoryParameters (..),
  defaultAdvisoryParameters,
  Counter (..),
  UpDownCounter (..),
  Histogram (..),
  Gauge (..),
  ObservableResult (..),
  ObservableCallbackHandle (..),
  ObservableCounter (..),
  ObservableUpDownCounter (..),
  ObservableGauge (..),
  Meter (..),
  MeterProvider (..),
) where

import Data.Hashable (Hashable (hashWithSalt))
import Data.Int (Int32, Int64)
import Data.Text (Text)
import Data.Vector (Vector)
import qualified Data.Vector as V
import GHC.Generics (Generic)
import OpenTelemetry.Attributes (Attributes)
import OpenTelemetry.Internal.Common.Types (FlushResult, InstrumentationLibrary, ShutdownResult)


{- | Instrument kinds from the metrics API specification.

@since 0.0.1.0
-}
data InstrumentKind
  = KindCounter
  | KindAsyncCounter
  | KindUpDownCounter
  | KindAsyncUpDownCounter
  | KindHistogram
  | KindGauge
  | KindAsyncGauge
  deriving stock (InstrumentKind -> InstrumentKind -> Bool
(InstrumentKind -> InstrumentKind -> Bool)
-> (InstrumentKind -> InstrumentKind -> Bool) -> Eq InstrumentKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InstrumentKind -> InstrumentKind -> Bool
== :: InstrumentKind -> InstrumentKind -> Bool
$c/= :: InstrumentKind -> InstrumentKind -> Bool
/= :: InstrumentKind -> InstrumentKind -> Bool
Eq, Int -> InstrumentKind -> ShowS
[InstrumentKind] -> ShowS
InstrumentKind -> String
(Int -> InstrumentKind -> ShowS)
-> (InstrumentKind -> String)
-> ([InstrumentKind] -> ShowS)
-> Show InstrumentKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InstrumentKind -> ShowS
showsPrec :: Int -> InstrumentKind -> ShowS
$cshow :: InstrumentKind -> String
show :: InstrumentKind -> String
$cshowList :: [InstrumentKind] -> ShowS
showList :: [InstrumentKind] -> ShowS
Show, Eq InstrumentKind
Eq InstrumentKind =>
(InstrumentKind -> InstrumentKind -> Ordering)
-> (InstrumentKind -> InstrumentKind -> Bool)
-> (InstrumentKind -> InstrumentKind -> Bool)
-> (InstrumentKind -> InstrumentKind -> Bool)
-> (InstrumentKind -> InstrumentKind -> Bool)
-> (InstrumentKind -> InstrumentKind -> InstrumentKind)
-> (InstrumentKind -> InstrumentKind -> InstrumentKind)
-> Ord InstrumentKind
InstrumentKind -> InstrumentKind -> Bool
InstrumentKind -> InstrumentKind -> Ordering
InstrumentKind -> InstrumentKind -> InstrumentKind
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: InstrumentKind -> InstrumentKind -> Ordering
compare :: InstrumentKind -> InstrumentKind -> Ordering
$c< :: InstrumentKind -> InstrumentKind -> Bool
< :: InstrumentKind -> InstrumentKind -> Bool
$c<= :: InstrumentKind -> InstrumentKind -> Bool
<= :: InstrumentKind -> InstrumentKind -> Bool
$c> :: InstrumentKind -> InstrumentKind -> Bool
> :: InstrumentKind -> InstrumentKind -> Bool
$c>= :: InstrumentKind -> InstrumentKind -> Bool
>= :: InstrumentKind -> InstrumentKind -> Bool
$cmax :: InstrumentKind -> InstrumentKind -> InstrumentKind
max :: InstrumentKind -> InstrumentKind -> InstrumentKind
$cmin :: InstrumentKind -> InstrumentKind -> InstrumentKind
min :: InstrumentKind -> InstrumentKind -> InstrumentKind
Ord, (forall x. InstrumentKind -> Rep InstrumentKind x)
-> (forall x. Rep InstrumentKind x -> InstrumentKind)
-> Generic InstrumentKind
forall x. Rep InstrumentKind x -> InstrumentKind
forall x. InstrumentKind -> Rep InstrumentKind x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InstrumentKind -> Rep InstrumentKind x
from :: forall x. InstrumentKind -> Rep InstrumentKind x
$cto :: forall x. Rep InstrumentKind x -> InstrumentKind
to :: forall x. Rep InstrumentKind x -> InstrumentKind
Generic)
  deriving anyclass (Eq InstrumentKind
Eq InstrumentKind =>
(Int -> InstrumentKind -> Int)
-> (InstrumentKind -> Int) -> Hashable InstrumentKind
Int -> InstrumentKind -> Int
InstrumentKind -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> InstrumentKind -> Int
hashWithSalt :: Int -> InstrumentKind -> Int
$chash :: InstrumentKind -> Int
hash :: InstrumentKind -> Int
Hashable)


{- | Histogram aggregation chosen for an instrument (explicit bounds vs exponential).

@since 0.0.1.0
-}
data HistogramAggregation
  = HistogramAggregationExplicit !(Vector Double)
  | -- | Exponential histogram scale (OTel mapping index uses @2^scale@).
    HistogramAggregationExponential !Int32
  deriving stock (HistogramAggregation -> HistogramAggregation -> Bool
(HistogramAggregation -> HistogramAggregation -> Bool)
-> (HistogramAggregation -> HistogramAggregation -> Bool)
-> Eq HistogramAggregation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HistogramAggregation -> HistogramAggregation -> Bool
== :: HistogramAggregation -> HistogramAggregation -> Bool
$c/= :: HistogramAggregation -> HistogramAggregation -> Bool
/= :: HistogramAggregation -> HistogramAggregation -> Bool
Eq, Int -> HistogramAggregation -> ShowS
[HistogramAggregation] -> ShowS
HistogramAggregation -> String
(Int -> HistogramAggregation -> ShowS)
-> (HistogramAggregation -> String)
-> ([HistogramAggregation] -> ShowS)
-> Show HistogramAggregation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HistogramAggregation -> ShowS
showsPrec :: Int -> HistogramAggregation -> ShowS
$cshow :: HistogramAggregation -> String
show :: HistogramAggregation -> String
$cshowList :: [HistogramAggregation] -> ShowS
showList :: [HistogramAggregation] -> ShowS
Show, (forall x. HistogramAggregation -> Rep HistogramAggregation x)
-> (forall x. Rep HistogramAggregation x -> HistogramAggregation)
-> Generic HistogramAggregation
forall x. Rep HistogramAggregation x -> HistogramAggregation
forall x. HistogramAggregation -> Rep HistogramAggregation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HistogramAggregation -> Rep HistogramAggregation x
from :: forall x. HistogramAggregation -> Rep HistogramAggregation x
$cto :: forall x. Rep HistogramAggregation x -> HistogramAggregation
to :: forall x. Rep HistogramAggregation x -> HistogramAggregation
Generic)


instance Hashable HistogramAggregation where
  hashWithSalt :: Int -> HistogramAggregation -> Int
hashWithSalt Int
s (HistogramAggregationExplicit Vector Double
v) =
    (Int -> Double -> Int) -> Int -> Vector Double -> Int
forall a b. (a -> b -> a) -> a -> Vector b -> a
V.foldl' Int -> Double -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt (Int
s Int -> Int -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` (Int
0 :: Int) Int -> Int -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Vector Double -> Int
forall a. Vector a -> Int
V.length Vector Double
v) Vector Double
v
  hashWithSalt Int
s (HistogramAggregationExponential Int32
sc) =
    Int
s Int -> Int -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` (Int
1 :: Int) Int -> Int32 -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Int32
sc


{- | Advisory parameters (spec: implementations MAY ignore; SDK SHOULD honor where defined).

@since 0.0.1.0
-}
data AdvisoryParameters = AdvisoryParameters
  { AdvisoryParameters -> Maybe [Double]
advisoryExplicitBucketBoundaries :: !(Maybe [Double])
  -- ^ Histogram explicit bucket boundaries (sorted ascending in SDK when applied).
  , AdvisoryParameters -> Maybe [Text]
advisoryAttributeKeys :: !(Maybe [Text])
  -- ^ Recommended attribute keys for the resulting metric stream (development in spec).
  , AdvisoryParameters -> Maybe HistogramAggregation
advisoryHistogramAggregation :: !(Maybe HistogramAggregation)
  -- ^ Prefer explicit buckets or exponential histogram when set; views may override.
  }
  deriving stock (AdvisoryParameters -> AdvisoryParameters -> Bool
(AdvisoryParameters -> AdvisoryParameters -> Bool)
-> (AdvisoryParameters -> AdvisoryParameters -> Bool)
-> Eq AdvisoryParameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AdvisoryParameters -> AdvisoryParameters -> Bool
== :: AdvisoryParameters -> AdvisoryParameters -> Bool
$c/= :: AdvisoryParameters -> AdvisoryParameters -> Bool
/= :: AdvisoryParameters -> AdvisoryParameters -> Bool
Eq, Int -> AdvisoryParameters -> ShowS
[AdvisoryParameters] -> ShowS
AdvisoryParameters -> String
(Int -> AdvisoryParameters -> ShowS)
-> (AdvisoryParameters -> String)
-> ([AdvisoryParameters] -> ShowS)
-> Show AdvisoryParameters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AdvisoryParameters -> ShowS
showsPrec :: Int -> AdvisoryParameters -> ShowS
$cshow :: AdvisoryParameters -> String
show :: AdvisoryParameters -> String
$cshowList :: [AdvisoryParameters] -> ShowS
showList :: [AdvisoryParameters] -> ShowS
Show, (forall x. AdvisoryParameters -> Rep AdvisoryParameters x)
-> (forall x. Rep AdvisoryParameters x -> AdvisoryParameters)
-> Generic AdvisoryParameters
forall x. Rep AdvisoryParameters x -> AdvisoryParameters
forall x. AdvisoryParameters -> Rep AdvisoryParameters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AdvisoryParameters -> Rep AdvisoryParameters x
from :: forall x. AdvisoryParameters -> Rep AdvisoryParameters x
$cto :: forall x. Rep AdvisoryParameters x -> AdvisoryParameters
to :: forall x. Rep AdvisoryParameters x -> AdvisoryParameters
Generic)


-- | @since 0.0.1.0
defaultAdvisoryParameters :: AdvisoryParameters
defaultAdvisoryParameters :: AdvisoryParameters
defaultAdvisoryParameters =
  AdvisoryParameters
    { advisoryExplicitBucketBoundaries :: Maybe [Double]
advisoryExplicitBucketBoundaries = Maybe [Double]
forall a. Maybe a
Nothing
    , advisoryAttributeKeys :: Maybe [Text]
advisoryAttributeKeys = Maybe [Text]
forall a. Maybe a
Nothing
    , advisoryHistogramAggregation :: Maybe HistogramAggregation
advisoryHistogramAggregation = Maybe HistogramAggregation
forall a. Maybe a
Nothing
    }


{- | Synchronous counter (non-negative increments). @a@ is 'Int64' or 'Double'.

@since 0.0.1.0
-}
data Counter a = Counter
  { forall a. Counter a -> a -> Attributes -> IO ()
counterAdd :: !(a -> Attributes -> IO ())
  -- ^ Record an increment. Negative values are silently dropped for monotonic counters.
  , forall a. Counter a -> IO Bool
counterEnabled :: !(IO Bool)
  -- ^ Whether this instrument is active. Noop instruments return @False@.
  }


{- | Synchronous additive instrument that may increase or decrease.

@since 0.0.1.0
-}
data UpDownCounter a = UpDownCounter
  { forall a. UpDownCounter a -> a -> Attributes -> IO ()
upDownCounterAdd :: !(a -> Attributes -> IO ())
  -- ^ Record an increment (positive) or decrement (negative).
  , forall a. UpDownCounter a -> IO Bool
upDownCounterEnabled :: !(IO Bool)
  -- ^ Whether this instrument is active.
  }


{- | Synchronous histogram (records 'Double' measurements).

@since 0.0.1.0
-}
data Histogram = Histogram
  { Histogram -> Double -> Attributes -> IO ()
histogramRecord :: !(Double -> Attributes -> IO ())
  -- ^ Record a measurement. NaN and Infinity are silently dropped.
  , Histogram -> IO Bool
histogramEnabled :: !(IO Bool)
  -- ^ Whether this instrument is active.
  }


{- | Synchronous gauge (last value wins per collect cycle semantics in SDK).

@since 0.0.1.0
-}
data Gauge a = Gauge
  { forall a. Gauge a -> a -> Attributes -> IO ()
gaugeRecord :: !(a -> Attributes -> IO ())
  -- ^ Record a value. The last value per attribute set wins at collection time.
  , forall a. Gauge a -> IO Bool
gaugeEnabled :: !(IO Bool)
  -- ^ Whether this instrument is active.
  }


{- | Result handle passed to observable callbacks (spec: observe measurements at one logical instant).

@since 0.0.1.0
-}
newtype ObservableResult a = ObservableResult
  { forall a. ObservableResult a -> a -> Attributes -> IO ()
observe :: a -> Attributes -> IO ()
  -- ^ Report a measurement for the given attribute set.
  }


{- | Handle to unregister a callback registered after instrument creation.

@since 0.0.1.0
-}
newtype ObservableCallbackHandle = ObservableCallbackHandle
  { ObservableCallbackHandle -> IO ()
unregisterObservableCallback :: IO ()
  -- ^ Remove this callback so it is no longer invoked during collection.
  }


{- | Asynchronous counter: monotonic cumulative values observed per collection.

@since 0.0.1.0
-}
data ObservableCounter a = ObservableCounter
  { forall a.
ObservableCounter a
-> (ObservableResult a -> IO ()) -> IO ObservableCallbackHandle
observableCounterRegisterCallback :: !((ObservableResult a -> IO ()) -> IO ObservableCallbackHandle)
  -- ^ Register an additional callback after creation; returns a handle to unregister it.
  , forall a. ObservableCounter a -> InstrumentationLibrary
observableCounterInstrumentScope :: !InstrumentationLibrary
  -- ^ The instrumentation scope that created this instrument.
  , forall a. ObservableCounter a -> Text
observableCounterInstrumentName :: !Text
  -- ^ The instrument name (case-insensitive for matching in the SDK).
  , forall a. ObservableCounter a -> IO Bool
observableCounterEnabled :: !(IO Bool)
  -- ^ Whether this instrument is active.
  }


{- | Asynchronous up-down counter.

@since 0.0.1.0
-}
data ObservableUpDownCounter a = ObservableUpDownCounter
  { forall a.
ObservableUpDownCounter a
-> (ObservableResult a -> IO ()) -> IO ObservableCallbackHandle
observableUpDownCounterRegisterCallback :: !((ObservableResult a -> IO ()) -> IO ObservableCallbackHandle)
  -- ^ Register an additional callback after creation.
  , forall a. ObservableUpDownCounter a -> InstrumentationLibrary
observableUpDownCounterInstrumentScope :: !InstrumentationLibrary
  -- ^ The instrumentation scope that created this instrument.
  , forall a. ObservableUpDownCounter a -> Text
observableUpDownCounterInstrumentName :: !Text
  -- ^ The instrument name.
  , forall a. ObservableUpDownCounter a -> IO Bool
observableUpDownCounterEnabled :: !(IO Bool)
  -- ^ Whether this instrument is active.
  }


{- | Asynchronous gauge.

@since 0.0.1.0
-}
data ObservableGauge a = ObservableGauge
  { forall a.
ObservableGauge a
-> (ObservableResult a -> IO ()) -> IO ObservableCallbackHandle
observableGaugeRegisterCallback :: !((ObservableResult a -> IO ()) -> IO ObservableCallbackHandle)
  -- ^ Register an additional callback after creation.
  , forall a. ObservableGauge a -> InstrumentationLibrary
observableGaugeInstrumentScope :: !InstrumentationLibrary
  -- ^ The instrumentation scope that created this instrument.
  , forall a. ObservableGauge a -> Text
observableGaugeInstrumentName :: !Text
  -- ^ The instrument name.
  , forall a. ObservableGauge a -> IO Bool
observableGaugeEnabled :: !(IO Bool)
  -- ^ Whether this instrument is active.
  }


{- | Creates instruments for a single instrumentation scope.

@since 0.0.1.0
| All instrument factory functions take: name, optional unit, optional description, advisory parameters.
Observable factories additionally take initial callbacks.
-}
data Meter = Meter
  { Meter -> InstrumentationLibrary
meterInstrumentationScope :: !InstrumentationLibrary
  -- ^ The scope that owns instruments created by this meter.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> IO (Counter Int64)
meterCreateCounterInt64 :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> IO (Counter Int64))
  -- ^ Create a synchronous monotonic Int64 counter.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> IO (Counter Double)
meterCreateCounterDouble :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> IO (Counter Double))
  -- ^ Create a synchronous monotonic Double counter.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> IO (UpDownCounter Int64)
meterCreateUpDownCounterInt64 :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> IO (UpDownCounter Int64))
  -- ^ Create a synchronous Int64 up-down counter.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> IO (UpDownCounter Double)
meterCreateUpDownCounterDouble :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> IO (UpDownCounter Double))
  -- ^ Create a synchronous Double up-down counter.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> IO Histogram
meterCreateHistogram :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> IO Histogram)
  -- ^ Create a synchronous histogram.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> IO (Gauge Int64)
meterCreateGaugeInt64 :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> IO (Gauge Int64))
  -- ^ Create a synchronous Int64 gauge.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> IO (Gauge Double)
meterCreateGaugeDouble :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> IO (Gauge Double))
  -- ^ Create a synchronous Double gauge.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> [ObservableResult Int64 -> IO ()]
-> IO (ObservableCounter Int64)
meterCreateObservableCounterInt64 :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> [ObservableResult Int64 -> IO ()] -> IO (ObservableCounter Int64))
  -- ^ Create an asynchronous Int64 counter with initial callbacks.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> [ObservableResult Double -> IO ()]
-> IO (ObservableCounter Double)
meterCreateObservableCounterDouble :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> [ObservableResult Double -> IO ()] -> IO (ObservableCounter Double))
  -- ^ Create an asynchronous Double counter with initial callbacks.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> [ObservableResult Int64 -> IO ()]
-> IO (ObservableUpDownCounter Int64)
meterCreateObservableUpDownCounterInt64 :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> [ObservableResult Int64 -> IO ()] -> IO (ObservableUpDownCounter Int64))
  -- ^ Create an asynchronous Int64 up-down counter with initial callbacks.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> [ObservableResult Double -> IO ()]
-> IO (ObservableUpDownCounter Double)
meterCreateObservableUpDownCounterDouble :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> [ObservableResult Double -> IO ()] -> IO (ObservableUpDownCounter Double))
  -- ^ Create an asynchronous Double up-down counter with initial callbacks.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> [ObservableResult Int64 -> IO ()]
-> IO (ObservableGauge Int64)
meterCreateObservableGaugeInt64 :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> [ObservableResult Int64 -> IO ()] -> IO (ObservableGauge Int64))
  -- ^ Create an asynchronous Int64 gauge with initial callbacks.
  , Meter
-> Text
-> Maybe Text
-> Maybe Text
-> AdvisoryParameters
-> [ObservableResult Double -> IO ()]
-> IO (ObservableGauge Double)
meterCreateObservableGaugeDouble :: !(Text -> Maybe Text -> Maybe Text -> AdvisoryParameters -> [ObservableResult Double -> IO ()] -> IO (ObservableGauge Double))
  -- ^ Create an asynchronous Double gauge with initial callbacks.
  }


{- | Entry point for metrics API (spec: global default SHOULD exist).

@since 0.0.1.0
-}
data MeterProvider = MeterProvider
  { MeterProvider -> InstrumentationLibrary -> IO Meter
meterProviderGetMeter :: !(InstrumentationLibrary -> IO Meter)
  -- ^ Get or create a Meter for the given instrumentation scope.
  , MeterProvider -> Maybe Int -> IO ShutdownResult
meterProviderShutdown :: !(Maybe Int -> IO ShutdownResult)
  {- ^ Shut down the provider, flushing and releasing resources.
  Optional timeout in microseconds; @Nothing@ uses the SDK default (5s).
  -}
  , MeterProvider -> Maybe Int -> IO FlushResult
meterProviderForceFlush :: !(Maybe Int -> IO FlushResult)
  {- ^ Force a collection and export cycle. Optional timeout in microseconds;
  @Nothing@ uses the SDK default (5s).
  -}
  }