sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Do not report TTFD span with DEADLINE_EXCEEDED status

Open zhukic opened this issue 7 months ago • 3 comments

Problem Statement

Hi!

We started reporting TTFD for one of our screens, and we noticed that the SDK also attaches the TTFD span to all other screens with DEADLINE_EXCEEDED status. Since our pricing now depends on span count, it would be better not to attach it to all transactions, because implementing the TTFD reporting for every screen requires additional development.

Image

I think that we can fix it on our side with a custom EventProcessor that will remove such spans, but please consider improving it on the SDK's side.

Thank you!

Solution Brainstorm

No response

zhukic avatar May 19 '25 13:05 zhukic

@zhukic thanks for the valuable feedback, this makes a lot of sense! We'll discuss this internally and keep you posted.

markushi avatar May 20 '25 07:05 markushi

Hi @zhukic In the meantime you can filter them out using the beforeSend, like so:

        SentryAndroid.init(context) { options ->
            ...
            options.beforeSendTransaction = SentryOptions.BeforeSendTransactionCallback { transaction, hint ->
                // "MainActivity" is the class name of the Activity that should keep the TTFD span
                if (transaction.transaction != "MainActivity") {
                    transaction.spans.removeAll { it.op == "ui.load.full_display" }
                }
                transaction
            }
        }

Please, let us know if this works for you

stefanosiano avatar May 20 '25 08:05 stefanosiano

@stefanosiano it works, thank you!

zhukic avatar May 20 '25 10:05 zhukic