Skip to content

Using defined span creation on static class method cause TypeError #2525

Closed
@GeorgeS1995

Description

@GeorgeS1995

How do you use Sentry?

Sentry Saas (sentry.io)

Version

1.35.0

Steps to Reproduce

Deps:
fastapi==0.87.0

Steps to reproduce

  • Create class with static method and signature like that:
class SentryTracedService:
    @staticmethod
    def f4(a = None):
        return a
  • Create any route that call this method with argument
@app.get("/")
def r():
    sts = SentryTracedService()
    sts.f4(1)
    return {"Hello": "World"}
  • Add to sentry init this method
    sentry_sdk.init(
        ...
        functions_to_trace=[{"qualified_name": "path_to_cls.SentryTracedService.f4"}],
    )
  • Call route with this static method

Expected Result

The route runs back properly without any errors caused by the static method. Additionally, tracing of this method is added to the performance tab.

Actual Result

Got a error:
TypeError: SentryTracedService.f4() takes from 0 to 1 positional arguments but 2 were given

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions