[ 
https://issues.apache.org/jira/browse/AIRFLOW-4057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17067195#comment-17067195
 ] 

ASF subversion and git services commented on AIRFLOW-4057:
----------------------------------------------------------

Commit 423d9c8fe502b8327c5e08bf8ad64757ffa91727 in airflow's branch 
refs/heads/v1-10-test from Andrew Stahlman
[ https://gitbox.apache.org/repos/asf?p=airflow.git;h=423d9c8 ]

[AIRFLOW-4057] Fix bug in stat name validation (#4974)

* [AIRFLOW-4057] Fix bug in stat name validation

The `@validate_stats` wrapper is wrapping an instance method, so it's first
argument is actually an instance of `SafeStatsdLogger`, not the stat_name.
Here's the backtrace that shows up in the webserver logs without the fix:

      File "/Users/andrewstahlman/src/incubator-airflow/airflow/www/views.py", 
line 86, in <module>
        dagbag = models.DagBag(os.devnull, include_examples=False)
      File 
"/Users/andrewstahlman/src/incubator-airflow/airflow/models/__init__.py", line 
312, in __init__
        safe_mode=safe_mode)
      File 
"/Users/andrewstahlman/src/incubator-airflow/airflow/models/__init__.py", line 
594, in collect_dags
        'collect_dags', (timezone.utcnow() - start_dttm).total_seconds(), 1)
      File "/Users/andrewstahlman/src/incubator-airflow/airflow/stats.py", line 
85, in wrapper
        log.warning('Invalid stat name: {stat}.'.format(stat=stat), err)
    Message: 'Invalid stat name: <airflow.stats.SafeStatsdLogger object at 
0x10bf194a8>.'
    Arguments: (InvalidStatsNameException('The stat_name has to be a string'),)

I've verified the fix by updating the unit tests to exercise the "public"
methods rather than testing the internal validation logic directly.

* Wrap stat_name_handler in staticmethod

(cherry picked from commit 5eccaf642e3686f8562121d448b0800c0315c8fa)


> airflow should handle invalid stats name
> ----------------------------------------
>
>                 Key: AIRFLOW-4057
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-4057
>             Project: Apache Airflow
>          Issue Type: New Feature
>            Reporter: Chao-Han Tsai
>            Assignee: Chao-Han Tsai
>            Priority: Major
>             Fix For: 1.10.10
>
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to