This repository was archived by the owner on Oct 19, 2024. It is now read-only.
File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ executable library
25
25
, monad-logger >= 0.3 && < 0.4
26
26
, mtl
27
27
, mu-persistent >= 0.3
28
+ , mu-prometheus >= 0.4
28
29
, mu-graphql >= 0.4
29
30
, mu-rpc >= 0.4
30
31
, mu-schema >= 0.3
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import Database.Persist.Sqlite
20
20
import Mu.Adapter.Persistent (runDb )
21
21
import Mu.GraphQL.Quasi
22
22
import Mu.GraphQL.Server
23
+ import Mu.Instrumentation.Prometheus
23
24
import Mu.Schema
24
25
import Mu.Server
25
26
import Network.Wai.Handler.Warp (run )
@@ -30,19 +31,24 @@ import Schema
30
31
main :: IO ()
31
32
main = do
32
33
putStrLn " starting GraphQL server on port 8000"
34
+ -- Setup CORS
33
35
let hm = addHeaders [
34
36
(" Access-Control-Allow-Origin" , " *" )
35
37
, (" Access-Control-Allow-Headers" , " Content-Type" )
36
38
]
39
+ -- Set up Prometheus
40
+ p <- initPrometheus " library"
41
+ -- Run the whole thing
37
42
runStderrLoggingT $
38
43
withSqliteConn @ (LoggingT IO ) " :memory:" $ \ conn -> do
39
44
runDb conn $ runMigration migrateAll
40
45
liftIO $ run 8000 $ hm $
41
- graphQLApp (libraryServer conn)
46
+ graphQLApp (prometheus p $ libraryServer conn)
42
47
(Proxy @ ('Just " Query" ))
43
48
(Proxy @ ('Just " Mutation" ))
44
49
(Proxy @ ('Just " Subscription" ))
45
50
51
+
46
52
type ObjectMapping = '[
47
53
" Book" ':-> Entity Book
48
54
, " Author" ':-> Entity Author
You can’t perform that action at this time.
0 commit comments