Skip to content

Commit 1e22ec2

Browse files
authored
Update README.md
1 parent d7e25d9 commit 1e22ec2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ counter.inc(12, .init(route: "/"))
106106

107107
Prometheus itself is designed to "pull" metrics from a destination. Following this pattern, SwiftPrometheus is designed to expose metrics, as opposed to submitted/exporting them directly to Prometheus itself. SwiftPrometheus produces a formatted string that Prometheus can parse, which can be integrated into your own application.
108108

109-
By default, this should be accessible on your main serving port, at the `/metrics` endpoint. An example in [Vapor](https://vapor.codes) syntax looks like:
109+
By default, this should be accessible on your main serving port, at the `/metrics` endpoint. An example in [Vapor](https://vapor.codes) 4 syntax looks like:
110110

111111
```swift
112-
router.get("/metrics") { request -> EventLoopFuture<String> in
113-
let promise = request.eventLoop.newPromise(of: String.self)
114-
myProm.collect(into: promise)
112+
app.get("metrics") { req -> EventLoopFuture<String> in
113+
let promise = req.eventLoop.makePromise(of: String.self)
114+
try MetricsSystem.prometheus().collect(into: promise)
115115
return promise.futureResult
116116
}
117117
```

0 commit comments

Comments
 (0)