Skip to content

Commit efab3ae

Browse files
committed
Readme updates
1 parent a5671ba commit efab3ae

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ let myProm = PrometheusClient()
2727
## Usage with SwiftMetrics
2828
_For more details about swift-metrics, please view [the GitHub repo](https://github.com/apple/swift-metrics)._
2929

30+
Starting with SwiftPrometheus [1.0.0-alpha.10](https://github.com/MrLotU/SwiftPrometheus/releases/tag/1.0.0-alpha.10) `MetricsSystem` is no longer directly configured with a `PrometheusClient`.
31+
32+
Instead, create a `PrometheusMetricsFactory` instance wrapping a `PrometheusClient`.
33+
34+
```swift
35+
let myProm = PrometheusClient()
36+
MetricsSystem.bootstrap(PrometheusMetricsFactory(client: myProm))
37+
```
38+
39+
Along with a `PrometheusClient`, `PrometheusMetricsFactory` can take a `Configuration` object setting the following properties:
40+
- A `LabelSanitizer` used to sanitize metric names to valid Prometheus values. A default implementation is provided.
41+
- The Prometheus metric type to use for swift-metrics' `Timer`. Can be a `Histogram` or a `Summary`. Note that when using `Histogram`, `preferredDisplayUnit` will not be observed.
42+
- Default buckets for use by aggregating swift-metrics `Recorder` instances.
43+
44+
### Before Alpha 10
45+
3046
To use SwiftPrometheus with swift-metrics, you need to configure the backend inside the `MetricsSystem`:
3147

3248
```swift

0 commit comments

Comments
 (0)