Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sending of task logs in otel traces inside the Scheduler #43943

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions airflow/config_templates/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1290,14 +1290,6 @@ traces:
type: string
example: ~
default: "False"
otel_task_log_event:
description: |
If True, after the task is complete, the full task log messages will be added as the
span events, chunked by 64k size. defaults to False.
version_added: 2.10.0
type: string
example: ~
default: "False"
secrets:
description: ~
options:
Expand Down
25 changes: 0 additions & 25 deletions airflow/jobs/scheduler_job_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,31 +799,6 @@ def process_executor_events(

with Trace.start_span_from_taskinstance(ti=ti) as span:
cls._set_span_attrs__process_executor_events(span, state, ti)
if conf.has_option("traces", "otel_task_log_event") and conf.getboolean(
"traces", "otel_task_log_event"
):
from airflow.utils.log.log_reader import TaskLogReader

task_log_reader = TaskLogReader()
if task_log_reader.supports_read:
metadata: dict[str, Any] = {}
logs, metadata = task_log_reader.read_log_chunks(ti, ti.try_number, metadata)
if ti.hostname in dict(logs[0]):
message = str(dict(logs[0])[ti.hostname]).replace("\\n", "\n")
while metadata["end_of_log"] is False:
logs, metadata = task_log_reader.read_log_chunks(
ti, ti.try_number - 1, metadata
)
if ti.hostname in dict(logs[0]):
message = message + str(dict(logs[0])[ti.hostname]).replace("\\n", "\n")
if span.is_recording():
span.add_event(
name="task_log",
attributes={
"message": message,
"metadata": str(metadata),
},
)

# There are two scenarios why the same TI with the same try_number is queued
# after executor is finished with it:
Expand Down
5 changes: 5 additions & 0 deletions newsfragments/43943.significant.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Remove the ``traces`` ``otel_task_log_event`` event config option and feature

This was sending the task logs form the scheduler, and would be a huge
scheduling performance hit (blocking the entire all scheduling while it was
fetching logs to attach to the trace)