diff --git a/airflow/config_templates/config.yml b/airflow/config_templates/config.yml index 545977bd53422..2fc72cbb2d9f1 100644 --- a/airflow/config_templates/config.yml +++ b/airflow/config_templates/config.yml @@ -1775,7 +1775,7 @@ webserver: analytics_tool: description: | Send anonymous user activity to your analytics tool - choose from google_analytics, segment, or metarouter + choose from google_analytics, segment, metarouter, or matomo version_added: ~ type: string example: ~ @@ -1787,6 +1787,13 @@ webserver: type: string example: ~ default: ~ + analytics_url: + description: | + Your instances url, only applicable to Matomo. + version_added: 2.9.0 + type: string + example: https://your.matomo.instance.com/ + default: ~ show_recent_stats_for_completed_runs: description: | 'Recent Tasks' stats will show for old DagRuns if set diff --git a/airflow/configuration.py b/airflow/configuration.py index 9d4bca54feb67..a47b35f0505c5 100644 --- a/airflow/configuration.py +++ b/airflow/configuration.py @@ -471,7 +471,7 @@ def inversed_deprecated_sections(self): ("logging", "fab_logging_level"): _available_logging_levels, # celery_logging_level can be empty, which uses logging_level as fallback ("logging", "celery_logging_level"): [*_available_logging_levels, ""], - ("webserver", "analytical_tool"): ["google_analytics", "metarouter", "segment", ""], + ("webserver", "analytical_tool"): ["google_analytics", "metarouter", "segment", "matomo", ""], } upgraded_values: dict[tuple[str, str], str] diff --git a/airflow/www/extensions/init_jinja_globals.py b/airflow/www/extensions/init_jinja_globals.py index 8e431af2efc4d..e13a46be7ba68 100644 --- a/airflow/www/extensions/init_jinja_globals.py +++ b/airflow/www/extensions/init_jinja_globals.py @@ -90,6 +90,7 @@ def prepare_jinja_globals(): { "analytics_tool": conf.get("webserver", "ANALYTICS_TOOL"), "analytics_id": conf.get("webserver", "ANALYTICS_ID"), + "analytics_url": conf.get("webserver", "ANALYTICS_URL"), } ) diff --git a/airflow/www/templates/analytics/matomo.html b/airflow/www/templates/analytics/matomo.html new file mode 100644 index 0000000000000..d45154e2162f7 --- /dev/null +++ b/airflow/www/templates/analytics/matomo.html @@ -0,0 +1,34 @@ +{# + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +#} + + + + diff --git a/docs/apache-airflow/administration-and-deployment/logging-monitoring/tracking-user-activity.rst b/docs/apache-airflow/administration-and-deployment/logging-monitoring/tracking-user-activity.rst index 6401ea72195e0..5437440cf5d5d 100644 --- a/docs/apache-airflow/administration-and-deployment/logging-monitoring/tracking-user-activity.rst +++ b/docs/apache-airflow/administration-and-deployment/logging-monitoring/tracking-user-activity.rst @@ -22,14 +22,15 @@ You can configure Airflow to route anonymous data to `Google Analytics `_, `Segment `_, or `Metarouter `_. -Edit ``airflow.cfg`` and set the ``webserver`` block to have an ``analytics_tool`` and ``analytics_id``: +Edit ``airflow.cfg`` and set the ``webserver`` block to have an ``analytics_tool`` and ``analytics_id`` and ``analytics_url`` if you're using ``matomo``: .. code-block:: ini [webserver] # Send anonymous user activity to Google Analytics, Segment, or Metarouter - analytics_tool = google_analytics # valid options: google_analytics, segment, metarouter + analytics_tool = google_analytics # valid options: google_analytics, segment, metarouter, matomo analytics_id = XXXXXXXXXXX + analytics_url = https://your-matomo-instance.example.com # only required for Matomo .. note:: You can see view injected tracker html within Airflow's source code at ``airflow/www/templates/airflow/main.html``. The related global diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index e1f605d9f2c76..8a20bfc9608a0 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -982,6 +982,8 @@ MarketingTeam MarkupSafe Masternode masterType +Matomo +matomo Maxime mb md