Skip to content

Commit 2d42952

Browse files
authored
Update OtelBase.kt
1 parent ba58abf commit 2d42952

File tree

1 file changed

+18
-3
lines changed
  • plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/telemetry/otel

1 file changed

+18
-3
lines changed

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/telemetry/otel/OtelBase.kt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ abstract class AbstractSpanBuilder<
191191

192192
abstract class AbstractBaseSpan<SpanType : AbstractBaseSpan<SpanType>>(internal val context: Context?, private val delegate: ReadWriteSpan) : Span by delegate {
193193
protected open val requiredFields: Collection<String> = emptySet()
194-
protected var _passive: Boolean = false
195-
protected var _unit: MetricUnit = MetricUnit.NONE
196-
protected var _value: Double = 0.0
194+
private var passive: Boolean = false
195+
private var unit: MetricUnit = MetricUnit.NONE
196+
private var value: Double = 0.0
197197

198198
/**
199199
* Same as [com.intellij.platform.diagnostic.telemetry.helpers.use] except downcasts to specific subclass of [BaseSpan]
@@ -220,6 +220,21 @@ abstract class AbstractBaseSpan<SpanType : AbstractBaseSpan<SpanType>>(internal
220220
delegate.end()
221221
}
222222

223+
fun passive(passive: Boolean): SpanType {
224+
this.passive = passive
225+
return this as SpanType
226+
}
227+
228+
fun unit(unit: MetricUnit): SpanType {
229+
this.unit = unit
230+
return this as SpanType
231+
}
232+
233+
fun value(value: Number): SpanType {
234+
this.value = value.toDouble()
235+
return this as SpanType
236+
}
237+
223238
private fun validateRequiredAttributes() {
224239
val missingFields = requiredFields.filter { delegate.getAttribute(AttributeKey.stringKey(it)) == null }
225240
val message = { "${delegate.name} is missing required fields: ${missingFields.joinToString(", ")}" }

0 commit comments

Comments
 (0)