Skip to content

Commit

Permalink
add note about convergence tag (#20)
Browse files Browse the repository at this point in the history
motivation: starting convergence period for swift-metrics 1.0.0 release

changes:
* add info in readme about the convergence phase/version
* format
  • Loading branch information
tomerd authored Apr 22, 2019
1 parent 6db51d5 commit b017e02
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ If you have a server-side Swift application, or maybe a cross-platform (e.g. Lin
To add a dependency on the metrics API package, you need to declare it in your `Package.swift`:

```swift
// it's early days here so we haven't tagged a version yet, but will soon
.package(url: "https://github.com/apple/swift-metrics.git", .branch("master")),
// SwiftMetrics is converging towards the 1.0.0 release as of April 22nd 2019, the tag is 1.0.0-convergence.1
// To depend on this release, you can use
.package(url: "https://github.com/apple/swift-metrics.git", from: "1.0.0-convergence.1"),
```

and to your application/library target, add "Metrics" to your dependencies:
Expand Down Expand Up @@ -46,9 +47,9 @@ Note: If you are building a library, you don't need to concern yourself with thi

SwiftMetrics only provides the metrics system API. As an application owner, you need to select a metrics backend (such as the ones mentioned above) to make the metrics information useful.

Selecting a backend is done by adding a dependency on the desired backend client implementation and invoking the `MetricsSystem.bootstrap` function at the beginning of the program:
Selecting a backend is done by adding a dependency on the desired backend client implementation and invoking the `MetricsSystem.bootstrap` function at the beginning of the program:

```swift
```swift
MetricsSystem.bootstrap(SelectedMetricsImplementation())
```

Expand Down Expand Up @@ -192,7 +193,7 @@ class SimpleMetricsLibrary: MetricsFactory {
func makeTimer(label: String, dimensions: [(String, String)]) -> TimerHandler {
return ExampleTimer(label, dimensions)
}

// implementation is stateless, so nothing to do on destroy calls
func destroyCounter(_ handler: CounterHandler) {}
func destroyRecorder(_ handler: RecorderHandler) {}
Expand Down
9 changes: 3 additions & 6 deletions Sources/CoreMetrics/Metrics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public class Counter {
public func reset() {
self.handler.reset()
}

}

public extension Counter {
Expand Down Expand Up @@ -483,7 +482,6 @@ public final class MultiplexMetricsHandler: MetricsFactory {
}
}


private class MuxCounter: CounterHandler {
let counters: [CounterHandler]
public init(factories: [MetricsFactory], label: String, dimensions: [(String, String)]) {
Expand Down Expand Up @@ -528,7 +526,6 @@ public final class MultiplexMetricsHandler: MetricsFactory {

/// Ships with the metrics module, used for initial bootstraping.
public final class NOOPMetricsHandler: MetricsFactory, CounterHandler, RecorderHandler, TimerHandler {

public static let instance = NOOPMetricsHandler()

private init() {}
Expand All @@ -543,9 +540,9 @@ public final class NOOPMetricsHandler: MetricsFactory, CounterHandler, RecorderH
return self
}

public func destroyCounter(_ handler: CounterHandler) {}
public func destroyRecorder(_ handler: RecorderHandler) {}
public func destroyTimer(_ handler: TimerHandler) {}
public func destroyCounter(_: CounterHandler) {}
public func destroyRecorder(_: RecorderHandler) {}
public func destroyTimer(_: TimerHandler) {}

public func increment(by: Int64) {}
public func reset() {}
Expand Down

0 comments on commit b017e02

Please sign in to comment.