Skip to content

Commit

Permalink
Merge pull request #474 from hunguyenaxon/hunguyen-470-fix-long-histo…
Browse files Browse the repository at this point in the history
…rgram-init-order

Fix the order of initialization between DoubleHistogram and LongHistogram
  • Loading branch information
bryce-b authored Oct 9, 2023
2 parents cc58692 + 0a0c98a commit e2c7e6b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
//
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
//
//

import Foundation
import OpenTelemetryApi

public class DoubleHistogramMeterBuilderSdk : DoubleHistogramBuilder, InstrumentBuilder {
public class DoubleHistogramMeterBuilderSdk: DoubleHistogramBuilder, InstrumentBuilder {
var meterProviderSharedState: MeterProviderSharedState

var meterSharedState: StableMeterSharedState

var type: InstrumentType
let type: InstrumentType = .histogram

let valueType: InstrumentValueType = .double

var valueType: InstrumentValueType
let instrumentName: String

var description: String

var unit: String

var instrumentName: String

init(meterProviderSharedState: inout MeterProviderSharedState, meterSharedState: inout StableMeterSharedState, name: String) {
init(meterProviderSharedState: inout MeterProviderSharedState,
meterSharedState: inout StableMeterSharedState,
name: String,
description: String = "",
unit: String = "") {
self.meterProviderSharedState = meterProviderSharedState
self.meterSharedState = meterSharedState
self.type = .histogram
self.valueType = .double
self.description = ""
self.unit = ""
self.instrumentName = name
self.description = description
self.unit = unit
}

public func ofLongs() -> OpenTelemetryApi.LongHistogramBuilder {
Expand All @@ -38,8 +40,4 @@ public class DoubleHistogramMeterBuilderSdk : DoubleHistogramBuilder, Instrument
public func build() -> OpenTelemetryApi.DoubleHistogram {
buildSynchronousInstrument(DoubleHistogramMeterSdk.init)
}




}
Original file line number Diff line number Diff line change
@@ -1,41 +1,39 @@
//
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
//
//

import Foundation
import OpenTelemetryApi

public class LongHistogramMeterBuilderSdk : LongHistogramBuilder, InstrumentBuilder {

public class LongHistogramMeterBuilderSdk: LongHistogramBuilder, InstrumentBuilder {
var meterProviderSharedState: MeterProviderSharedState

var meterSharedState: StableMeterSharedState

var type: InstrumentType = .histogram
let type: InstrumentType = .histogram

var valueType: InstrumentValueType = .long
let valueType: InstrumentValueType = .long

var description: String

var unit: String

var instrumentName: String

internal init(meterProviderSharedState: MeterProviderSharedState, meterSharedState: StableMeterSharedState, description: String, unit: String, instrumentName: String) {
internal init(meterProviderSharedState: MeterProviderSharedState,
meterSharedState: StableMeterSharedState,
instrumentName: String,
description: String,
unit: String) {
self.meterProviderSharedState = meterProviderSharedState
self.meterSharedState = meterSharedState
self.instrumentName = instrumentName
self.description = description
self.unit = unit
self.instrumentName = instrumentName
}


public func build() -> OpenTelemetryApi.LongHistogram {
buildSynchronousInstrument(LongHistogramMeterSdk.init)
}




}

0 comments on commit e2c7e6b

Please sign in to comment.