Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refuses to build with prometheus-client 1.0 #4

Open
dminuoso opened this issue Aug 14, 2018 · 2 comments
Open

Refuses to build with prometheus-client 1.0 #4

dminuoso opened this issue Aug 14, 2018 · 2 comments

Comments

@dminuoso
Copy link
Owner

In order, the following will be built (use -v for more details):
 - servant-prometheus-0.1.0.0 (lib) (first run)
 - servant-prometheus-0.1.0.0 (exe:bench) (first run)
Preprocessing library for servant-prometheus-0.1.0.0..
Building library for servant-prometheus-0.1.0.0..
[1 of 1] Compiling Servant.Prometheus ( lib/Servant/Prometheus.hs, /Users/vnawothnig/Software/haskell/mandy/dist-newstyle/build/x86_64-osx/ghc-8.4.2/servant-prometheus-0.1.0.0/build/Servant/Prometheus.o ) [Prometheus changed]

lib/Servant/Prometheus.hs:33:24: error:
    • Couldn't match expected type ‘Gauge’
                  with actual type ‘Metric Gauge’
    • In the first argument of ‘incGauge’, namely ‘inflight’
      In the first argument of ‘bracket_’, namely ‘(incGauge inflight)’
      In the expression:
        bracket_
          (incGauge inflight)
          (decGauge inflight)
          (application request respond)
   |
33 |     bracket_ (incGauge inflight)
   |                        ^^^^^^^^

lib/Servant/Prometheus.hs:34:24: error:
    • Couldn't match expected type ‘Gauge’
                  with actual type ‘Metric Gauge’
    • In the first argument of ‘decGauge’, namely ‘inflight’
      In the second argument of ‘bracket_’, namely ‘(decGauge inflight)’
      In the expression:
        bracket_
          (incGauge inflight)
          (decGauge inflight)
          (application request respond)
   |
34 |              (decGauge inflight)
   |                        ^^^^^^^^

lib/Servant/Prometheus.hs:46:62: error:
    • Couldn't match expected type ‘metric1 -> IO ()’
                  with actual type ‘Metric (Vector Label1 Counter)’
    • In the third argument of ‘withLabel’, namely ‘codes’
      In the expression: withLabel "2XX" incCounter codes
      In an equation for ‘count’:
          count Status {statusCode = sc}
            | 200 <= sc && sc < 300 = withLabel "2XX" incCounter codes
            | 400 <= sc && sc < 500 = withLabel "4XX" incCounter codes
            | 500 <= sc && sc < 600 = withLabel "5XX" incCounter codes
            | otherwise = withLabel "XXX" incCounter codes
   |
46 |         | 200 <= sc && sc < 300 = withLabel "2XX" incCounter codes
   |                                                              ^^^^^

lib/Servant/Prometheus.hs:47:62: error:
    • Couldn't match expected type ‘metric2 -> IO ()’
                  with actual type ‘Metric (Vector Label1 Counter)’
    • In the third argument of ‘withLabel’, namely ‘codes’
      In the expression: withLabel "4XX" incCounter codes
      In an equation for ‘count’:
          count Status {statusCode = sc}
            | 200 <= sc && sc < 300 = withLabel "2XX" incCounter codes
            | 400 <= sc && sc < 500 = withLabel "4XX" incCounter codes
            | 500 <= sc && sc < 600 = withLabel "5XX" incCounter codes
            | otherwise = withLabel "XXX" incCounter codes
   |
47 |         | 400 <= sc && sc < 500 = withLabel "4XX" incCounter codes
   |                                                              ^^^^^

lib/Servant/Prometheus.hs:48:62: error:
    • Couldn't match expected type ‘metric3 -> IO ()’
                  with actual type ‘Metric (Vector Label1 Counter)’
    • In the third argument of ‘withLabel’, namely ‘codes’
      In the expression: withLabel "5XX" incCounter codes
      In an equation for ‘count’:
          count Status {statusCode = sc}
            | 200 <= sc && sc < 300 = withLabel "2XX" incCounter codes
            | 400 <= sc && sc < 500 = withLabel "4XX" incCounter codes
            | 500 <= sc && sc < 600 = withLabel "5XX" incCounter codes
            | otherwise = withLabel "XXX" incCounter codes
   |
48 |         | 500 <= sc && sc < 600 = withLabel "5XX" incCounter codes
   |                                                              ^^^^^

lib/Servant/Prometheus.hs:49:62: error:
    • Couldn't match expected type ‘metric4 -> IO ()’
                  with actual type ‘Metric (Vector Label1 Counter)’
    • In the third argument of ‘withLabel’, namely ‘codes’
      In the expression: withLabel "XXX" incCounter codes
      In an equation for ‘count’:
          count Status {statusCode = sc}
            | 200 <= sc && sc < 300 = withLabel "2XX" incCounter codes
            | 400 <= sc && sc < 500 = withLabel "4XX" incCounter codes
            | 500 <= sc && sc < 600 = withLabel "5XX" incCounter codes
            | otherwise = withLabel "XXX" incCounter codes
   |
49 |         | otherwise             = withLabel "XXX" incCounter codes
   |                                                              ^^^^^

lib/Servant/Prometheus.hs:59:19: error:
    • Couldn't match expected type ‘Double’
                  with actual type ‘Metric Histogram’
    • In the second argument of ‘observe’, namely ‘hist’
      In a stmt of a 'do' block: observe t hist
      In the expression:
        do t2 <- getCurrentTime
           let dt = diffUTCTime t2 t1
               t = fromRational $ (* 1000) $ toRational dt
           observe t hist
           case qants of
             WithQuantiles -> observe t qant
             NoQuantiles -> pure ()
   |
59 |         observe t hist
   |                   ^^^^

lib/Servant/Prometheus.hs:61:40: error:
    • Couldn't match expected type ‘Double’
                  with actual type ‘Metric Prom.Summary’
    • In the second argument of ‘observe’, namely ‘qant’
      In the expression: observe t qant
      In a case alternative: WithQuantiles -> observe t qant
   |
61 |             WithQuantiles -> observe t qant
   |                                        ^^^^

lib/Servant/Prometheus.hs:82:11: error:
    • Couldn't match type ‘Metric’ with ‘IO’
      Expected type: IO [(Text, Meters)]
        Actual type: Metric [(Text, Meters)]
    • In a stmt of a 'do' block:
        ms <- forM eps
                $ \ path
                    -> do let ...
                          metersInflight <- gauge
                                              $ info
                                                  prefix
                                                  "in_flight"
                                                  "Number of in flight requests for "
                          ....
      In the expression:
        do let eps
                 = "unknown" : map (\ (ps, method) -> ...) (getEndpoints proxy)
           ms <- forM eps $ \ path -> do ...
           pure $ H.fromList ms
      In an equation for ‘makeMeters’:
          makeMeters proxy metersRecordQuants
            = do let eps = ...
                 ms <- forM eps $ \ path -> ...
                 pure $ H.fromList ms
   |
82 |     ms <- forM eps $ \path -> do
   |           ^^^^^^^^^^^^^^^^^^^^^^...

lib/Servant/Prometheus.hs:85:41: error:
    • Couldn't match type ‘[Char]’ with ‘Text’
      Expected type: Text
        Actual type: String
    • In the first argument of ‘Info’, namely
        ‘(T.unpack $ prfx <> name)’
      In the expression:
        Info (T.unpack $ prfx <> name) (T.unpack $ help <> prfx)
      In an equation for ‘info’:
          info prfx name help
            = Info (T.unpack $ prfx <> name) (T.unpack $ help <> prfx)
   |
85 |             info prfx name help = Info (T.unpack $ prfx <> name) (T.unpack $ help <> prfx)
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^

lib/Servant/Prometheus.hs:85:67: error:
    • Couldn't match type ‘[Char]’ with ‘Text’
      Expected type: Text
        Actual type: String
    • In the second argument of ‘Info’, namely
        ‘(T.unpack $ help <> prfx)’
      In the expression:
        Info (T.unpack $ prfx <> name) (T.unpack $ help <> prfx)
      In an equation for ‘info’:
          info prfx name help
            = Info (T.unpack $ prfx <> name) (T.unpack $ help <> prfx)
   |
85 |             info prfx name help = Info (T.unpack $ prfx <> name) (T.unpack $ help <> prfx)
   |                                                                   ^^^^^^^^^^^^^^^^^^^^^^^

lib/Servant/Prometheus.hs:91:17: error:
    • Couldn't match expected type ‘Metric Gauge’
                  with actual type ‘Gauge’
    • In the ‘metersInflight’ field of a record
      In the expression: Meters {..}
      In an equation for ‘m’: m = Meters {..}
   |
91 |         let m = Meters{..}
   |                 ^^^^^^^^^^

lib/Servant/Prometheus.hs:92:23: error:
    • Couldn't match expected type ‘Metric a0’ with actual type ‘Gauge’
    • In the first argument of ‘register’, namely ‘metersInflight’
      In a stmt of a 'do' block: _ <- register metersInflight
      In the expression:
        do let prefix = "servant.path." <> path <> "."
               info :: Text -> Text -> Text -> Info
               ....
           metersInflight <- gauge
                               $ info prefix "in_flight" "Number of in flight requests for "
           metersResponses <- vector "status_code"
                                $ counter (info prefix "http_status" "Counters for status codes")
           metersTime <- histogram
                           (info prefix "time_ms" "Distribution of query times for ")
                           [10, 50, ....]
           ....
   |
92 |         _ <- register metersInflight
   |                       ^^^^^^^^^^^^^^

lib/Servant/Prometheus.hs:93:23: error:
    • Couldn't match expected type ‘Metric a1’
                  with actual type ‘Vector l0 Counter’
    • In the first argument of ‘register’, namely ‘metersResponses’
      In a stmt of a 'do' block: _ <- register metersResponses
      In the expression:
        do let prefix = "servant.path." <> path <> "."
               info :: Text -> Text -> Text -> Info
               ....
           metersInflight <- gauge
                               $ info prefix "in_flight" "Number of in flight requests for "
           metersResponses <- vector "status_code"
                                $ counter (info prefix "http_status" "Counters for status codes")
           metersTime <- histogram
                           (info prefix "time_ms" "Distribution of query times for ")
                           [10, 50, ....]
           ....
    • Relevant bindings include
        metersResponses :: Vector l0 Counter
          (bound at lib/Servant/Prometheus.hs:87:9)
   |
93 |         _ <- register metersResponses
   |                       ^^^^^^^^^^^^^^^

lib/Servant/Prometheus.hs:94:23: error:
    • Couldn't match expected type ‘Metric a2’
                  with actual type ‘Histogram’
    • In the first argument of ‘register’, namely ‘metersTime’
      In a stmt of a 'do' block: _ <- register metersTime
      In the expression:
        do let prefix = "servant.path." <> path <> "."
               info :: Text -> Text -> Text -> Info
               ....
           metersInflight <- gauge
                               $ info prefix "in_flight" "Number of in flight requests for "
           metersResponses <- vector "status_code"
                                $ counter (info prefix "http_status" "Counters for status codes")
           metersTime <- histogram
                           (info prefix "time_ms" "Distribution of query times for ")
                           [10, 50, ....]
           ....
   |
94 |         _ <- register metersTime
   |                       ^^^^^^^^^^

lib/Servant/Prometheus.hs:97:39: error:
    • Couldn't match expected type ‘Metric Prom.Summary’
  1 name:                servant-prometheus
                  with actual type ‘Prom.Summary’
    • In the first argument of ‘register’, namely ‘metersTimeQant’
      In the expression: register metersTimeQant
      In a case alternative: WithQuantiles -> register metersTimeQant
   |
97 |             WithQuantiles -> register metersTimeQant
   |                                       ^^^^^^^^^^^^^^

lib/Servant/Prometheus.hs:124:57: error:
    • Couldn't match type ‘Data.ByteString.Lazy.Internal.ByteString’
                     with ‘Data.ByteString.Internal.ByteString’
      NB: ‘Data.ByteString.Internal.ByteString’
  1 name:                servant-prometheus
            is defined in ‘Data.ByteString.Internal’
          ‘Data.ByteString.Lazy.Internal.ByteString’
            is defined in ‘Data.ByteString.Lazy.Internal’
  1 name:                servant-prometheus
      Expected type: IO Data.ByteString.Internal.ByteString
        Actual type: IO Data.ByteString.Lazy.Internal.ByteString
    • In the second argument of ‘(=<<)’, namely ‘exportMetricsAsText’
      In the expression:
        respond . responseLBS status200 [] . fromStrict
          =<< exportMetricsAsText
      In the expression:
        \ _req respond
          -> respond . responseLBS status200 [] . fromStrict
               =<< exportMetricsAsText
    |
124 |     respond . responseLBS status200 [] . fromStrict =<< exportMetricsAsText
    |                                                         ^^^^^^^^^^^^^^^^^^^
cabal: Failed to build servant-prometheus-0.1.0.```
@dminuoso
Copy link
Owner Author

Screw it Im writing the 1.0 support. :)

@kirelagin
Copy link

I believe this is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants