Skip to content

Commit d625747

Browse files
author
Nacho Bonafonte
committed
Rename boundries -> boundaries
1 parent d7bbfcb commit d625747

File tree

8 files changed

+34
-34
lines changed

8 files changed

+34
-34
lines changed

Sources/Exporters/OpenTelemetryProtocol/metric/MetricsAdapter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ struct MetricsAdapter {
147147
injectPointData(protoHistogramPoint: &protoDataPoint, pointData: histogramData)
148148
protoDataPoint.sum = Double(histogramData.sum)
149149
protoDataPoint.count = UInt64(histogramData.count)
150-
protoDataPoint.explicitBounds = histogramData.boundries.map {Double($0)}
150+
protoDataPoint.explicitBounds = histogramData.boundaries.map {Double($0)}
151151
protoDataPoint.bucketCounts = histogramData.counts.map{UInt64($0)}
152152
protoMetric.histogram.aggregationTemporality = .cumulative
153153
protoMetric.histogram.dataPoints.append(protoDataPoint)

Sources/OpenTelemetryApi/Metrics/Meter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ public protocol Meter {
6161
@available(*,deprecated)
6262
func createDoubleHistogram(name: String, explicitBoundaries: Array<Double>?, absolute: Bool) -> AnyHistogramMetric<Double>
6363

64-
// Creates a double histogram given the name, boundries, counts, and start and end dates.
64+
// Creates a double histogram given the name, boundaries, counts, and start and end dates.
6565
/// - Parameters:
6666
/// - name: The name of the measure.
6767
func createRawDoubleHistogram(name: String) -> AnyRawHistogramMetric<Double>
6868

69-
// Creates a Int histogram given the name, boundries, counts, and start and end dates.
69+
// Creates a Int histogram given the name, boundaries, counts, and start and end dates.
7070
/// - Parameters:
7171
/// - name: The name of the measure.
7272
func createRawIntHistogram(name: String) -> AnyRawHistogramMetric<Int>

Sources/OpenTelemetrySdk/Metrics/Stable/Aggregation/Aggregation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class Aggregations {
2929
}
3030

3131
public static func explicitBucketHistogram(buckets: [Double]) -> Aggregation {
32-
ExplicitBucketHistogramAggregation(bucketBoundries: buckets)
32+
ExplicitBucketHistogramAggregation(bucketBoundaries: buckets)
3333
}
3434

3535
static func base2ExponentialBucketHistogram() {

Sources/OpenTelemetrySdk/Metrics/Stable/Aggregation/DoubleExplicitBucketHistogramAggregator.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ public class DoubleExplicitBucketHistogramAggregator : StableAggregator {
1717

1818
let lock = Lock()
1919

20-
internal init(boundries : [Double], exemplarReservoir: AnyExemplarReservoir) {
21-
self.boundries = boundries
20+
internal init(boundaries : [Double], exemplarReservoir: AnyExemplarReservoir) {
21+
self.boundaries = boundaries
2222

2323
self.sum = 0
2424
self.min = Double.greatestFiniteMagnitude
2525
self.max = -1
2626
self.count = 0
27-
self.counts = Array(repeating: 0, count: boundries.count + 1)
27+
self.counts = Array(repeating: 0, count: boundaries.count + 1)
2828
super.init(exemplarReservoir: exemplarReservoir)
2929

3030
}
3131

32-
private var boundries : [Double]
32+
private var boundaries : [Double]
3333
private var sum : Double
3434
private var min : Double
3535
private var max : Double
@@ -42,14 +42,14 @@ public class DoubleExplicitBucketHistogramAggregator : StableAggregator {
4242
defer {
4343
lock.unlock()
4444
}
45-
let pointData = HistogramPointData(startEpochNanos: startEpochNano, endEpochNanos: endEpochNano, attributes: attributes, exemplars: exemplars, sum: sum, count: count, min: min, max: max, boundries: boundries, counts: counts, hasMin: count > 0, hasMax: count > 0)
45+
let pointData = HistogramPointData(startEpochNanos: startEpochNano, endEpochNanos: endEpochNano, attributes: attributes, exemplars: exemplars, sum: sum, count: count, min: min, max: max, boundaries: boundaries, counts: counts, hasMin: count > 0, hasMax: count > 0)
4646

4747
if (reset) {
4848
sum = 0
4949
min = Double.greatestFiniteMagnitude
5050
max = -1
5151
count = 0
52-
counts = Array(repeating: 0, count: boundries.count + 1)
52+
counts = Array(repeating: 0, count: boundaries.count + 1)
5353
}
5454

5555
return pointData
@@ -66,14 +66,14 @@ public class DoubleExplicitBucketHistogramAggregator : StableAggregator {
6666
lock.unlock()
6767
}
6868
var bucketIndex = -1
69-
for (index, boundry) in boundries.enumerated() {
69+
for (index, boundry) in boundaries.enumerated() {
7070
if value <= boundry {
7171
bucketIndex = index
7272
break
7373
}
7474
}
7575
if bucketIndex == -1 {
76-
bucketIndex = boundries.count
76+
bucketIndex = boundaries.count
7777
}
7878

7979
sum += value
@@ -85,11 +85,11 @@ public class DoubleExplicitBucketHistogramAggregator : StableAggregator {
8585

8686
}
8787

88-
private let boundries : [Double]
88+
private let boundaries : [Double]
8989
private let reservoirSupplier : () -> AnyExemplarReservoir
9090

91-
public init(boundries: [Double], reservoirSupplier : @escaping () -> AnyExemplarReservoir) {
92-
self.boundries = boundries
91+
public init(boundaries: [Double], reservoirSupplier : @escaping () -> AnyExemplarReservoir) {
92+
self.boundaries = boundaries
9393
self.reservoirSupplier = reservoirSupplier
9494
}
9595

@@ -102,7 +102,7 @@ public class DoubleExplicitBucketHistogramAggregator : StableAggregator {
102102
}
103103

104104
public func createHandle() -> AggregatorHandle {
105-
return Handle(boundries: self.boundries, exemplarReservoir: self.reservoirSupplier())
105+
return Handle(boundaries: self.boundaries, exemplarReservoir: self.reservoirSupplier())
106106
}
107107

108108
public func toMetricData(resource: Resource, scope: InstrumentationScopeInfo, descriptor: MetricDescriptor, points: [AnyPointData], temporality: AggregationTemporality) -> StableMetricData {

Sources/OpenTelemetrySdk/Metrics/Stable/Aggregation/ExplicitBucketHistogramAggregation.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ import Foundation
77
import OpenTelemetryApi
88

99
public class ExplicitBucketHistogramAggregation : Aggregation, AggregatorFactory {
10-
public private(set) static var DEFAULT_BOUNDRIES : [Double] = [0,5,10,25,50,75,100,250,500,750,1_000,2_500,5_000,7_500]
11-
public private(set) static var instance = ExplicitBucketHistogramAggregation(bucketBoundries: DEFAULT_BOUNDRIES)
10+
public private(set) static var DEFAULT_BOUNDARIES : [Double] = [0,5,10,25,50,75,100,250,500,750,1_000,2_500,5_000,7_500]
11+
public private(set) static var instance = ExplicitBucketHistogramAggregation(bucketBoundaries: DEFAULT_BOUNDARIES)
1212

1313

14-
private let bucketBoundries : [Double]
14+
private let bucketBoundaries : [Double]
1515

16-
init(bucketBoundries : [Double]) {
17-
self.bucketBoundries = bucketBoundries
16+
init(bucketBoundaries : [Double]) {
17+
self.bucketBoundaries = bucketBoundaries
1818
}
1919

2020
public func createAggregator(descriptor: InstrumentDescriptor, exemplarFilter: ExemplarFilter) -> any StableAggregator {
21-
DoubleExplicitBucketHistogramAggregator(boundries: bucketBoundries) {
22-
FilteredExemplarReservoir(filter: exemplarFilter, reservoir: HistogramExemplarReservoir(clock: MillisClock(), boundries: self.bucketBoundries)) // todo: inject correct clock
21+
DoubleExplicitBucketHistogramAggregator(boundaries: bucketBoundaries) {
22+
FilteredExemplarReservoir(filter: exemplarFilter, reservoir: HistogramExemplarReservoir(clock: MillisClock(), boundaries: self.bucketBoundaries)) // todo: inject correct clock
2323
}
2424
}
2525

Sources/OpenTelemetrySdk/Metrics/Stable/Exemplar/HistogramExemplarReservoir.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import Foundation
77
import OpenTelemetryApi
88

99
public class HistogramExemplarReservoir : FixedSizedExemplarReservoir {
10-
init(clock: Clock, boundries : [Double]) {
11-
super.init(clock: clock, size: boundries.count + 1, reservoirCellSelector: HistogramCellSelector(boundries: boundries), mapAndResetCell: { cell, attributes in
10+
init(clock: Clock, boundaries : [Double]) {
11+
super.init(clock: clock, size: boundaries.count + 1, reservoirCellSelector: HistogramCellSelector(boundaries: boundaries), mapAndResetCell: { cell, attributes in
1212
return cell.getAndResetDouble(pointAttributes: attributes)
1313
})
1414
}
@@ -18,23 +18,23 @@ public class HistogramExemplarReservoir : FixedSizedExemplarReservoir {
1818
}
1919

2020
class HistogramCellSelector : ReservoirCellSelector {
21-
private var boundries : [Double]
21+
private var boundaries : [Double]
2222

23-
init(boundries: [Double]) {
24-
self.boundries = boundries
23+
init(boundaries: [Double]) {
24+
self.boundaries = boundaries
2525
}
2626

2727
func reservoirCellIndex(for cells: [ReservoirCell], value: Int, attributes: [String : OpenTelemetryApi.AttributeValue]) -> Int {
2828
reservoirCellIndex(for: cells, value: Double(value), attributes: attributes)
2929
}
3030

3131
func reservoirCellIndex(for cells: [ReservoirCell], value: Double, attributes: [String : OpenTelemetryApi.AttributeValue]) -> Int {
32-
if let index = boundries.firstIndex(where: { boundry in
32+
if let index = boundaries.firstIndex(where: { boundry in
3333
value <= boundry
3434
}) {
3535
return index
3636
}
37-
return boundries.count
37+
return boundaries.count
3838
}
3939

4040
func reset() {

Sources/OpenTelemetrySdk/Metrics/Stable/data/LongPointData.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public protocol HistogramPointDataProtocol : AnyPointData {
2525
var count : UInt64 { get }
2626
var min : Double { get }
2727
var max : Double { get }
28-
var boundries : [Double] { get }
28+
var boundaries : [Double] { get }
2929
var counts : [Int] { get }
3030
var hasMin : Bool { get }
3131
var hasMax : Bool { get }

Sources/OpenTelemetrySdk/Metrics/Stable/data/internal/HistogramPointData.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ public class HistogramPointData : AnyPointData, HistogramPointDataProtocol {
1010

1111

1212

13-
internal init(startEpochNanos : UInt64, endEpochNanos: UInt64, attributes: [String: AttributeValue], exemplars: [ExemplarData], sum: Double, count: UInt64, min: Double, max: Double, boundries: [Double], counts: [Int], hasMin: Bool, hasMax: Bool) {
13+
internal init(startEpochNanos : UInt64, endEpochNanos: UInt64, attributes: [String: AttributeValue], exemplars: [ExemplarData], sum: Double, count: UInt64, min: Double, max: Double, boundaries: [Double], counts: [Int], hasMin: Bool, hasMax: Bool) {
1414
self.sum = sum
1515
self.count = count
1616
self.min = min
1717
self.max = max
18-
self.boundries = boundries
18+
self.boundaries = boundaries
1919
self.counts = counts
2020
self.hasMin = hasMin
2121
self.hasMax = hasMax
@@ -30,7 +30,7 @@ public class HistogramPointData : AnyPointData, HistogramPointDataProtocol {
3030

3131
public var max: Double
3232

33-
public var boundries: [Double]
33+
public var boundaries: [Double]
3434

3535
public var counts: [Int]
3636

0 commit comments

Comments
 (0)