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

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

Commit 5eccaf642e3686f8562121d448b0800c0315c8fa in airflow's branch 
refs/heads/master from Andrew Stahlman
[ https://gitbox.apache.org/repos/asf?p=airflow.git;h=5eccaf6 ]

[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


> 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: 2.0.0
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to