Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class EkgMetric a where
Documentation
class EkgMetric a where Source #
Type class for constructing a configured EKG metric store for record type of named fields
For example, given:
type FActiveUsers = "activeUsers" :-> Gauge type FResponseTimes = "endpointResponseTimes" :-> Distribution type FOrdersPlaced = "ordersPlaced" :-> Counter type EkgMetrics = '[FActiveUsers, FResponseTimes, FRevenue]
And then used in:
configureMetrics :: IO (Rec EkgMetrics) configureMetrics = do store <- newStore metrics <- ekgMetric "myapp" store _ <- forkServerWith store "localhost" 8080 pure metrics
Compare to a more traditional:
metrics <- EkgMetrics <$> createGauge "myapp.active_users store <*> createDistribution "myapp.endpoint_response_times" store <*> createCounter "myapp.orders_placed" store
The former is more concise and harder to make naming errors particularly in larger store sets