Page MenuHomePhabricator

Revisit thresholds for the Human-Bot Page View Count Anomaly alert
Open, Needs TriagePublic

Description

We are receiving daily "Human-Bot Page View Count Anomaly" emails from the pageview_human_bot_daily DAG. In practice the current bounds are crossed almost every day, so the alert has become noise rather than signal.

Current thresholds (DagProperties in main/dags/pageview/dataquality/pageview_human_bot_daily_dag.py) :

  • Human: lower 0.491, upper 0.62
  • Automated: lower 0.117, upper 0.26

Recent observed ratios vs. the breached bound:

DateHuman ratioHuman boundAutomated ratioAuto bound
2026-09-220.4636< 0.4910.29810.26
2026-09-210.4662< 0.4910.32220.26
2026-09-200.4914(0.491 ok)0.31320.26

This looks like a gradual shift in the traffic mix rather than a genuine anomaly.

Ask: review whether these bounds still reflect current human vs. automated traffic patterns and adjust them accordingly. This ticket is not proposing specific new values. That's for us to decide together based on a longer history of the metric.

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Ops Week: Fix remove alertsrepos/data-engineering/airflow-dags!2752javiermontonfix/on-call-remove-alertsmain
Disable pageview human-bot daily ratio alertsrepos/data-engineering/airflow-dags!2732dr0ptp4ktdisable-human-bot-ratio-alerts-until-kapowmain
Customize query in GitLab

Event Timeline

Anecdata: I'm on Ops Week and am seeing the same sort of thing continuing here in October 2026. I'll bump the IM thread about this.

Note: This is based on the legacy bot detection still, not KAPOW.

We do need to revisit the alert. If I understand correctly, the conditions causing the alert at the moment are a drop in human-classified traffic, and an increase in automated-classified traffic. If those go extremely low or high (e.g. 5% human-classified traffic), this can indicate a pipeline problem. But I think the most interesting condition for these alerts is increases in the human-classified traffic, as those indicate we've missed automated traffic.

We have a couple of real incidents being investigated at the moment, and in particular, T439774, which I think we should prioritize. We should then improve the alerting using what we've learned in that. That is: what alerts could have automatically detected the symptoms of that incident before Movement Insights did?

In the meantime, I'm perfectly fine for us to stop spending Ops Week time dealing with this. @dr0ptp4kt would it be possible to just disable/silence these alerts for a couple of weeks?

In the meantime, I'm perfectly fine for us to stop spending Ops Week time dealing with this. @dr0ptp4kt would it be possible to just disable/silence these alerts for a couple of weeks?

I've submitted a patch to disable the alerts for the time being ^. I'll set a reminder for you and me, so that we check on status of Kapow integration if it isn't yet done in-sprint. I'll check on IM for a code review/approval/merge/deploy.

^ Patch merged, so next step will be any of the KAPOW integration and reinstating of alerts along with it.

@APizzata-WMF noted the DAG is failing out on the final task now. I'll need to submit a patch, but need an environment where I can rebuild the tests without needing to run Docker Desktop, so may be a little while.

Here's an example of the error from the Airflow console logs on the web.

I had meant to removed the urn in the final lines, although I think that's just a random ID. I'm having GardenQL / Claude doing some code scouting in DataHub about that thing in case this comes up in the future, nevertheless.

1@APizzata-WMF noted the DAG is failing out on the final task now. I'll need to submit a patch, but need an environment where I can rebuild the tests without needing to run Docker Desktop, so may be a little while.
2
3Here's an example of the error from the Airflow console logs on the web.
4
5I had meant to removed the urn in the final lines, although I think that's just a random ID. I'm having GardenQL / Claude doing some code scouting in DataHub about that thing in case this comes up in the future, nevertheless.
6
7```
8pageview-human-bot-daily-send-email-jp68mlj8
9 ▶ Log message source details
10[2026-10-09, 00:26:07 UTC] {local_task_job_runner.py:123} ▶ Pre task execution logs
11[2026-10-09, 00:26:09 UTC] {taskinstance.py:3337} ERROR - Task failed with exception
12Traceback (most recent call last):
13 File "/home/app/.local/lib/python3.11/site-packages/airflow/models/taskinstance.py", line 776, in _execute_task
14 result = _execute_callable(context=context, **execute_callable_kwargs)
15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16 File "/home/app/.local/lib/python3.11/site-packages/airflow/models/taskinstance.py", line 742, in _execute_callable
17 return ExecutionCallableRunner(
18 ^^^^^^^^^^^^^^^^^^^^^^^^
19 File "/home/app/.local/lib/python3.11/site-packages/airflow/utils/operator_helpers.py", line 252, in run
20 return self.func(*args, **kwargs)
21 ^^^^^^^^^^^^^^^^^^^^^^^^^^
22 File "/home/app/.local/lib/python3.11/site-packages/airflow/models/baseoperator.py", line 425, in wrapper
23 return func(self, *args, **kwargs)
24 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
25 File "/opt/airflow/dags/airflow_dags/wmf_airflow_common/operators/email.py", line 60, in execute
26 self.html_content += self.get_embedded_content().replace("\n", "<br/>")
27 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
28 File "/opt/airflow/dags/airflow_dags/wmf_airflow_common/operators/email.py", line 82, in get_embedded_content
29 with hdfs.open_input_file(file_path) as file:
30 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31 File "pyarrow/_fs.pyx", line 770, in pyarrow._fs.FileSystem.open_input_file
32 File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
33 File "pyarrow/error.pxi", line 113, in pyarrow.lib.check_status
34FileNotFoundError: [Errno 2] Opening HDFS file '/wmf/tmp/analytics/pageview_alerts/scheduled__2026-10-08T00_00_00_00_00' failed. Detail: [errno 2] No such file or directory
35[2026-10-09, 00:26:09 UTC] {taskinstance.py:1242} INFO - Marking task as FAILED. dag_id=pageview_human_bot_daily, task_id=send_email, run_id=scheduled__2026-10-08T00:00:00+00:00, execution_date=20261008T000000, start_date=20261009T002607, end_date=20261009T002609
36[2026-10-09, 00:26:09 UTC] {crypto.py:82} WARNING - empty cryptography key - values will not be stored encrypted.
37[2026-10-09, 00:26:09 UTC] {base.py:84} INFO - Retrieving connection 'smtp_default'
38[2026-10-09, 00:26:09 UTC] {logging_mixin.py:190} WARNING - /home/app/.local/lib/python3.11/site-packages/airflow/utils/email.py:155 RemovedInAirflow3Warning: Fetching SMTP credentials from configuration variables will be deprecated in a future release. Please set credentials using a connection instead.
39[2026-10-09, 00:26:09 UTC] {configuration.py:1190} WARNING - section/key [smtp/smtp_user] not found in config
40[2026-10-09, 00:26:09 UTC] {email.py:272} INFO - Email alerting: attempt 1
41[2026-10-09, 00:26:09 UTC] {email.py:283} INFO - Sent an alert email to ['data-engineering-alerts@wikimedia.org']
42[2026-10-09, 00:26:09 UTC] {taskinstance.py:1580} INFO - Executing callback at index 0: custom_on_failure_callback
43[2026-10-09, 00:26:09 UTC] {base.py:84} INFO - Retrieving connection 'datahub_gms'
44[2026-10-09, 00:26:09 UTC] {base.py:84} INFO - Retrieving connection 'datahub_gms'
45[2026-10-09, 00:26:09 UTC] {datahub_plugin_v22.py:112} INFO - Emitting Datahub Dataflow: DataFlow(urn=DataFlowUrn(urn:li:dataFlow:(airflow,pageview_human_bot_daily,prod)), id='pageview_human_bot_daily', orchestrator='airflow', cluster=None, name=None, description='\n#### Check daily Human-Bot pageviews ratio and alert if above baseline\n', properties={'_access_control': 'None', 'catchup': 'True', 'description': 'None', 'doc_md': "'\\n#### Check daily Human-Bot pageviews ratio and alert if above baseline\\n'", 'fileloc': "'/opt/airflow/dags/airflow_dags/main/dags/pageview/dataquality/pageview_human_bot_daily_dag.py'", 'is_paused_upon_creation': 'None', 'start_date': "DateTime(2025, 11, 1, 0, 0, 0, tzinfo=Timezone('UTC'))", 'tags': "['to_hive', 'uses_spark', 'bot_alerting']", 'timezone': "Timezone('UTC')"}, url='https://airflow.wikimedia.org/tree?dag_id=pageview_human_bot_daily', tags={'bot_alerting', 'uses_spark', 'to_hive'}, owners={'analytics'}, group_owners=set(), platform_instance=None, env='prod')
46[2026-10-09, 00:26:09 UTC] {datahub_plugin_v22.py:133} INFO - Emitting Datahub Datajob: DataJob(id='send_email', urn=DataJobUrn(urn:li:dataJob:(urn:li:dataFlow:(airflow,pageview_human_bot_daily,prod),send_email)), flow_urn=DataFlowUrn(urn:li:dataFlow:(airflow,pageview_human_bot_daily,prod)), name=None, description=None, properties={'depends_on_past': 'False', 'email': "'data-engineering-alerts@wikimedia.org'", 'label': "'send_email'", 'execution_timeout': 'None', 'sla': 'datetime.timedelta(days=1)', 'task_id': "'send_email'", 'trigger_rule': "<TriggerRule.ALL_SUCCESS: 'all_success'>", 'wait_for_downstream': 'False', 'downstream_task_ids': '[]', 'inlets': '[]', 'outlets': '[]'}, url='https://airflow.wikimedia.org/taskinstance/list/?flt1_dag_id_equals=pageview_human_bot_daily&_flt_3_task_id=send_email', tags={'bot_alerting', 'uses_spark', 'to_hive'}, owners={'analytics'}, group_owners=set(), inlets=[], outlets=[], fine_grained_lineages=[], upstream_urns=[])
47[2026-10-09, 00:26:09 UTC] {datahub_plugin_v22.py:148} INFO - Emitted Start Datahub Dataprocess Instance: DataProcessInstance(urn=DataProcessInstanceUrn(urn:li:dataProcessInstance:d9...), id='pageview_human_bot_daily_send_email_scheduled__2026-10-08T00:00:00+00:00', orchestrator='airflow', cluster='prod', type='BATCH_SCHEDULED', template_urn=DataJobUrn(urn:li:dataJob:(urn:li:dataFlow:(airflow,pageview_human_bot_daily,prod),send_email)), parent_instance=None, properties={'run_id': 'scheduled__2026-10-08T00:00:00+00:00', 'duration': '1.36796', 'start_date': '2026-10-09 00:26:07.684758+00:00', 'end_date': '2026-10-09 00:26:09.052718+00:00', 'execution_date': '2026-10-08 00:00:00+00:00', 'try_number': '5', 'max_tries': '5', 'external_executor_id': '30874168', 'state': 'failed', 'operator': 'HdfsEmailOperator', 'priority_weight': '1', 'log_url': 'https://airflow.wikimedia.org/dags/pageview_human_bot_daily/grid?dag_run_id=scheduled__2026-10-08T00%3A00%3A00%2B00%3A00&task_id=send_email&base_date=2026-10-08T00%3A00%3A00.000000%2B0000&tab=logs', 'orchestrator': 'airflow', 'dag_id': 'pageview_human_bot_daily', 'task_id': 'send_email'}, url='https://airflow.wikimedia.org/dags/pageview_human_bot_daily/grid?dag_run_id=scheduled__2026-10-08T00%3A00%3A00%2B00%3A00&task_id=send_email&base_date=2026-10-08T00%3A00%3A00.000000%2B0000&tab=logs', inlets=[], outlets=[], upstream_urns=[])
48[2026-10-09, 00:26:09 UTC] {datahub_plugin_v22.py:160} INFO - Emitted Completed Data Process Instance: DataProcessInstance(urn=DataProcessInstanceUrn(urn:li:dataProcessInstance:d9...), id='pageview_human_bot_daily_send_email_scheduled__2026-10-08T00:00:00+00:00', orchestrator='airflow', cluster='prod', type='BATCH_SCHEDULED', template_urn=DataJobUrn(urn:li:dataJob:(urn:li:dataFlow:(airflow,pageview_human_bot_daily,prod),send_email)), parent_instance=None, properties={}, url=None, inlets=[], outlets=[], upstream_urns=[])
49[```