Skip to content

Commit e5a4275

Browse files
authored
remove zero duration span and dead code (#1730)
1 parent 3817aad commit e5a4275

2 files changed

Lines changed: 0 additions & 19 deletions

File tree

demo-app/src/main/java/io/opentelemetry/android/demo/DemoViewModel.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import kotlinx.coroutines.launch
1313

1414
class DemoViewModel : ViewModel() {
1515
val sessionIdState = MutableStateFlow("? unknown ?")
16-
private val tracer = OtelDemoApplication.tracer("otel.demo")!!
1716

1817
init {
1918
viewModelScope.launch {
@@ -27,12 +26,4 @@ class DemoViewModel : ViewModel() {
2726
private fun updateSession() {
2827
// TODO
2928
}
30-
31-
private fun sendTrace(
32-
type: String,
33-
value: Float,
34-
) {
35-
// A metric should be a better fit, but for now we're using spans.
36-
tracer.spanBuilder(type).setAttribute("value", value.toDouble()).startSpan().end()
37-
}
3829
}

demo-app/src/main/java/io/opentelemetry/android/demo/MainOtelButton.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import androidx.compose.ui.semantics.onClick
2121
import androidx.compose.ui.semantics.semantics
2222
import androidx.compose.ui.unit.dp
2323
import io.opentelemetry.api.metrics.LongCounter
24-
import io.opentelemetry.api.trace.SpanKind
2524

2625
@Composable
2726
fun MainOtelButton(icon: Painter,
@@ -51,14 +50,5 @@ fun generateClickEvent(counter: LongCounter?) {
5150
val scope = "otel.demo.app"
5251
OtelDemoApplication.eventBuilder(scope, "logo.clicked")
5352
.emit()
54-
// For now, we also emit a span, so that we can see something in a UI
55-
val tracer = OtelDemoApplication.tracer(scope)
56-
// And we also increment a counter, to test metrics
5753
counter?.add(1)
58-
val span =
59-
tracer
60-
?.spanBuilder("logo.clicked")
61-
?.setSpanKind(SpanKind.INTERNAL)
62-
?.startSpan()
63-
span?.end()
6454
}

0 commit comments

Comments
 (0)