prometheus 0.5.0 → 2.0.0
raw patch · 6 files changed
+51/−1347 lines, 6 filesdep −lensdep −proto-lensdep −proto-lens-protocdep ~basedep ~http-typesPVP ok
version bump matches the API change (PVP)
Dependencies removed: lens, proto-lens, proto-lens-protoc
Dependency ranges changed: base, http-types
API changes (from Hackage documentation)
- System.Metrics.Prometheus.Encode.ProtocolBuffers: encodeMetrics :: RegistrySample -> Builder
- System.Metrics.Prometheus.Encode.ProtocolBuffers: instance Network.Wreq.Internal.Types.Putable System.Metrics.Prometheus.Registry.RegistrySample
- System.Metrics.Prometheus.Encode.ProtocolBuffers: metricsRequest :: RegistrySample -> Request -> Request
- System.Metrics.Prometheus.Http.Push: pushHttpProtoMetrics :: String -> Text -> Labels -> Int -> IO RegistrySample -> IO ()
+ System.Metrics.Prometheus.Http.Push: instance Network.Wreq.Internal.Types.Putable System.Metrics.Prometheus.Registry.RegistrySample
+ System.Metrics.Prometheus.Http.Push: pushHttpTextMetrics :: String -> Text -> Labels -> Int -> IO RegistrySample -> IO ()
+ System.Metrics.Prometheus.MetricId: instance GHC.Base.Semigroup System.Metrics.Prometheus.MetricId.Labels
+ System.Metrics.Prometheus.MetricId: instance GHC.Base.Semigroup System.Metrics.Prometheus.MetricId.Name
Files
- gen/Proto/Proto/Metrics.hs +0/−1195
- prometheus.cabal +6/−13
- src/System/Metrics/Prometheus/Encode/ProtocolBuffers.hs +0/−103
- src/System/Metrics/Prometheus/Encode/Text.hs +1/−14
- src/System/Metrics/Prometheus/Http/Push.hs +42/−20
- src/System/Metrics/Prometheus/MetricId.hs +2/−2
− gen/Proto/Proto/Metrics.hs
@@ -1,1195 +0,0 @@-{- This file was auto-generated from proto/metrics.proto by the proto-lens-protoc program. -}-{-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies,- UndecidableInstances, MultiParamTypeClasses, FlexibleContexts,- FlexibleInstances, PatternSynonyms, MagicHash, NoImplicitPrelude- #-}-{-# OPTIONS_GHC -fno-warn-unused-imports#-}-module Proto.Proto.Metrics where-import qualified Data.ProtoLens.Reexport.Prelude as Prelude-import qualified Data.ProtoLens.Reexport.Data.Int as Data.Int-import qualified Data.ProtoLens.Reexport.Data.Word as Data.Word-import qualified Data.ProtoLens.Reexport.Data.ProtoLens- as Data.ProtoLens-import qualified- Data.ProtoLens.Reexport.Data.ProtoLens.Message.Enum- as Data.ProtoLens.Message.Enum-import qualified Data.ProtoLens.Reexport.Lens.Family2- as Lens.Family2-import qualified Data.ProtoLens.Reexport.Lens.Family2.Unchecked- as Lens.Family2.Unchecked-import qualified Data.ProtoLens.Reexport.Data.Default.Class- as Data.Default.Class-import qualified Data.ProtoLens.Reexport.Data.Text as Data.Text-import qualified Data.ProtoLens.Reexport.Data.Map as Data.Map-import qualified Data.ProtoLens.Reexport.Data.ByteString- as Data.ByteString-import qualified Data.ProtoLens.Reexport.Lens.Labels as Lens.Labels--data Bucket = Bucket{_Bucket'cumulativeCount ::- !(Prelude.Maybe Data.Word.Word64),- _Bucket'upperBound :: !(Prelude.Maybe Prelude.Double)}- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)--instance (a ~ Data.Word.Word64, b ~ Data.Word.Word64,- Prelude.Functor f) =>- Lens.Labels.HasLens "cumulativeCount" f Bucket Bucket a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Bucket'cumulativeCount- (\ x__ y__ -> x__{_Bucket'cumulativeCount = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Data.Word.Word64,- b ~ Prelude.Maybe Data.Word.Word64, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'cumulativeCount" f Bucket Bucket a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Bucket'cumulativeCount- (\ x__ y__ -> x__{_Bucket'cumulativeCount = y__}))- Prelude.id--instance (a ~ Prelude.Double, b ~ Prelude.Double,- Prelude.Functor f) =>- Lens.Labels.HasLens "upperBound" f Bucket Bucket a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Bucket'upperBound- (\ x__ y__ -> x__{_Bucket'upperBound = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Prelude.Double,- b ~ Prelude.Maybe Prelude.Double, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'upperBound" f Bucket Bucket a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Bucket'upperBound- (\ x__ y__ -> x__{_Bucket'upperBound = y__}))- Prelude.id--instance Data.Default.Class.Default Bucket where- def- = Bucket{_Bucket'cumulativeCount = Prelude.Nothing,- _Bucket'upperBound = Prelude.Nothing}--instance Data.ProtoLens.Message Bucket where- descriptor- = let cumulativeCount__field_descriptor- = Data.ProtoLens.FieldDescriptor "cumulative_count"- (Data.ProtoLens.UInt64Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Word.Word64)- (Data.ProtoLens.OptionalField maybe'cumulativeCount)- :: Data.ProtoLens.FieldDescriptor Bucket- upperBound__field_descriptor- = Data.ProtoLens.FieldDescriptor "upper_bound"- (Data.ProtoLens.DoubleField ::- Data.ProtoLens.FieldTypeDescriptor Prelude.Double)- (Data.ProtoLens.OptionalField maybe'upperBound)- :: Data.ProtoLens.FieldDescriptor Bucket- in- Data.ProtoLens.MessageDescriptor- (Data.Text.pack "io.prometheus.client.Bucket")- (Data.Map.fromList- [(Data.ProtoLens.Tag 1, cumulativeCount__field_descriptor),- (Data.ProtoLens.Tag 2, upperBound__field_descriptor)])- (Data.Map.fromList- [("cumulative_count", cumulativeCount__field_descriptor),- ("upper_bound", upperBound__field_descriptor)])--data Counter = Counter{_Counter'value ::- !(Prelude.Maybe Prelude.Double)}- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)--instance (a ~ Prelude.Double, b ~ Prelude.Double,- Prelude.Functor f) =>- Lens.Labels.HasLens "value" f Counter Counter a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Counter'value- (\ x__ y__ -> x__{_Counter'value = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Prelude.Double,- b ~ Prelude.Maybe Prelude.Double, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'value" f Counter Counter a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Counter'value- (\ x__ y__ -> x__{_Counter'value = y__}))- Prelude.id--instance Data.Default.Class.Default Counter where- def = Counter{_Counter'value = Prelude.Nothing}--instance Data.ProtoLens.Message Counter where- descriptor- = let value__field_descriptor- = Data.ProtoLens.FieldDescriptor "value"- (Data.ProtoLens.DoubleField ::- Data.ProtoLens.FieldTypeDescriptor Prelude.Double)- (Data.ProtoLens.OptionalField maybe'value)- :: Data.ProtoLens.FieldDescriptor Counter- in- Data.ProtoLens.MessageDescriptor- (Data.Text.pack "io.prometheus.client.Counter")- (Data.Map.fromList- [(Data.ProtoLens.Tag 1, value__field_descriptor)])- (Data.Map.fromList [("value", value__field_descriptor)])--data Gauge = Gauge{_Gauge'value :: !(Prelude.Maybe Prelude.Double)}- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)--instance (a ~ Prelude.Double, b ~ Prelude.Double,- Prelude.Functor f) =>- Lens.Labels.HasLens "value" f Gauge Gauge a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Gauge'value- (\ x__ y__ -> x__{_Gauge'value = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Prelude.Double,- b ~ Prelude.Maybe Prelude.Double, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'value" f Gauge Gauge a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Gauge'value- (\ x__ y__ -> x__{_Gauge'value = y__}))- Prelude.id--instance Data.Default.Class.Default Gauge where- def = Gauge{_Gauge'value = Prelude.Nothing}--instance Data.ProtoLens.Message Gauge where- descriptor- = let value__field_descriptor- = Data.ProtoLens.FieldDescriptor "value"- (Data.ProtoLens.DoubleField ::- Data.ProtoLens.FieldTypeDescriptor Prelude.Double)- (Data.ProtoLens.OptionalField maybe'value)- :: Data.ProtoLens.FieldDescriptor Gauge- in- Data.ProtoLens.MessageDescriptor- (Data.Text.pack "io.prometheus.client.Gauge")- (Data.Map.fromList- [(Data.ProtoLens.Tag 1, value__field_descriptor)])- (Data.Map.fromList [("value", value__field_descriptor)])--data Histogram = Histogram{_Histogram'sampleCount ::- !(Prelude.Maybe Data.Word.Word64),- _Histogram'sampleSum :: !(Prelude.Maybe Prelude.Double),- _Histogram'bucket :: ![Bucket]}- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)--instance (a ~ Data.Word.Word64, b ~ Data.Word.Word64,- Prelude.Functor f) =>- Lens.Labels.HasLens "sampleCount" f Histogram Histogram a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Histogram'sampleCount- (\ x__ y__ -> x__{_Histogram'sampleCount = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Data.Word.Word64,- b ~ Prelude.Maybe Data.Word.Word64, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'sampleCount" f Histogram Histogram a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Histogram'sampleCount- (\ x__ y__ -> x__{_Histogram'sampleCount = y__}))- Prelude.id--instance (a ~ Prelude.Double, b ~ Prelude.Double,- Prelude.Functor f) =>- Lens.Labels.HasLens "sampleSum" f Histogram Histogram a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Histogram'sampleSum- (\ x__ y__ -> x__{_Histogram'sampleSum = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Prelude.Double,- b ~ Prelude.Maybe Prelude.Double, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'sampleSum" f Histogram Histogram a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Histogram'sampleSum- (\ x__ y__ -> x__{_Histogram'sampleSum = y__}))- Prelude.id--instance (a ~ [Bucket], b ~ [Bucket], Prelude.Functor f) =>- Lens.Labels.HasLens "bucket" f Histogram Histogram a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Histogram'bucket- (\ x__ y__ -> x__{_Histogram'bucket = y__}))- Prelude.id--instance Data.Default.Class.Default Histogram where- def- = Histogram{_Histogram'sampleCount = Prelude.Nothing,- _Histogram'sampleSum = Prelude.Nothing, _Histogram'bucket = []}--instance Data.ProtoLens.Message Histogram where- descriptor- = let sampleCount__field_descriptor- = Data.ProtoLens.FieldDescriptor "sample_count"- (Data.ProtoLens.UInt64Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Word.Word64)- (Data.ProtoLens.OptionalField maybe'sampleCount)- :: Data.ProtoLens.FieldDescriptor Histogram- sampleSum__field_descriptor- = Data.ProtoLens.FieldDescriptor "sample_sum"- (Data.ProtoLens.DoubleField ::- Data.ProtoLens.FieldTypeDescriptor Prelude.Double)- (Data.ProtoLens.OptionalField maybe'sampleSum)- :: Data.ProtoLens.FieldDescriptor Histogram- bucket__field_descriptor- = Data.ProtoLens.FieldDescriptor "bucket"- (Data.ProtoLens.MessageField ::- Data.ProtoLens.FieldTypeDescriptor Bucket)- (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked bucket)- :: Data.ProtoLens.FieldDescriptor Histogram- in- Data.ProtoLens.MessageDescriptor- (Data.Text.pack "io.prometheus.client.Histogram")- (Data.Map.fromList- [(Data.ProtoLens.Tag 1, sampleCount__field_descriptor),- (Data.ProtoLens.Tag 2, sampleSum__field_descriptor),- (Data.ProtoLens.Tag 3, bucket__field_descriptor)])- (Data.Map.fromList- [("sample_count", sampleCount__field_descriptor),- ("sample_sum", sampleSum__field_descriptor),- ("bucket", bucket__field_descriptor)])--data LabelPair = LabelPair{_LabelPair'name ::- !(Prelude.Maybe Data.Text.Text),- _LabelPair'value :: !(Prelude.Maybe Data.Text.Text)}- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)--instance (a ~ Data.Text.Text, b ~ Data.Text.Text,- Prelude.Functor f) =>- Lens.Labels.HasLens "name" f LabelPair LabelPair a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _LabelPair'name- (\ x__ y__ -> x__{_LabelPair'name = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Data.Text.Text,- b ~ Prelude.Maybe Data.Text.Text, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'name" f LabelPair LabelPair a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _LabelPair'name- (\ x__ y__ -> x__{_LabelPair'name = y__}))- Prelude.id--instance (a ~ Data.Text.Text, b ~ Data.Text.Text,- Prelude.Functor f) =>- Lens.Labels.HasLens "value" f LabelPair LabelPair a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _LabelPair'value- (\ x__ y__ -> x__{_LabelPair'value = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Data.Text.Text,- b ~ Prelude.Maybe Data.Text.Text, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'value" f LabelPair LabelPair a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _LabelPair'value- (\ x__ y__ -> x__{_LabelPair'value = y__}))- Prelude.id--instance Data.Default.Class.Default LabelPair where- def- = LabelPair{_LabelPair'name = Prelude.Nothing,- _LabelPair'value = Prelude.Nothing}--instance Data.ProtoLens.Message LabelPair where- descriptor- = let name__field_descriptor- = Data.ProtoLens.FieldDescriptor "name"- (Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.OptionalField maybe'name)- :: Data.ProtoLens.FieldDescriptor LabelPair- value__field_descriptor- = Data.ProtoLens.FieldDescriptor "value"- (Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.OptionalField maybe'value)- :: Data.ProtoLens.FieldDescriptor LabelPair- in- Data.ProtoLens.MessageDescriptor- (Data.Text.pack "io.prometheus.client.LabelPair")- (Data.Map.fromList- [(Data.ProtoLens.Tag 1, name__field_descriptor),- (Data.ProtoLens.Tag 2, value__field_descriptor)])- (Data.Map.fromList- [("name", name__field_descriptor),- ("value", value__field_descriptor)])--data Metric = Metric{_Metric'label :: ![LabelPair],- _Metric'gauge :: !(Prelude.Maybe Gauge),- _Metric'counter :: !(Prelude.Maybe Counter),- _Metric'summary :: !(Prelude.Maybe Summary),- _Metric'untyped :: !(Prelude.Maybe Untyped),- _Metric'histogram :: !(Prelude.Maybe Histogram),- _Metric'timestampMs :: !(Prelude.Maybe Data.Int.Int64)}- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)--instance (a ~ [LabelPair], b ~ [LabelPair], Prelude.Functor f) =>- Lens.Labels.HasLens "label" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'label- (\ x__ y__ -> x__{_Metric'label = y__}))- Prelude.id--instance (a ~ Gauge, b ~ Gauge, Prelude.Functor f) =>- Lens.Labels.HasLens "gauge" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'gauge- (\ x__ y__ -> x__{_Metric'gauge = y__}))- (Data.ProtoLens.maybeLens Data.Default.Class.def)--instance (a ~ Prelude.Maybe Gauge, b ~ Prelude.Maybe Gauge,- Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'gauge" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'gauge- (\ x__ y__ -> x__{_Metric'gauge = y__}))- Prelude.id--instance (a ~ Counter, b ~ Counter, Prelude.Functor f) =>- Lens.Labels.HasLens "counter" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'counter- (\ x__ y__ -> x__{_Metric'counter = y__}))- (Data.ProtoLens.maybeLens Data.Default.Class.def)--instance (a ~ Prelude.Maybe Counter, b ~ Prelude.Maybe Counter,- Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'counter" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'counter- (\ x__ y__ -> x__{_Metric'counter = y__}))- Prelude.id--instance (a ~ Summary, b ~ Summary, Prelude.Functor f) =>- Lens.Labels.HasLens "summary" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'summary- (\ x__ y__ -> x__{_Metric'summary = y__}))- (Data.ProtoLens.maybeLens Data.Default.Class.def)--instance (a ~ Prelude.Maybe Summary, b ~ Prelude.Maybe Summary,- Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'summary" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'summary- (\ x__ y__ -> x__{_Metric'summary = y__}))- Prelude.id--instance (a ~ Untyped, b ~ Untyped, Prelude.Functor f) =>- Lens.Labels.HasLens "untyped" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'untyped- (\ x__ y__ -> x__{_Metric'untyped = y__}))- (Data.ProtoLens.maybeLens Data.Default.Class.def)--instance (a ~ Prelude.Maybe Untyped, b ~ Prelude.Maybe Untyped,- Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'untyped" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'untyped- (\ x__ y__ -> x__{_Metric'untyped = y__}))- Prelude.id--instance (a ~ Histogram, b ~ Histogram, Prelude.Functor f) =>- Lens.Labels.HasLens "histogram" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'histogram- (\ x__ y__ -> x__{_Metric'histogram = y__}))- (Data.ProtoLens.maybeLens Data.Default.Class.def)--instance (a ~ Prelude.Maybe Histogram, b ~ Prelude.Maybe Histogram,- Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'histogram" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'histogram- (\ x__ y__ -> x__{_Metric'histogram = y__}))- Prelude.id--instance (a ~ Data.Int.Int64, b ~ Data.Int.Int64,- Prelude.Functor f) =>- Lens.Labels.HasLens "timestampMs" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'timestampMs- (\ x__ y__ -> x__{_Metric'timestampMs = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Data.Int.Int64,- b ~ Prelude.Maybe Data.Int.Int64, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'timestampMs" f Metric Metric a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Metric'timestampMs- (\ x__ y__ -> x__{_Metric'timestampMs = y__}))- Prelude.id--instance Data.Default.Class.Default Metric where- def- = Metric{_Metric'label = [], _Metric'gauge = Prelude.Nothing,- _Metric'counter = Prelude.Nothing,- _Metric'summary = Prelude.Nothing,- _Metric'untyped = Prelude.Nothing,- _Metric'histogram = Prelude.Nothing,- _Metric'timestampMs = Prelude.Nothing}--instance Data.ProtoLens.Message Metric where- descriptor- = let label__field_descriptor- = Data.ProtoLens.FieldDescriptor "label"- (Data.ProtoLens.MessageField ::- Data.ProtoLens.FieldTypeDescriptor LabelPair)- (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked label)- :: Data.ProtoLens.FieldDescriptor Metric- gauge__field_descriptor- = Data.ProtoLens.FieldDescriptor "gauge"- (Data.ProtoLens.MessageField ::- Data.ProtoLens.FieldTypeDescriptor Gauge)- (Data.ProtoLens.OptionalField maybe'gauge)- :: Data.ProtoLens.FieldDescriptor Metric- counter__field_descriptor- = Data.ProtoLens.FieldDescriptor "counter"- (Data.ProtoLens.MessageField ::- Data.ProtoLens.FieldTypeDescriptor Counter)- (Data.ProtoLens.OptionalField maybe'counter)- :: Data.ProtoLens.FieldDescriptor Metric- summary__field_descriptor- = Data.ProtoLens.FieldDescriptor "summary"- (Data.ProtoLens.MessageField ::- Data.ProtoLens.FieldTypeDescriptor Summary)- (Data.ProtoLens.OptionalField maybe'summary)- :: Data.ProtoLens.FieldDescriptor Metric- untyped__field_descriptor- = Data.ProtoLens.FieldDescriptor "untyped"- (Data.ProtoLens.MessageField ::- Data.ProtoLens.FieldTypeDescriptor Untyped)- (Data.ProtoLens.OptionalField maybe'untyped)- :: Data.ProtoLens.FieldDescriptor Metric- histogram__field_descriptor- = Data.ProtoLens.FieldDescriptor "histogram"- (Data.ProtoLens.MessageField ::- Data.ProtoLens.FieldTypeDescriptor Histogram)- (Data.ProtoLens.OptionalField maybe'histogram)- :: Data.ProtoLens.FieldDescriptor Metric- timestampMs__field_descriptor- = Data.ProtoLens.FieldDescriptor "timestamp_ms"- (Data.ProtoLens.Int64Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Int.Int64)- (Data.ProtoLens.OptionalField maybe'timestampMs)- :: Data.ProtoLens.FieldDescriptor Metric- in- Data.ProtoLens.MessageDescriptor- (Data.Text.pack "io.prometheus.client.Metric")- (Data.Map.fromList- [(Data.ProtoLens.Tag 1, label__field_descriptor),- (Data.ProtoLens.Tag 2, gauge__field_descriptor),- (Data.ProtoLens.Tag 3, counter__field_descriptor),- (Data.ProtoLens.Tag 4, summary__field_descriptor),- (Data.ProtoLens.Tag 5, untyped__field_descriptor),- (Data.ProtoLens.Tag 7, histogram__field_descriptor),- (Data.ProtoLens.Tag 6, timestampMs__field_descriptor)])- (Data.Map.fromList- [("label", label__field_descriptor),- ("gauge", gauge__field_descriptor),- ("counter", counter__field_descriptor),- ("summary", summary__field_descriptor),- ("untyped", untyped__field_descriptor),- ("histogram", histogram__field_descriptor),- ("timestamp_ms", timestampMs__field_descriptor)])--data MetricFamily = MetricFamily{_MetricFamily'name ::- !(Prelude.Maybe Data.Text.Text),- _MetricFamily'help :: !(Prelude.Maybe Data.Text.Text),- _MetricFamily'type' :: !(Prelude.Maybe MetricType),- _MetricFamily'metric :: ![Metric]}- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)--instance (a ~ Data.Text.Text, b ~ Data.Text.Text,- Prelude.Functor f) =>- Lens.Labels.HasLens "name" f MetricFamily MetricFamily a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _MetricFamily'name- (\ x__ y__ -> x__{_MetricFamily'name = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Data.Text.Text,- b ~ Prelude.Maybe Data.Text.Text, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'name" f MetricFamily MetricFamily a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _MetricFamily'name- (\ x__ y__ -> x__{_MetricFamily'name = y__}))- Prelude.id--instance (a ~ Data.Text.Text, b ~ Data.Text.Text,- Prelude.Functor f) =>- Lens.Labels.HasLens "help" f MetricFamily MetricFamily a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _MetricFamily'help- (\ x__ y__ -> x__{_MetricFamily'help = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Data.Text.Text,- b ~ Prelude.Maybe Data.Text.Text, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'help" f MetricFamily MetricFamily a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _MetricFamily'help- (\ x__ y__ -> x__{_MetricFamily'help = y__}))- Prelude.id--instance (a ~ MetricType, b ~ MetricType, Prelude.Functor f) =>- Lens.Labels.HasLens "type'" f MetricFamily MetricFamily a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _MetricFamily'type'- (\ x__ y__ -> x__{_MetricFamily'type' = y__}))- (Data.ProtoLens.maybeLens Data.Default.Class.def)--instance (a ~ Prelude.Maybe MetricType,- b ~ Prelude.Maybe MetricType, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'type'" f MetricFamily MetricFamily a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _MetricFamily'type'- (\ x__ y__ -> x__{_MetricFamily'type' = y__}))- Prelude.id--instance (a ~ [Metric], b ~ [Metric], Prelude.Functor f) =>- Lens.Labels.HasLens "metric" f MetricFamily MetricFamily a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _MetricFamily'metric- (\ x__ y__ -> x__{_MetricFamily'metric = y__}))- Prelude.id--instance Data.Default.Class.Default MetricFamily where- def- = MetricFamily{_MetricFamily'name = Prelude.Nothing,- _MetricFamily'help = Prelude.Nothing,- _MetricFamily'type' = Prelude.Nothing, _MetricFamily'metric = []}--instance Data.ProtoLens.Message MetricFamily where- descriptor- = let name__field_descriptor- = Data.ProtoLens.FieldDescriptor "name"- (Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.OptionalField maybe'name)- :: Data.ProtoLens.FieldDescriptor MetricFamily- help__field_descriptor- = Data.ProtoLens.FieldDescriptor "help"- (Data.ProtoLens.StringField ::- Data.ProtoLens.FieldTypeDescriptor Data.Text.Text)- (Data.ProtoLens.OptionalField maybe'help)- :: Data.ProtoLens.FieldDescriptor MetricFamily- type'__field_descriptor- = Data.ProtoLens.FieldDescriptor "type"- (Data.ProtoLens.EnumField ::- Data.ProtoLens.FieldTypeDescriptor MetricType)- (Data.ProtoLens.OptionalField maybe'type')- :: Data.ProtoLens.FieldDescriptor MetricFamily- metric__field_descriptor- = Data.ProtoLens.FieldDescriptor "metric"- (Data.ProtoLens.MessageField ::- Data.ProtoLens.FieldTypeDescriptor Metric)- (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked metric)- :: Data.ProtoLens.FieldDescriptor MetricFamily- in- Data.ProtoLens.MessageDescriptor- (Data.Text.pack "io.prometheus.client.MetricFamily")- (Data.Map.fromList- [(Data.ProtoLens.Tag 1, name__field_descriptor),- (Data.ProtoLens.Tag 2, help__field_descriptor),- (Data.ProtoLens.Tag 3, type'__field_descriptor),- (Data.ProtoLens.Tag 4, metric__field_descriptor)])- (Data.Map.fromList- [("name", name__field_descriptor),- ("help", help__field_descriptor),- ("type", type'__field_descriptor),- ("metric", metric__field_descriptor)])--data MetricType = COUNTER- | GAUGE- | SUMMARY- | UNTYPED- | HISTOGRAM- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)--instance Data.Default.Class.Default MetricType where- def = COUNTER--instance Data.ProtoLens.FieldDefault MetricType where- fieldDefault = COUNTER--instance Data.ProtoLens.MessageEnum MetricType where- maybeToEnum 0 = Prelude.Just COUNTER- maybeToEnum 1 = Prelude.Just GAUGE- maybeToEnum 2 = Prelude.Just SUMMARY- maybeToEnum 3 = Prelude.Just UNTYPED- maybeToEnum 4 = Prelude.Just HISTOGRAM- maybeToEnum _ = Prelude.Nothing- showEnum COUNTER = "COUNTER"- showEnum GAUGE = "GAUGE"- showEnum SUMMARY = "SUMMARY"- showEnum UNTYPED = "UNTYPED"- showEnum HISTOGRAM = "HISTOGRAM"- readEnum "COUNTER" = Prelude.Just COUNTER- readEnum "GAUGE" = Prelude.Just GAUGE- readEnum "SUMMARY" = Prelude.Just SUMMARY- readEnum "UNTYPED" = Prelude.Just UNTYPED- readEnum "HISTOGRAM" = Prelude.Just HISTOGRAM- readEnum _ = Prelude.Nothing--instance Prelude.Enum MetricType where- toEnum k__- = Prelude.maybe- (Prelude.error- ((Prelude.++) "toEnum: unknown value for enum MetricType: "- (Prelude.show k__)))- Prelude.id- (Data.ProtoLens.maybeToEnum k__)- fromEnum COUNTER = 0- fromEnum GAUGE = 1- fromEnum SUMMARY = 2- fromEnum UNTYPED = 3- fromEnum HISTOGRAM = 4- succ HISTOGRAM- = Prelude.error- "MetricType.succ: bad argument HISTOGRAM. This value would be out of bounds."- succ COUNTER = GAUGE- succ GAUGE = SUMMARY- succ SUMMARY = UNTYPED- succ UNTYPED = HISTOGRAM- pred COUNTER- = Prelude.error- "MetricType.pred: bad argument COUNTER. This value would be out of bounds."- pred GAUGE = COUNTER- pred SUMMARY = GAUGE- pred UNTYPED = SUMMARY- pred HISTOGRAM = UNTYPED- enumFrom = Data.ProtoLens.Message.Enum.messageEnumFrom- enumFromTo = Data.ProtoLens.Message.Enum.messageEnumFromTo- enumFromThen = Data.ProtoLens.Message.Enum.messageEnumFromThen- enumFromThenTo = Data.ProtoLens.Message.Enum.messageEnumFromThenTo--instance Prelude.Bounded MetricType where- minBound = COUNTER- maxBound = HISTOGRAM--data Quantile = Quantile{_Quantile'quantile ::- !(Prelude.Maybe Prelude.Double),- _Quantile'value :: !(Prelude.Maybe Prelude.Double)}- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)--instance (a ~ Prelude.Double, b ~ Prelude.Double,- Prelude.Functor f) =>- Lens.Labels.HasLens "quantile" f Quantile Quantile a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Quantile'quantile- (\ x__ y__ -> x__{_Quantile'quantile = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Prelude.Double,- b ~ Prelude.Maybe Prelude.Double, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'quantile" f Quantile Quantile a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Quantile'quantile- (\ x__ y__ -> x__{_Quantile'quantile = y__}))- Prelude.id--instance (a ~ Prelude.Double, b ~ Prelude.Double,- Prelude.Functor f) =>- Lens.Labels.HasLens "value" f Quantile Quantile a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Quantile'value- (\ x__ y__ -> x__{_Quantile'value = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Prelude.Double,- b ~ Prelude.Maybe Prelude.Double, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'value" f Quantile Quantile a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Quantile'value- (\ x__ y__ -> x__{_Quantile'value = y__}))- Prelude.id--instance Data.Default.Class.Default Quantile where- def- = Quantile{_Quantile'quantile = Prelude.Nothing,- _Quantile'value = Prelude.Nothing}--instance Data.ProtoLens.Message Quantile where- descriptor- = let quantile__field_descriptor- = Data.ProtoLens.FieldDescriptor "quantile"- (Data.ProtoLens.DoubleField ::- Data.ProtoLens.FieldTypeDescriptor Prelude.Double)- (Data.ProtoLens.OptionalField maybe'quantile)- :: Data.ProtoLens.FieldDescriptor Quantile- value__field_descriptor- = Data.ProtoLens.FieldDescriptor "value"- (Data.ProtoLens.DoubleField ::- Data.ProtoLens.FieldTypeDescriptor Prelude.Double)- (Data.ProtoLens.OptionalField maybe'value)- :: Data.ProtoLens.FieldDescriptor Quantile- in- Data.ProtoLens.MessageDescriptor- (Data.Text.pack "io.prometheus.client.Quantile")- (Data.Map.fromList- [(Data.ProtoLens.Tag 1, quantile__field_descriptor),- (Data.ProtoLens.Tag 2, value__field_descriptor)])- (Data.Map.fromList- [("quantile", quantile__field_descriptor),- ("value", value__field_descriptor)])--data Summary = Summary{_Summary'sampleCount ::- !(Prelude.Maybe Data.Word.Word64),- _Summary'sampleSum :: !(Prelude.Maybe Prelude.Double),- _Summary'quantile :: ![Quantile]}- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)--instance (a ~ Data.Word.Word64, b ~ Data.Word.Word64,- Prelude.Functor f) =>- Lens.Labels.HasLens "sampleCount" f Summary Summary a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Summary'sampleCount- (\ x__ y__ -> x__{_Summary'sampleCount = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Data.Word.Word64,- b ~ Prelude.Maybe Data.Word.Word64, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'sampleCount" f Summary Summary a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Summary'sampleCount- (\ x__ y__ -> x__{_Summary'sampleCount = y__}))- Prelude.id--instance (a ~ Prelude.Double, b ~ Prelude.Double,- Prelude.Functor f) =>- Lens.Labels.HasLens "sampleSum" f Summary Summary a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Summary'sampleSum- (\ x__ y__ -> x__{_Summary'sampleSum = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Prelude.Double,- b ~ Prelude.Maybe Prelude.Double, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'sampleSum" f Summary Summary a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Summary'sampleSum- (\ x__ y__ -> x__{_Summary'sampleSum = y__}))- Prelude.id--instance (a ~ [Quantile], b ~ [Quantile], Prelude.Functor f) =>- Lens.Labels.HasLens "quantile" f Summary Summary a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Summary'quantile- (\ x__ y__ -> x__{_Summary'quantile = y__}))- Prelude.id--instance Data.Default.Class.Default Summary where- def- = Summary{_Summary'sampleCount = Prelude.Nothing,- _Summary'sampleSum = Prelude.Nothing, _Summary'quantile = []}--instance Data.ProtoLens.Message Summary where- descriptor- = let sampleCount__field_descriptor- = Data.ProtoLens.FieldDescriptor "sample_count"- (Data.ProtoLens.UInt64Field ::- Data.ProtoLens.FieldTypeDescriptor Data.Word.Word64)- (Data.ProtoLens.OptionalField maybe'sampleCount)- :: Data.ProtoLens.FieldDescriptor Summary- sampleSum__field_descriptor- = Data.ProtoLens.FieldDescriptor "sample_sum"- (Data.ProtoLens.DoubleField ::- Data.ProtoLens.FieldTypeDescriptor Prelude.Double)- (Data.ProtoLens.OptionalField maybe'sampleSum)- :: Data.ProtoLens.FieldDescriptor Summary- quantile__field_descriptor- = Data.ProtoLens.FieldDescriptor "quantile"- (Data.ProtoLens.MessageField ::- Data.ProtoLens.FieldTypeDescriptor Quantile)- (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked quantile)- :: Data.ProtoLens.FieldDescriptor Summary- in- Data.ProtoLens.MessageDescriptor- (Data.Text.pack "io.prometheus.client.Summary")- (Data.Map.fromList- [(Data.ProtoLens.Tag 1, sampleCount__field_descriptor),- (Data.ProtoLens.Tag 2, sampleSum__field_descriptor),- (Data.ProtoLens.Tag 3, quantile__field_descriptor)])- (Data.Map.fromList- [("sample_count", sampleCount__field_descriptor),- ("sample_sum", sampleSum__field_descriptor),- ("quantile", quantile__field_descriptor)])--data Untyped = Untyped{_Untyped'value ::- !(Prelude.Maybe Prelude.Double)}- deriving (Prelude.Show, Prelude.Eq, Prelude.Ord)--instance (a ~ Prelude.Double, b ~ Prelude.Double,- Prelude.Functor f) =>- Lens.Labels.HasLens "value" f Untyped Untyped a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Untyped'value- (\ x__ y__ -> x__{_Untyped'value = y__}))- (Data.ProtoLens.maybeLens Data.ProtoLens.fieldDefault)--instance (a ~ Prelude.Maybe Prelude.Double,- b ~ Prelude.Maybe Prelude.Double, Prelude.Functor f) =>- Lens.Labels.HasLens "maybe'value" f Untyped Untyped a b- where- lensOf _- = (Prelude..)- (Lens.Family2.Unchecked.lens _Untyped'value- (\ x__ y__ -> x__{_Untyped'value = y__}))- Prelude.id--instance Data.Default.Class.Default Untyped where- def = Untyped{_Untyped'value = Prelude.Nothing}--instance Data.ProtoLens.Message Untyped where- descriptor- = let value__field_descriptor- = Data.ProtoLens.FieldDescriptor "value"- (Data.ProtoLens.DoubleField ::- Data.ProtoLens.FieldTypeDescriptor Prelude.Double)- (Data.ProtoLens.OptionalField maybe'value)- :: Data.ProtoLens.FieldDescriptor Untyped- in- Data.ProtoLens.MessageDescriptor- (Data.Text.pack "io.prometheus.client.Untyped")- (Data.Map.fromList- [(Data.ProtoLens.Tag 1, value__field_descriptor)])- (Data.Map.fromList [("value", value__field_descriptor)])--bucket ::- forall f s t a b . (Lens.Labels.HasLens "bucket" f s t a b) =>- Lens.Family2.LensLike f s t a b-bucket- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "bucket")--counter ::- forall f s t a b . (Lens.Labels.HasLens "counter" f s t a b) =>- Lens.Family2.LensLike f s t a b-counter- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "counter")--cumulativeCount ::- forall f s t a b .- (Lens.Labels.HasLens "cumulativeCount" f s t a b) =>- Lens.Family2.LensLike f s t a b-cumulativeCount- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "cumulativeCount")--gauge ::- forall f s t a b . (Lens.Labels.HasLens "gauge" f s t a b) =>- Lens.Family2.LensLike f s t a b-gauge- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "gauge")--help ::- forall f s t a b . (Lens.Labels.HasLens "help" f s t a b) =>- Lens.Family2.LensLike f s t a b-help- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "help")--histogram ::- forall f s t a b . (Lens.Labels.HasLens "histogram" f s t a b) =>- Lens.Family2.LensLike f s t a b-histogram- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "histogram")--label ::- forall f s t a b . (Lens.Labels.HasLens "label" f s t a b) =>- Lens.Family2.LensLike f s t a b-label- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "label")--maybe'counter ::- forall f s t a b .- (Lens.Labels.HasLens "maybe'counter" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'counter- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'counter")--maybe'cumulativeCount ::- forall f s t a b .- (Lens.Labels.HasLens "maybe'cumulativeCount" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'cumulativeCount- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) ::- (Lens.Labels.Proxy#) "maybe'cumulativeCount")--maybe'gauge ::- forall f s t a b . (Lens.Labels.HasLens "maybe'gauge" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'gauge- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'gauge")--maybe'help ::- forall f s t a b . (Lens.Labels.HasLens "maybe'help" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'help- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'help")--maybe'histogram ::- forall f s t a b .- (Lens.Labels.HasLens "maybe'histogram" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'histogram- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'histogram")--maybe'name ::- forall f s t a b . (Lens.Labels.HasLens "maybe'name" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'name- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'name")--maybe'quantile ::- forall f s t a b .- (Lens.Labels.HasLens "maybe'quantile" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'quantile- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'quantile")--maybe'sampleCount ::- forall f s t a b .- (Lens.Labels.HasLens "maybe'sampleCount" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'sampleCount- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'sampleCount")--maybe'sampleSum ::- forall f s t a b .- (Lens.Labels.HasLens "maybe'sampleSum" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'sampleSum- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'sampleSum")--maybe'summary ::- forall f s t a b .- (Lens.Labels.HasLens "maybe'summary" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'summary- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'summary")--maybe'timestampMs ::- forall f s t a b .- (Lens.Labels.HasLens "maybe'timestampMs" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'timestampMs- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'timestampMs")--maybe'type' ::- forall f s t a b . (Lens.Labels.HasLens "maybe'type'" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'type'- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'type'")--maybe'untyped ::- forall f s t a b .- (Lens.Labels.HasLens "maybe'untyped" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'untyped- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'untyped")--maybe'upperBound ::- forall f s t a b .- (Lens.Labels.HasLens "maybe'upperBound" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'upperBound- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'upperBound")--maybe'value ::- forall f s t a b . (Lens.Labels.HasLens "maybe'value" f s t a b) =>- Lens.Family2.LensLike f s t a b-maybe'value- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "maybe'value")--metric ::- forall f s t a b . (Lens.Labels.HasLens "metric" f s t a b) =>- Lens.Family2.LensLike f s t a b-metric- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "metric")--name ::- forall f s t a b . (Lens.Labels.HasLens "name" f s t a b) =>- Lens.Family2.LensLike f s t a b-name- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "name")--quantile ::- forall f s t a b . (Lens.Labels.HasLens "quantile" f s t a b) =>- Lens.Family2.LensLike f s t a b-quantile- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "quantile")--sampleCount ::- forall f s t a b . (Lens.Labels.HasLens "sampleCount" f s t a b) =>- Lens.Family2.LensLike f s t a b-sampleCount- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "sampleCount")--sampleSum ::- forall f s t a b . (Lens.Labels.HasLens "sampleSum" f s t a b) =>- Lens.Family2.LensLike f s t a b-sampleSum- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "sampleSum")--summary ::- forall f s t a b . (Lens.Labels.HasLens "summary" f s t a b) =>- Lens.Family2.LensLike f s t a b-summary- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "summary")--timestampMs ::- forall f s t a b . (Lens.Labels.HasLens "timestampMs" f s t a b) =>- Lens.Family2.LensLike f s t a b-timestampMs- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "timestampMs")--type' ::- forall f s t a b . (Lens.Labels.HasLens "type'" f s t a b) =>- Lens.Family2.LensLike f s t a b-type'- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "type'")--untyped ::- forall f s t a b . (Lens.Labels.HasLens "untyped" f s t a b) =>- Lens.Family2.LensLike f s t a b-untyped- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "untyped")--upperBound ::- forall f s t a b . (Lens.Labels.HasLens "upperBound" f s t a b) =>- Lens.Family2.LensLike f s t a b-upperBound- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "upperBound")--value ::- forall f s t a b . (Lens.Labels.HasLens "value" f s t a b) =>- Lens.Family2.LensLike f s t a b-value- = Lens.Labels.lensOf- ((Lens.Labels.proxy#) :: (Lens.Labels.Proxy#) "value")
prometheus.cabal view
@@ -1,5 +1,5 @@ name: prometheus-version: 0.5.0+version: 2.0.0 synopsis: Prometheus Haskell Client homepage: http://github.com/bitnomial/prometheus bug-reports: http://github.com/bitnomial/prometheus/issues@@ -7,7 +7,7 @@ license-file: LICENSE author: Luke Hoersten maintainer: luke@bitnomial.com, opensource@bitnomial.com-copyright: Bitnomial, Inc. (c) 2016+copyright: Bitnomial, Inc. (c) 2016-2018 category: Metrics, Monitoring, Web, System build-type: Simple cabal-version: >=1.10@@ -55,15 +55,13 @@ , README.md library- hs-source-dirs: gen- , src- default-language: Haskell2010+ hs-source-dirs: src+ default-language: Haskell2010 ghc-options: -Wall -fwarn-tabs -fno-warn-unused-do-bind exposed-modules: System.Metrics.Prometheus.Concurrent.Registry , System.Metrics.Prometheus.Concurrent.RegistryT- , System.Metrics.Prometheus.Encode.ProtocolBuffers , System.Metrics.Prometheus.Encode.Text , System.Metrics.Prometheus.Encode.Text.Histogram , System.Metrics.Prometheus.Encode.Text.MetricId@@ -78,17 +76,12 @@ , System.Metrics.Prometheus.Registry , System.Metrics.Prometheus.RegistryT - other-modules: Proto.Proto.Metrics-- build-depends: base >= 4.7 && < 4.11+ build-depends: base >= 4.7 && < 4.12 , atomic-primops >= 0.8 && < 0.9 , bytestring >= 0.10 && < 0.11 , containers >= 0.5 && < 0.6 , http-client >= 0.5 && < 0.6- , http-types >= 0.8 && < 0.10- , lens >= 4.15 && < 4.16- , proto-lens >= 0.2 && < 0.3- , proto-lens-protoc >= 0.2 && < 0.3+ , http-types >= 0.8 && < 0.13 , text >= 1.2 && < 1.3 , transformers >= 0.4 && < 0.6 , wai >= 3.2 && < 3.3
− src/System/Metrics/Prometheus/Encode/ProtocolBuffers.hs
@@ -1,103 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module System.Metrics.Prometheus.Encode.ProtocolBuffers- ( encodeMetrics- , metricsRequest- ) where--import Control.Lens.Operators-import Data.ByteString.Lazy.Builder (Builder,- toLazyByteString)-import qualified Data.Map as Map-import Data.ProtoLens (def)-import Data.ProtoLens.Encoding (buildMessage)-import Network.HTTP.Client (Request,- RequestBody (..),- requestBody,- requestHeaders)-import Network.Wreq.Types (Putable (..))-import qualified Proto.Proto.Metrics as Proto--import System.Metrics.Prometheus.Metric (MetricSample (..))-import qualified System.Metrics.Prometheus.Metric.Counter as Counter-import qualified System.Metrics.Prometheus.Metric.Gauge as Gauge-import qualified System.Metrics.Prometheus.Metric.Histogram as Histogram-import qualified System.Metrics.Prometheus.Metric.Summary as Summary-import System.Metrics.Prometheus.MetricId (Labels (..),- MetricId (MetricId),- Name (..))-import System.Metrics.Prometheus.Registry (RegistrySample (..))---instance Putable RegistrySample where- putPayload = (pure .) . metricsRequest---metricsRequest :: RegistrySample -> Request -> Request-metricsRequest s req = req- { requestBody = RequestBodyLBS . toLazyByteString $ encodeMetrics s- , requestHeaders = contentType : requestHeaders req- }- where contentType =- ( "Content-Type"- , "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited"- )---encodeMetrics :: RegistrySample -> Builder-encodeMetrics = Map.foldMapWithKey ((buildMessage .) . encodeMetric) . unRegistrySample---encodeMetric :: MetricId -> MetricSample -> Proto.MetricFamily-encodeMetric (MetricId (Name name) (Labels labels)) = go- where- base :: Proto.MetricFamily- base = def & Proto.name .~ name- baseMetric = def & Proto.label .~ labels'- labels' =- Map.foldrWithKey- (\n v -> ((def & Proto.name .~ n & Proto.value .~ v) :))- []- labels- go (CounterMetricSample (Counter.CounterSample i)) =- base & Proto.type' .~ Proto.COUNTER- & Proto.metric .~- [ baseMetric & Proto.counter . Proto.value .~- fromIntegral i- ]- go (GaugeMetricSample (Gauge.GaugeSample i)) =- base & Proto.type' .~ Proto.GAUGE- & Proto.metric .~- [ baseMetric & Proto.gauge . Proto.value .~ i- ]- go (HistogramMetricSample (Histogram.HistogramSample buckets s count)) =- base & Proto.type' .~ Proto.HISTOGRAM- & Proto.metric .~- [ baseMetric & Proto.histogram .~- (def & Proto.sampleCount .~ fromIntegral count- & Proto.sampleSum .~ s- & Proto.bucket .~- Map.foldrWithKey- (\ub c -> ((def & Proto.cumulativeCount .~- round c- & Proto.upperBound .~ ub- ) :))- []- buckets- )- ]- go (SummaryMetricSample (Summary.SummarySample quantiles s count)) =- base & Proto.type' .~ Proto.SUMMARY- & Proto.metric .~- [ baseMetric & Proto.summary .~- (def & Proto.sampleCount .~ fromIntegral count- & Proto.sampleSum .~ fromIntegral s- & Proto.quantile .~- Map.foldrWithKey- (\q v -> ((def & Proto.quantile .~ q- & Proto.value .~ fromIntegral v- ) :))- []- quantiles- )- ]
src/System/Metrics/Prometheus/Encode/Text.hs view
@@ -1,18 +1,13 @@-{-# LANGUAGE OverloadedStrings #-}- module System.Metrics.Prometheus.Encode.Text ( encodeMetrics ) where -import Data.ByteString.Builder (Builder, toLazyByteString)+import Data.ByteString.Builder (Builder) import Data.Function (on) import Data.List (groupBy, intersperse) import qualified Data.Map as Map import Data.Monoid ((<>))-import Network.HTTP.Client (Request, RequestBody (..),- requestBody,- requestHeaders) import System.Metrics.Prometheus.Encode.Text.Histogram (encodeHistogram) import System.Metrics.Prometheus.Encode.Text.MetricId (encodeDouble,@@ -27,14 +22,6 @@ import System.Metrics.Prometheus.Metric.Gauge (GaugeSample (..)) import System.Metrics.Prometheus.MetricId (MetricId (..)) import System.Metrics.Prometheus.Registry (RegistrySample (..))---metricsRequest :: RegistrySample -> Request -> Request-metricsRequest s req = req- { requestBody = RequestBodyLBS . toLazyByteString $ encodeMetrics s- , requestHeaders = contentType : requestHeaders req- }- where contentType = ("Content-Type", "text/plain; version=0.0.4") encodeMetrics :: RegistrySample -> Builder
src/System/Metrics/Prometheus/Http/Push.hs view
@@ -1,28 +1,50 @@+{-# LANGUAGE OverloadedStrings #-}+ module System.Metrics.Prometheus.Http.Push- ( pushHttpProtoMetrics+ ( pushHttpTextMetrics ) where -import Control.Concurrent (threadDelay)-import Control.Monad (forever)-import Data.Map (foldMapWithKey)-import Data.Text (Text, unpack)-import Network.Wreq.Session (put,- withSession)-import System.Metrics.Prometheus.Encode.ProtocolBuffers ()-import System.Metrics.Prometheus.MetricId (Labels (..))-import System.Metrics.Prometheus.Registry (RegistrySample)+import Control.Concurrent (threadDelay)+import Control.Monad (forever)+import Data.ByteString.Builder (toLazyByteString)+import Data.Map (foldMapWithKey)+import Data.Text (Text, unpack)+import Network.HTTP.Client (Request,+ RequestBody (..),+ requestBody,+ requestHeaders)+import Network.HTTP.Types (hContentType)+import Network.Wreq.Session (newSession, put)+import Network.Wreq.Types (Putable (..)) --- | Push metrics to a pushgateway.-pushHttpProtoMetrics :: String -- ^ The base URL of the pushgateway, including the port number.- -> Text -- ^ The name of this job.- -> Labels -- ^ The label set to use as a grouping key for these metrics.- -> Int -- ^ Push frequency, in microseconds.- -> IO RegistrySample -- ^ The action to get the latest metrics.- -> IO ()-pushHttpProtoMetrics base job (Labels ls) frequency get =- withSession $ \session -> forever $- get >>= put session url >> threadDelay frequency+import System.Metrics.Prometheus.Encode.Text (encodeMetrics)+import System.Metrics.Prometheus.MetricId (Labels (..))+import System.Metrics.Prometheus.Registry (RegistrySample)+++-- | Push text metrics to a pushgateway.+pushHttpTextMetrics :: String -- ^ The base URL of the pushgateway, including the port number.+ -> Text -- ^ The name of this job.+ -> Labels -- ^ The label set to use as a grouping key for these metrics.+ -> Int -- ^ Push frequency, in microseconds.+ -> IO RegistrySample -- ^ The action to get the latest metrics.+ -> IO ()+pushHttpTextMetrics base job (Labels ls) frequency getSample = do+ session <- newSession+ forever $ getSample >>= put session url >> threadDelay frequency where url = base ++ "/metrics/job/" ++ unpack job ++ foldMapWithKey (\k v -> "/" ++ unpack k ++ "/" ++ unpack v) ls+++instance Putable RegistrySample where+ putPayload = (pure .) . metricsRequest+++metricsRequest :: RegistrySample -> Request -> Request+metricsRequest s req = req+ { requestBody = RequestBodyLBS . toLazyByteString $ encodeMetrics s+ , requestHeaders = contentType : requestHeaders req+ }+ where contentType = (hContentType, "text/plain; version=0.0.4")
src/System/Metrics/Prometheus/MetricId.hs view
@@ -9,8 +9,8 @@ import Prelude hiding (null) -newtype Name = Name { unName :: Text } deriving (Show, Eq, Ord, IsString, Monoid)-newtype Labels = Labels { unLabels :: Map Text Text } deriving (Show, Eq, Ord, Monoid)+newtype Name = Name { unName :: Text } deriving (Show, Eq, Ord, IsString, Monoid, Semigroup)+newtype Labels = Labels { unLabels :: Map Text Text } deriving (Show, Eq, Ord, Monoid, Semigroup) data MetricId =