Skip to content

Commit

Permalink
Fix various typos in Api and Sdk sources (#515)
Browse files Browse the repository at this point in the history
Co-authored-by: Ignacio Bonafonte <[email protected]>
  • Loading branch information
aldoKelvianto and Ignacio Bonafonte authored Feb 8, 2024
1 parent 297d91f commit 613b64d
Show file tree
Hide file tree
Showing 37 changed files with 64 additions and 64 deletions.
2 changes: 1 addition & 1 deletion Examples/Datadog Sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

This example shows the Datadog exporter used with a Simple Exporter, showing how to configure for sending.

User must write the clientKey for Datadog at the begining of code.
User must write the clientKey for Datadog at the beginning of code.


4 changes: 2 additions & 2 deletions Examples/Simple Exporter/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ let instrumentationScopeName = "SimpleExporter"
let instrumentationScopeVersion = "semver:0.1.0"

var tracer: TracerSdk
let jaegerCollectorAdress = "localhost"
let jaegerExporter = JaegerSpanExporter(serviceName: "SimpleExporter", collectorAddress: jaegerCollectorAdress)
let jaegerCollectorAddress = "localhost"
let jaegerExporter = JaegerSpanExporter(serviceName: "SimpleExporter", collectorAddress: jaegerCollectorAddress)
let stdoutExporter = StdoutExporter()

// let zipkinExporterOptions = ZipkinTraceExporterOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public struct ExporterConfiguration {
var payloadCompression: Bool

var source: String
/// This conditon will be evaluated before trying to upload data
/// This condition will be evaluated before trying to upload data
/// Can be used to avoid reporting when no connection
var uploadCondition: () -> Bool
/// Performance preset for reporting
Expand Down
2 changes: 1 addition & 1 deletion Sources/Exporters/DatadogExporter/Logs/LogEncoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ internal struct DDLog: Encodable {
self.environment = configuration.environment
self.loggerName = attributes.removeValue(forKey: "loggerName")?.description ?? "logger"
self.loggerVersion = "1.0" // loggerVersion
self.threadName = attributes.removeValue(forKey: "threadName")?.description ?? "unkown"
self.threadName = attributes.removeValue(forKey: "threadName")?.description ?? "unknown"
self.applicationVersion = configuration.version

let userAttributes: [String: Encodable] = attributes.mapValues {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Exporters/DatadogExporter/Logs/LogSanitizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ internal struct LogSanitizer {
/// Allowed first character of a tag name (given as ASCII values ranging from lowercased `a` to `z`) .
/// Tags with name starting with different character will be dropped.
static let allowedTagNameFirstCharacterASCIIRange: [UInt8] = Array(97 ... 122)
/// Maximum lenght of the tag.
/// Tags exceeting this lenght will be trunkated.
/// Maximum length of the tag.
/// Tags exceeting this length will be trunkated.
static let maxTagLength: Int = 200
/// Tag keys reserved for Datadog.
/// If any of those is used by user, the tag will be ignored.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import Foundation

internal final class FileWriter {
/// Data writting format.
/// Data writing format.
private let dataFormat: DataFormat
/// Orchestrator producing reference to writable file.
private let orchestrator: FilesOrchestrator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private enum HTTPResponseStatusCode: Int {
/// The status of a single upload attempt.
internal struct DataUploadStatus {
/// If upload needs to be retried (`true`) because its associated data was not delivered but it may succeed
/// in the next attempt (i.e. it failed due to device leaving signal range or a temporary server unavailability occured).
/// in the next attempt (i.e. it failed due to device leaving signal range or a temporary server unavailability occurred).
/// If set to `false` then data associated with the upload should be deleted as it does not need any more upload
/// attempts (i.e. the upload succeeded or failed due to unrecoverable client error).
let needsRetry: Bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal protocol UploadPerformancePreset {
/// At runtime, the upload interval ranges from `minUploadDelay` to `maxUploadDelay` depending
/// on delivery success or failure.
var defaultUploadDelay: TimeInterval { get }
/// Mininum interval of data upload (in seconds).
/// Minimum interval of data upload (in seconds).
var minUploadDelay: TimeInterval { get }
/// Maximum interval of data upload (in seconds).
var maxUploadDelay: TimeInterval { get }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import OpenTelemetrySdk

public enum MetricsAdapter {
public static func toProtoResourceMetrics(stableMetricData: [StableMetricData]) -> [Opentelemetry_Proto_Metrics_V1_ResourceMetrics] {
let resourceAndScopeMap = groupByResouceAndScope(stableMetricData: stableMetricData)
let resourceAndScopeMap = groupByResourceAndScope(stableMetricData: stableMetricData)

var resourceMetrics = [Opentelemetry_Proto_Metrics_V1_ResourceMetrics]()
resourceAndScopeMap.forEach { resMap in
Expand All @@ -31,7 +31,7 @@ public enum MetricsAdapter {
}

public static func toProtoResourceMetrics(metricDataList: [Metric]) -> [Opentelemetry_Proto_Metrics_V1_ResourceMetrics] {
let resourceAndScopeMap = groupByResouceAndScope(metricDataList: metricDataList)
let resourceAndScopeMap = groupByResourceAndScope(metricDataList: metricDataList)
var resourceMetrics = [Opentelemetry_Proto_Metrics_V1_ResourceMetrics]()

resourceAndScopeMap.forEach { resMap in
Expand All @@ -55,7 +55,7 @@ public enum MetricsAdapter {
return resourceMetrics
}

private static func groupByResouceAndScope(stableMetricData: [StableMetricData]) -> [Resource: [InstrumentationScopeInfo: [Opentelemetry_Proto_Metrics_V1_Metric]]] {
private static func groupByResourceAndScope(stableMetricData: [StableMetricData]) -> [Resource: [InstrumentationScopeInfo: [Opentelemetry_Proto_Metrics_V1_Metric]]] {
var results = [Resource: [InstrumentationScopeInfo: [Opentelemetry_Proto_Metrics_V1_Metric]]]()

stableMetricData.forEach {
Expand All @@ -66,7 +66,7 @@ public enum MetricsAdapter {
return results
}

private static func groupByResouceAndScope(metricDataList: [Metric]) -> [Resource: [InstrumentationScopeInfo: [Opentelemetry_Proto_Metrics_V1_Metric]]] {
private static func groupByResourceAndScope(metricDataList: [Metric]) -> [Resource: [InstrumentationScopeInfo: [Opentelemetry_Proto_Metrics_V1_Metric]]] {
var results = [Resource: [InstrumentationScopeInfo: [Opentelemetry_Proto_Metrics_V1_Metric]]]()

metricDataList.forEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Foundation
/// The status of a single export attempt.
internal struct DataExportStatus {
/// If export needs to be retried (`true`) because its associated data was not delivered but it may succeed
/// in the next attempt (i.e. it failed due to device leaving signal range or a temporary server unavailability occured).
/// in the next attempt (i.e. it failed due to device leaving signal range or a temporary server unavailability occurred).
/// If set to `false` then data associated with the upload should be deleted as it does not need any more export
/// attempts (i.e. the upload succeeded or failed due to unrecoverable client error).
let needsRetry: Bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal protocol ExportPerformancePreset {
/// At runtime, the export interval ranges from `minExportDelay` to `maxExportDelay` depending
/// on delivery success or failure.
var defaultExportDelay: TimeInterval { get }
/// Mininum interval of data export (in seconds).
/// Minimum interval of data export (in seconds).
var minExportDelay: TimeInterval { get }
/// Maximum interval of data export (in seconds).
var maxExportDelay: TimeInterval { get }
Expand Down
2 changes: 1 addition & 1 deletion Sources/Instrumentation/URLSession/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This package captures the network calls produced by URLSession.

This instrumentation relies on the global tracer provider in the `OpenTelementry` object. Custom global tracer providers must be initialized and set prior to initializing this instrumentation.
This instrumentation relies on the global tracer provider in the `OpenTelemetry` object. Custom global tracer providers must be initialized and set prior to initializing this instrumentation.

## Usage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public class URLSessionInstrumentation {
return
}

/// Code for instrumenting colletion should be written here
/// Code for instrumenting collection should be written here
if let error = task.error {
let status = (task.response as? HTTPURLResponse)?.statusCode ?? 0
URLSessionLogger.logError(error, dataOrFile: requestState?.dataProcessed, statusCode: status, instrumentation: self, sessionTaskId: taskId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public struct OpenTelemetryContextProvider {
}

/// Sets the span as the activeSpan for the current context
/// - Parameter baggage: the Correlation Context to be set to the current contex
/// - Parameter baggage: the Correlation Context to be set to the current context
public func setActiveBaggage(_ baggage: Baggage) {
contextManager.setCurrentContextValue(forKey: OpenTelemetryContextKeys.baggage, value: baggage)
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenTelemetryApi/Logs/LogRecordBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import Foundation

public protocol LogRecordBuilder {
/// set the timestamp on which the event ocurred
/// set the timestamp on which the event occurred
///
/// - Parameter timestamp: the Date object
/// - Returns: self
Expand Down Expand Up @@ -36,7 +36,7 @@ public protocol LogRecordBuilder {
/// - Returns: self
func setBody(_ body: AttributeValue) -> Self

/// set attributes assoicated with the log.
/// set attributes associated with the log.
///
/// - Parameter attributes: Array of [String: AttributeValue]
/// - Returns:
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenTelemetryApi/Trace/SemanticAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3286,4 +3286,4 @@ public enum SemanticAttributes: String {
case unauthenticated = "unauthenticated"
}

}
}
2 changes: 1 addition & 1 deletion Sources/OpenTelemetryApi/Trace/SpanKind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
public enum SpanKind: String, Equatable, Codable {
/// Default value. Indicates that the span is used internally.
case `internal`
/// ndicates that the span covers server-side handling of an RPC or other remote request.
/// Indicates that the span covers server-side handling of an RPC or other remote request.
case server
/// Indicates that the span covers the client-side wrapper around an RPC or other remote request.
case client
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenTelemetrySdk/Logs/LogLimits.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import Foundation

public struct LogLimits {
static public let defaultMaxAttributeCount = 128
static public let defaultMaxAtributeLength = Int.max
static public let defaultMaxAttributeLength = Int.max
public let maxAttributeCount : Int
public let maxAttributeLength : Int

public init(maxAttributeCount: Int = Self.defaultMaxAttributeCount , maxAttributeLength: Int = Self.defaultMaxAtributeLength) {
public init(maxAttributeCount: Int = Self.defaultMaxAttributeCount , maxAttributeLength: Int = Self.defaultMaxAttributeLength) {
self.maxAttributeCount = maxAttributeCount
self.maxAttributeLength = maxAttributeLength
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/OpenTelemetrySdk/Metrics/Export/MetricData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ extension HistogramData: Codable where T: Codable {
try container.encode(timestamp, forKey: .timestamp)
try container.encode(labels, forKey: .labels)

var bucketsCountainer = container.nestedContainer(keyedBy: BucketsCodingKeys.self, forKey: .buckets)
try bucketsCountainer.encode(buckets.boundaries, forKey: .boundaries)
try bucketsCountainer.encode(buckets.counts, forKey: .counts)
var bucketsContainer = container.nestedContainer(keyedBy: BucketsCodingKeys.self, forKey: .buckets)
try bucketsContainer.encode(buckets.boundaries, forKey: .boundaries)
try bucketsContainer.encode(buckets.counts, forKey: .counts)

try container.encode(count, forKey: .count)
try container.encode(sum, forKey: .sum)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public class DoubleExplicitBucketHistogramAggregator: StableAggregator {
lock.unlock()
}
var bucketIndex = -1
for (index, boundry) in boundaries.enumerated() {
if value <= boundry {
for (index, boundary) in boundaries.enumerated() {
if value <= boundary {
bucketIndex = index
break
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import Foundation
import OpenTelemetryApi

public class DoubleLastValueAggregator: StableAggregator {
private var resevoirSupplier: () -> ExemplarReservoir
private var reservoirSupplier: () -> ExemplarReservoir

internal init(resevoirSupplier: @escaping () -> ExemplarReservoir) {
self.resevoirSupplier = resevoirSupplier
internal init(reservoirSupplier: @escaping () -> ExemplarReservoir) {
self.reservoirSupplier = reservoirSupplier
}

public func diff(previousCumulative: PointData, currentCumulative: PointData) throws -> PointData {
Expand All @@ -22,7 +22,7 @@ public class DoubleLastValueAggregator: StableAggregator {
}

public func createHandle() -> AggregatorHandle {
Handle(exemplarReservoir: resevoirSupplier())
Handle(exemplarReservoir: reservoirSupplier())
}

public func toMetricData(resource: Resource, scope: InstrumentationScopeInfo, descriptor: MetricDescriptor, points: [PointData], temporality: AggregationTemporality) -> StableMetricData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ public class LastValueAggregation: Aggregation {
public func createAggregator(descriptor: InstrumentDescriptor, exemplarFilter: ExemplarFilter) -> StableAggregator {
switch descriptor.valueType {
case .double:
return DoubleLastValueAggregator(resevoirSupplier: {
return DoubleLastValueAggregator(reservoirSupplier: {
FilteredExemplarReservoir(filter: exemplarFilter, reservoir: RandomFixedSizedExemplarReservoir.createDouble(clock: MillisClock(), size: 2))
})
case .long:
return LongLastValueAggregator(resevoirSupplier: {
return LongLastValueAggregator(reservoirSupplier: {
FilteredExemplarReservoir(filter: exemplarFilter, reservoir: RandomFixedSizedExemplarReservoir.createLong(clock: MillisClock(), size: 2))
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import Foundation
import OpenTelemetryApi

public class LongLastValueAggregator: StableAggregator {
private var resevoirSupplier: () -> ExemplarReservoir
private var reservoirSupplier: () -> ExemplarReservoir

internal init(resevoirSupplier: @escaping () -> ExemplarReservoir) {
self.resevoirSupplier = resevoirSupplier
internal init(reservoirSupplier: @escaping () -> ExemplarReservoir) {
self.reservoirSupplier = reservoirSupplier
}

public func diff(previousCumulative: PointData, currentCumulative: PointData) throws -> PointData {
Expand All @@ -22,7 +22,7 @@ public class LongLastValueAggregator: StableAggregator {
}

public func createHandle() -> AggregatorHandle {
Handle(exemplarReservoir: resevoirSupplier())
Handle(exemplarReservoir: reservoirSupplier())
}

public func toMetricData(resource: Resource, scope: InstrumentationScopeInfo, descriptor: MetricDescriptor, points: [PointData], temporality: AggregationTemporality) -> StableMetricData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public class RandomFixedSizedExemplarReservoir: FixedSizedExemplarReservoir {
}

class RandomCellSelector: ReservoirCellSelector {
var numMeasurments: Int = 0
var numMeasurements: Int = 0

func reservoirCellIndex(for cells: [ReservoirCell], value: Int, attributes: [String: OpenTelemetryApi.AttributeValue]) -> Int {
return getIndex(cells: cells)
Expand All @@ -119,13 +119,13 @@ public class RandomFixedSizedExemplarReservoir: FixedSizedExemplarReservoir {
}

func reset() {
numMeasurments = 0
numMeasurements = 0
}

private func getIndex(cells: [ReservoirCell]) -> Int {
let count = numMeasurments + 1
let count = numMeasurements + 1
let index = Int.random(in: Int.min...Int.max) > 0 ? count : 1
numMeasurments += 1
numMeasurements += 1
if index < cells.count {
return index
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class HistogramExemplarReservoir : FixedSizedExemplarReservoir {
}

func reservoirCellIndex(for cells: [ReservoirCell], value: Double, attributes: [String : OpenTelemetryApi.AttributeValue]) -> Int {
if let index = boundaries.firstIndex(where: { boundry in
value <= boundry
if let index = boundaries.firstIndex(where: { boundary in
value <= boundary
}) {
return index
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import Foundation
import OpenTelemetryApi


class NoopAttributesProccessor : AttributeProcessorProtocol {
class NoopAttributesProcessor : AttributeProcessorProtocol {

func process(incoming attributes: [String : OpenTelemetryApi.AttributeValue]) -> [String: OpenTelemetryApi.AttributeValue] {
return attributes
}

public static let noop = NoopAttributesProccessor()
public static let noop = NoopAttributesProcessor()
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class StableMeterProviderSdk: StableMeterProvider {
var registeredReaders = [RegisteredReader]()
var registeredViews = [RegisteredView]()

var componentRegistery: ComponentRegistry<StableMeterSdk>!
var componentRegistry: ComponentRegistry<StableMeterSdk>!

public func get(name: String) -> StableMeter {
meterBuilder(name: name).build()
Expand All @@ -31,7 +31,7 @@ public class StableMeterProviderSdk: StableMeterProvider {
name = Self.defaultMeterName
}

return MeterBuilderSdk(registry: componentRegistery, instrumentationScopeName: name)
return MeterBuilderSdk(registry: componentRegistry, instrumentationScopeName: name)
}

public static func builder() -> StableMeterProviderBuilder {
Expand All @@ -52,12 +52,12 @@ public class StableMeterProviderSdk: StableMeterProvider {

meterProviderSharedState = MeterProviderSharedState(clock: clock, resource: resource, startEpochNanos: startEpochNano, exemplarFilter: exemplarFilter)

componentRegistery = ComponentRegistry { scope in
componentRegistry = ComponentRegistry { scope in
StableMeterSdk(meterProviderSharedState: &self.meterProviderSharedState, instrumentScope: scope, registeredReaders: &self.registeredReaders)
}

for registeredReader in registeredReaders {
let producer = LeasedMetricProducer(registry: componentRegistery, sharedState: meterProviderSharedState, registeredReader: registeredReader)
let producer = LeasedMetricProducer(registry: componentRegistry, sharedState: meterProviderSharedState, registeredReader: registeredReader)
registeredReader.reader.register(registration: producer)
registeredReader.lastCollectedEpochNanos = startEpochNano
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Foundation
import OpenTelemetryApi

public class StableObservableMeasurementSdk : ObservableLongMeasurement, ObservableDoubleMeasurement {
private var insturmentScope : InstrumentationScopeInfo
private var instrumentScope : InstrumentationScopeInfo
public private(set) var descriptor : InstrumentDescriptor
public private(set) var storages : [AsynchronousMetricStorage]
private var activeReader : RegisteredReader?
Expand All @@ -16,7 +16,7 @@ public class StableObservableMeasurementSdk : ObservableLongMeasurement, Observa
var epochNanos : UInt64 = 0

init(insturmentScope: InstrumentationScopeInfo, descriptor: InstrumentDescriptor, storages: [AsynchronousMetricStorage]) {
self.insturmentScope = insturmentScope
self.instrumentScope = insturmentScope
self.descriptor = descriptor
self.storages = storages
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class RecordEventsReadableSpan: ReadableSpan {
public private(set) var links = [SpanData.Link]()
/// Number of links recorded.
public private(set) var totalRecordedLinks: Int
/// Max number of attibutes per span.
/// Max number of attributes per span.
public private(set) var maxNumberOfAttributes: Int
/// Max number of attributes per event.
public private(set) var maxNumberOfAttributesPerEvent: Int
Expand Down
Loading

0 comments on commit 613b64d

Please sign in to comment.