apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
37.27k stars 14.34k forks source link

Refactor implementation to get OTel tracer #44216

Closed kaxil closed 1 day ago

kaxil commented 2 days ago

Previous implementation had redundant logic in add_span for parameter inspection:

with Trace.start_span(span_name=func_name, component=component):
    if len(inspect.signature(func).parameters) > 0:
        return func(*args, **kwargs)
    else:
        return func()

_Trace Metaclass was using __init__ and few more Python-related changes -- check inline comments.

related issue: https://github.com/apache/airflow/issues/43789


^ Add meaningful description above Read the Pull Request Guidelines for more information. In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed. In case of a new dependency, check compliance with the ASF 3rd Party License Policy. In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

kaxil commented 1 day ago

Failure is unrelated:

=========================== short test summary info ============================
FAILED tests/jobs/test_scheduler_job.py::TestSchedulerJob::test_setup_callback_sink_not_standalone_dag_processor - sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.