OpenTelemetry.Metrics_Internal

opentelemetry-0.8.0

Safe Haskell | None
Language | Haskell2010

OpenTelemetry.Metrics_Internal

Contents

- Synonyms for specific types of Instrument
- Used for indexing Instrument. All possible combinations are covered

Description

This is an internal module. The public interface is re-exported by OpenTelemetry.Eventlog

This module implements the instruments of the metrics portion of the OpenTelemetry API. It is reexported by OpenTelemetry.Eventlog and should be used by importing that.

The way to use the `Instrument` type is throught the `add`, `record` or `observe` functions (depending on the instrument type) which capture metrics on a given instrument.

Usage:

    import OpenTelemetry.Eventlog

    aCounter :: Counter
    aCounter = Counter "myCounter"

    anObserver :: ValueObserver
    anObserver = ValueObserver "myObserver"

    main :: IO ()
    main = do
      add aCounter 3
      record anObserver 40

Synopsis

- data Instrument (s :: Synchronicity) (a :: Additivity) (m :: Monotonicity) where
  - Counter :: InstrumentName -> InstrumentId -> Instrument 'Synchronous 'Additive 'Monotonic
  - UpDownCounter :: InstrumentName -> InstrumentId -> Instrument 'Synchronous 'Additive 'NonMonotonic
  - ValueRecorder :: InstrumentName -> InstrumentId -> Instrument 'Synchronous 'NonAdditive 'NonMonotonic
  - SumObserver :: InstrumentName -> InstrumentId -> Instrument 'Asynchronous 'Additive 'Monotonic
  - UpDownSumObserver :: InstrumentName -> InstrumentId -> Instrument 'Asynchronous 'Additive 'NonMonotonic
  - ValueObserver :: InstrumentName -> InstrumentId -> Instrument 'Asynchronous 'NonAdditive 'NonMonotonic
- data SomeInstrument = SomeInstrument (Instrument s a m)
- type Counter = Instrument 'Synchronous 'Additive 'Monotonic
- type UpDownCounter = Instrument 'Synchronous 'Additive 'NonMonotonic
- type ValueRecorder = Instrument 'Synchronous 'NonAdditive 'NonMonotonic
- type SumObserver = Instrument 'Asynchronous 'Additive 'Monotonic
- type UpDownSumObserver = Instrument 'Asynchronous 'Additive 'NonMonotonic
- type ValueObserver = Instrument 'Asynchronous 'NonAdditive 'NonMonotonic
- data Synchronicity
  - = Synchronous
  - | Asynchronous
- data Additivity
  - = Additive
  - | NonAdditive
- data Monotonicity
  - = Monotonic
  - | NonMonotonic
- type InstrumentName = ByteString
- type InstrumentId = Word64
- instrumentName :: forall (s :: Synchronicity) (a :: Additivity) (m :: Monotonicity). Instrument s a m -> InstrumentName
- instrumentId :: forall (s :: Synchronicity) (a :: Additivity) (m :: Monotonicity). Instrument s a m -> InstrumentId

# Documentation

data Instrument (s :: Synchronicity) (a :: Additivity) (m :: Monotonicity) where #

An OpenTelemetry instrument as defined in the OpenTelemetry Metrics API (https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/metrics/api.md)

Constructors

Counter :: InstrumentName -> InstrumentId -> Instrument 'Synchronous 'Additive 'Monotonic |
UpDownCounter :: InstrumentName -> InstrumentId -> Instrument 'Synchronous 'Additive 'NonMonotonic |
ValueRecorder :: InstrumentName -> InstrumentId -> Instrument 'Synchronous 'NonAdditive 'NonMonotonic |
SumObserver :: InstrumentName -> InstrumentId -> Instrument 'Asynchronous 'Additive 'Monotonic |
UpDownSumObserver :: InstrumentName -> InstrumentId -> Instrument 'Asynchronous 'Additive 'NonMonotonic |
ValueObserver :: InstrumentName -> InstrumentId -> Instrument 'Asynchronous 'NonAdditive 'NonMonotonic |

#### Instances

Instances details

Show (Instrument s a m) # |
Instance details Defined in OpenTelemetry.Metrics_Internal Methods showsPrec :: Int -> Instrument s a m -> ShowS # show :: Instrument s a m -> String # showList :: [Instrument s a m] -> ShowS #
Eq (Instrument s a m) # |
Instance details Defined in OpenTelemetry.Metrics_Internal Methods (==) :: Instrument s a m -> Instrument s a m -> Bool # (/=) :: Instrument s a m -> Instrument s a m -> Bool #
Hashable (Instrument s a m) # |
Instance details Defined in OpenTelemetry.Metrics_Internal Methods hashWithSalt :: Int -> Instrument s a m -> Int # hash :: Instrument s a m -> Int #

data SomeInstrument #

Existential wrapper for `Instrument`. Use when the exact type of Instrument does not matter.

Constructors

SomeInstrument (Instrument s a m) |

#### Instances

Instances details

Show SomeInstrument # |
Instance details Defined in OpenTelemetry.Metrics_Internal Methods showsPrec :: Int -> SomeInstrument -> ShowS # show :: SomeInstrument -> String # showList :: [SomeInstrument] -> ShowS #
Eq SomeInstrument # |
Instance details Defined in OpenTelemetry.Metrics_Internal Methods (==) :: SomeInstrument -> SomeInstrument -> Bool # (/=) :: SomeInstrument -> SomeInstrument -> Bool #
Hashable SomeInstrument # |
Instance details Defined in OpenTelemetry.Metrics_Internal Methods hashWithSalt :: Int -> SomeInstrument -> Int # hash :: SomeInstrument -> Int #

# Synonyms for specific types of Instrument

type Counter = Instrument 'Synchronous 'Additive 'Monotonic #

type UpDownCounter = Instrument 'Synchronous 'Additive 'NonMonotonic #

type ValueRecorder = Instrument 'Synchronous 'NonAdditive 'NonMonotonic #

type SumObserver = Instrument 'Asynchronous 'Additive 'Monotonic #

type UpDownSumObserver = Instrument 'Asynchronous 'Additive 'NonMonotonic #

type ValueObserver = Instrument 'Asynchronous 'NonAdditive 'NonMonotonic #

# Used for indexing Instrument. All possible combinations are covered

data Synchronicity #

Constructors

Synchronous |
Asynchronous |

data Additivity #

Constructors

Additive |
NonAdditive |

data Monotonicity #

Constructors

Monotonic |
NonMonotonic |

type InstrumentName = ByteString #

type InstrumentId = Word64 #

instrumentName :: forall (s :: Synchronicity) (a :: Additivity) (m :: Monotonicity). Instrument s a m -> InstrumentName #

instrumentId :: forall (s :: Synchronicity) (a :: Additivity) (m :: Monotonicity). Instrument s a m -> InstrumentId #