seblum opened a new issue, #37194:
URL: https://github.com/apache/airflow/issues/37194

   ### What do you see as an issue?
   
   The documentation about setting a custom statsd `stat_name_handler` is 
sparse and also fairly clustered over different pages. It is also missing some 
information.
   
   I'm trying to set a custom statsd 
[stat_name_handler](https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#stat-name-handler)
 for Airflow 2.6.3 (part of GCP Composer 2) to prevent the DAGs from failing 
with airflow.exceptions.InvalidStatsNameException - e.g. due to the stat_name 
exceeding a length of 250 characters.
   
   I haven't found much documentation about this topic: I know from the 
[Metrics 
configuration](https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/logging-monitoring/metrics.html#rename-metrics)
 of an example function. According to the [release 
notes](https://airflow.apache.org/docs/apache-airflow/stable/release_notes.html)
 I know I should set the function to be referenced with a dotted path, which is 
also what I see in the [Airflow 
source](https://github.com/apache/airflow/blob/8fb4c71857324fa2366179819830d53f32ef5a3f/tests/core/test_stats.py#L507).
   
   What is missing is where the custom function should be stored at. Or also 
how I should link it. 
   I tried several things by now, e.g. follow the [Airflow module management 
guide](https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/modules_management.html)
 and creating the folder structure under the dag folder - which should be added 
to the PYTHONPATH by Airflow - but so far the custom module is not recognized. 
   The documentation does not give any hints whether this is actually the right 
approach for the `stat_name_handler`
   
   ### Solving the problem
   
   Ideally, the [Metrics 
configuration](https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/logging-monitoring/metrics.html#rename-metrics)
 would give an example on where to store the custom function and how it can be 
referenced.
   
   Further, the [stat_name_handler 
configuration](https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#stat-name-handler)
 should likely specify that the function should be referenced with a dotted 
path.
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to