-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the correct instrument type while creating aysnchronous instrument
- Loading branch information
1 parent
8d6fa74
commit 6a5265d
Showing
4 changed files
with
49 additions
and
51 deletions.
There are no files selected for viewing
28 changes: 14 additions & 14 deletions
28
Sources/OpenTelemetrySdk/Metrics/Stable/DoubleCounterMeterBuilderSdk.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
// | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
// | ||
|
||
import Foundation | ||
import OpenTelemetryApi | ||
|
||
public class DoubleCounterMeterBuilderSdk : DoubleCounterBuilder, InstrumentBuilder { | ||
|
||
var meterSharedState: StableMeterSharedState | ||
public class DoubleCounterMeterBuilderSdk: DoubleCounterBuilder, InstrumentBuilder { | ||
var meterSharedState: StableMeterSharedState | ||
|
||
var meterProviderSharedState: MeterProviderSharedState | ||
|
||
let type: InstrumentType = .counter | ||
|
||
let valueType: InstrumentValueType = .double | ||
|
||
var instrumentName: String | ||
|
||
var description: String | ||
|
||
var unit: String | ||
|
||
var instrumentName: String | ||
|
||
init(meterProviderSharedState : MeterProviderSharedState, meterSharedState : StableMeterSharedState, name : String, description: String, unit: String) { | ||
init(meterProviderSharedState: MeterProviderSharedState, | ||
meterSharedState: StableMeterSharedState, | ||
name: String, | ||
description: String, | ||
unit: String) { | ||
self.meterProviderSharedState = meterProviderSharedState | ||
self.meterSharedState = meterSharedState | ||
self.unit = unit | ||
self.description = description | ||
self.instrumentName = name | ||
self.instrumentName = name | ||
} | ||
|
||
public func build() -> OpenTelemetryApi.DoubleCounter { | ||
buildSynchronousInstrument(DoubleCounterSdk.init) | ||
} | ||
|
||
public func buildWithCallback(_ callback: @escaping (OpenTelemetryApi.ObservableDoubleMeasurement) -> Void) -> OpenTelemetryApi.ObservableDoubleCounter { | ||
registerDoubleAsynchronousInstrument(type: .counter, updater: callback) | ||
public func buildWithCallback(_ callback: @escaping (OpenTelemetryApi.ObservableDoubleMeasurement) -> Void) | ||
-> OpenTelemetryApi.ObservableDoubleCounter { | ||
registerDoubleAsynchronousInstrument(type: .observableCounter, updater: callback) | ||
} | ||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters