Skip to content

Tracer Sentry

TracerSentry uses Sentry Performance Monitoring to create transactions per workflow and spans per task.

Use this when you want to track task durations, identify slow tasks, and see the full workflow waterfall in the Sentry dashboard.

Note

Requires pip install dotflow[sentry]

Setup

pip install dotflow[sentry]

Parameters

Parameter Type Default Description
dsn str \| None None Sentry DSN. If None, reuses the SDK already initialized (e.g. by LogSentry)
environment str \| None None Environment tag sent to Sentry
traces_sample_rate float 1.0 Sample rate for performance traces (0.0 to 1.0)

Basic example

from dotflow import Config, DotFlow, action
from dotflow.providers import TracerSentry


@action
def extract():
    return {"data": "fetched"}


@action
def transform(previous_context):
    return {"result": previous_context.storage}


def main():
    config = Config(
        tracer=TracerSentry(
            dsn="https://xxx@sentry.io/123",
            environment="production",
            traces_sample_rate=1.0,
        ),
    )

    workflow = DotFlow(config=config)
    workflow.task.add(step=extract)
    workflow.task.add(step=transform)
    workflow.start()

    return workflow


if __name__ == "__main__":
    main()

What gets captured

Event Sentry action
Workflow starts Transaction created (op="workflow")
Workflow ends Transaction finished with status ok or internal_error
Task starts Child span created (op="task")
Task ends Span finished with duration, retry count, and error details

Full Sentry stack

Use both LogSentry and TracerSentry together for error tracking + performance monitoring:

from dotflow import Config, DotFlow, action
from dotflow.providers import LogSentry, TracerSentry


@action
def extract():
    return {"data": "fetched"}


@action
def transform(previous_context):
    return {"result": previous_context.storage}


def main():
    config = Config(
        log=LogSentry(
            dsn="https://xxx@sentry.io/123",
            environment="production",
        ),
        tracer=TracerSentry(
            traces_sample_rate=1.0,
        ),
    )

    workflow = DotFlow(config=config)
    workflow.task.add(step=extract)
    workflow.task.add(step=transform)
    workflow.start()

    return workflow


if __name__ == "__main__":
    main()

Tip

When using both providers, pass the dsn only to LogSentry. TracerSentry reuses the already initialized SDK — no need to pass dsn again.

References