Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion workflow-tracing-papa/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ android {

dependencies {
api(libs.androidx.collection)
api(libs.androidx.tracing.ktx)
api(libs.kotlin.jdk8)
api(libs.kotlinx.coroutines.core)
api(libs.squareup.papa)

api(project(":workflow-core"))
api(project(":workflow-runtime"))
Expand Down
14 changes: 2 additions & 12 deletions workflow-tracing-papa/dependencies/releaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
androidx.annotation:annotation-experimental:1.1.0
androidx.annotation:annotation-jvm:1.9.1
androidx.annotation:annotation:1.9.1
androidx.arch.core:core-common:2.0.0
androidx.collection:collection-jvm:1.5.0
androidx.collection:collection:1.5.0
androidx.core:core:1.6.0
androidx.lifecycle:lifecycle-common:2.0.0
androidx.lifecycle:lifecycle-runtime:2.0.0
androidx.tracing:tracing-ktx:1.1.0
androidx.tracing:tracing:1.1.0
androidx.versionedparcelable:versionedparcelable:1.1.1
com.squareup.curtains:curtains:1.2.5
androidx.tracing:tracing-ktx:1.2.0
androidx.tracing:tracing:1.2.0
com.squareup.okio:okio-jvm:3.3.0
com.squareup.okio:okio:3.3.0
com.squareup.papa:papa-main-trace:0.30
com.squareup.papa:papa-safetrace:0.30
com.squareup.papa:papa:0.30
org.jetbrains.kotlin:kotlin-bom:2.1.21
org.jetbrains.kotlin:kotlin-stdlib-common:2.1.21
org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.21
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.squareup.workflow1.tracing.papa

import androidx.tracing.Trace
import androidx.tracing.trace
import com.squareup.workflow1.tracing.SafeTraceInterface
import papa.SafeTrace

/**
* Production implementation of [SafeTraceInterface] that delegates to the actual [SafeTrace].
* Production implementation of [SafeTraceInterface] that uses androidx.tracing.Trace.
*
* @param isTraceable Whether tracing is enabled. Clients should configure this directly.
* Defaults to false for backwards compatibility.
Expand All @@ -14,31 +15,31 @@ class PapaSafeTrace(
) : SafeTraceInterface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this class then as it no longer uses Papa

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, totally. I'll prepare a separate PR to do so. How about s/PapaSafeTrace/WorkflowTrace and s/SafeTraceInterface/TraceInterface?


override val isCurrentlyTracing: Boolean
get() = SafeTrace.isCurrentlyTracing
get() = Trace.isEnabled()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does isEnabled go off and on based on whether we are actively recording a trace?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!


override fun beginSection(label: String) {
SafeTrace.beginSection(label)
Trace.beginSection(label)
}

override fun endSection() {
SafeTrace.endSection()
Trace.endSection()
}

override fun beginAsyncSection(
name: String,
cookie: Int
) {
SafeTrace.beginAsyncSection(name, cookie)
Trace.beginAsyncSection(name, cookie)
}

override fun endAsyncSection(
name: String,
cookie: Int
) {
SafeTrace.endAsyncSection(name, cookie)
Trace.endAsyncSection(name, cookie)
}

override fun logSection(info: String) {
SafeTrace.logSection(info)
trace(info) {}
}
}
Loading