Skip to content

Conversation

@matt-codecov
Copy link
Contributor

this PR introduces a new integration that allows traces to descend into code in Rust native extensions by hooking into Rust's popular tracing framework. it relies on the Rust native extension using pyo3-python-tracing-subscriber, a crate i recently published under Sentry, to expose a way for the Python SDK to hook into tracing.

in this screenshot, the transaction was started in Python but the rest of the span tree reflects the structure and performance of a naive fibonacci generator in Rust.
Screenshot 2024-10-29 at 7 11 12 PM

i have a sentry-docs branch with new docs for the integration pretty much ready to go. just want to get this merged and then add a working example to pyo3-python-tracing-subscriber to link to first

@matt-codecov matt-codecov force-pushed the matt/python-rust-tracing-integration branch from dc6660e to 82d3239 Compare October 30, 2024 18:39
@codecov
Copy link

codecov bot commented Oct 30, 2024

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
110 3 107 0
View the full list of 3 ❄️ flaky tests
tests.integrations.aws_lambda.test_aws test_non_dict_event[python3.8-\n            [\n                {\n                    "headers": {\n                        "Host": "x1.io",\n                        "X-Forwarded-Proto": "https"\n                    },\n                    "httpMethod": "GET",\n                    "path": "/path1",\n                    "queryStringParameters": {\n                        "done": "false"\n                    },\n                    "dog": "Maisey"\n                },\n                {\n                    "headers": {\n                        "Host": "x2.io",\n                        "X-Forwarded-Proto": "http"\n                    },\n                    "httpMethod": "POST",\n                    "path": "/path2",\n                    "queryStringParameters": {\n                        "done": "true"\n                    },\n                    "dog": "Charlie"\n                }\n            ]\n            -True-2]

Flake rate in main: 40.48% (Passed 25 times, Failed 17 times)

Stack Traces | 0.237s run time
.../integrations/aws_lambda/test_aws.py:513: in test_non_dict_event
    (
E   ValueError: not enough values to unpack (expected 2, got 1)
tests.integrations.aws_lambda.test_aws test_non_dict_event[python3.10-\n            [\n                {\n                    "headers": {\n                        "Host": "x1.io",\n                        "X-Forwarded-Proto": "https"\n                    },\n                    "httpMethod": "GET",\n                    "path": "/path1",\n                    "queryStringParameters": {\n                        "done": "false"\n                    },\n                    "dog": "Maisey"\n                },\n                {\n                    "headers": {\n                        "Host": "x2.io",\n                        "X-Forwarded-Proto": "http"\n                    },\n                    "httpMethod": "POST",\n                    "path": "/path2",\n                    "queryStringParameters": {\n                        "done": "true"\n                    },\n                    "dog": "Charlie"\n                }\n            ]\n            -True-2]

Flake rate in main: 37.50% (Passed 20 times, Failed 12 times)

Stack Traces | 0.238s run time
.../integrations/aws_lambda/test_aws.py:513: in test_non_dict_event
    (
E   ValueError: not enough values to unpack (expected 2, got 1)
tests.integrations.aws_lambda.test_aws test_non_dict_event[python3.9-\n            [\n                {\n                    "headers": {\n                        "Host": "x1.io",\n                        "X-Forwarded-Proto": "https"\n                    },\n                    "httpMethod": "GET",\n                    "path": "/path1",\n                    "queryStringParameters": {\n                        "done": "false"\n                    },\n                    "dog": "Maisey"\n                },\n                {\n                    "headers": {\n                        "Host": "x2.io",\n                        "X-Forwarded-Proto": "http"\n                    },\n                    "httpMethod": "POST",\n                    "path": "/path2",\n                    "queryStringParameters": {\n                        "done": "true"\n                    },\n                    "dog": "Charlie"\n                }\n            ]\n            -True-2]

Flake rate in main: 37.93% (Passed 18 times, Failed 11 times)

Stack Traces | 0.278s run time
.../integrations/aws_lambda/test_aws.py:513: in test_non_dict_event
    (
E   ValueError: not enough values to unpack (expected 2, got 1)

To view more test analytics, go to the Test Analytics Dashboard
Got feedback? Let us know on Github

@matt-codecov matt-codecov requested review from a team, antonpirker and sl0thentr0py October 30, 2024 19:11
@matt-codecov matt-codecov marked this pull request as ready for review October 30, 2024 19:12
@matt-codecov
Copy link
Contributor Author

CI seems hung, not sure if that is my fault somehow or what

@matt-codecov matt-codecov force-pushed the matt/python-rust-tracing-integration branch 2 times, most recently from 407d294 to 4d72832 Compare October 31, 2024 21:01
Copy link
Contributor

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

Looks very cool. I added some minor requests.

@matt-codecov matt-codecov force-pushed the matt/python-rust-tracing-integration branch from ac1302a to 413c197 Compare November 11, 2024 19:32
Copy link
Contributor

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

After some rework, this integration is now ready to be merged!

@antonpirker antonpirker merged commit 4bec4a4 into getsentry:master Nov 13, 2024
135 of 136 checks passed
antonpirker pushed a commit to getsentry/sentry-docs that referenced this pull request Nov 21, 2024
A new Python SDK integration was created in getsentry/sentry-python#3717 + getsentry/sentry-python#3780 and this PR documents it.
JoshuaMoelans pushed a commit to getsentry/sentry-docs that referenced this pull request Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants