Skip to content

Add support of max log length for OTEL task log event #43868

@howardyoo

Description

@howardyoo

Apache Airflow version

2.10.3

If "Other Airflow 2 version" selected, which one?

No response

What happened?

When the OTEL_TASK_LOG_EVENT is enabled, scheduler job performs extraction of the task log as span event which would get added to the task span (

from airflow.utils.log.log_reader import TaskLogReader
). However, there is a risk of log entry being extremely large, that it would easily produce message that may not fit into the span event. Also, there is a potential risk of halting scheduler from running as scheduler would be busy processing it.

What you think should happen instead?

OTEL_TASK_LOG_EVENT should support MAX length of the log entry, such that it should have a safe default value of the max length (e.g. 64k characters), which will effectively trim the task log once that max limit is reached, preventing any operational risk of scheduler if the log message is too large to be practical.

How to reproduce

Generate a huge log (hundreds of megabytes?) and observe scheduler to hang (or causing delay) processing the log as span event.

Operating System

Linux (amd64)

Versions of Apache Airflow Providers

N/A

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions