Skip to content
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
14 changes: 11 additions & 3 deletions providers/openlineage/docs/guides/developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -504,15 +504,23 @@ Marquez can help you pinpoint which facets are not being formed properly so you

Debug settings
^^^^^^^^^^^^^^
For debugging purposes, ensure that the `Airflow logging level <https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#logging-level>`_
is set to ``DEBUG`` and that the :ref:`debug_mode <options:debug_mode>` is enabled for OpenLineage integration.
This will increase the detail in Airflow logs and include additional environmental information in OpenLineage events.
For debugging purposes, ensure that both `Airflow logging level <https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#logging-level>`_
and `OpenLineage client logging level <https://openlineage.io/docs/client/python#environment-variables>`_ is set to ``DEBUG``.
The latest provider auto-syncs Airflow's logging level with the OpenLineage client, removing the need for manual configuration.

For DebugFacet, containing additional information (e.g., list of all packages installed), to be appended to all OL events
enable :ref:`debug_mode <options:debug_mode>` for OpenLineage integration.

Keep in mind that enabling these settings will increase the detail in Airflow logs (which will increase their size) and
add extra information to OpenLineage events. It's recommended to use them temporarily, primarily for debugging purposes.

When seeking help with debugging, always try to provide the following:

- Airflow scheduler logs with the logging level set to DEBUG
- Airflow worker logs (task logs) with the logging level set to DEBUG
- OpenLineage events with debug_mode enabled
- Information about Airflow version and OpenLineage provider version
- Information about any custom modifications made to the deployment environment where the Airflow is running


Where can I learn more?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.
from __future__ import annotations

import os
import traceback
from contextlib import ExitStack
from typing import TYPE_CHECKING
Expand All @@ -36,6 +37,7 @@
)
from openlineage.client.uuid import generate_static_uuid

from airflow.configuration import conf as airflow_conf
from airflow.providers.openlineage import __version__ as OPENLINEAGE_PROVIDER_VERSION, conf
from airflow.providers.openlineage.utils.utils import (
OpenLineageRedactor,
Expand Down Expand Up @@ -81,6 +83,11 @@ def __init__(self, client: OpenLineageClient | None = None, secrets_masker: Secr

def get_or_create_openlineage_client(self) -> OpenLineageClient:
if not self._client:
# If not already set explicitly - propagate airflow logging level to OpenLineage client
airflow_core_log_level = airflow_conf.get("logging", "logging_level", fallback="INFO")
if not os.getenv("OPENLINEAGE_CLIENT_LOGGING") and airflow_core_log_level != "INFO":
os.environ["OPENLINEAGE_CLIENT_LOGGING"] = airflow_core_log_level

config = self.get_openlineage_config()
if config:
self.log.debug(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@
pytestmark = pytest.mark.db_test


@pytest.mark.parametrize(
"env_vars, expected_logging",
[
({"AIRFLOW__LOGGING__LOGGING_LEVEL": "DEBUG"}, "DEBUG"),
({"AIRFLOW__LOGGING__LOGGING_LEVEL": "INFO"}, None),
({}, None), # When no value is provided, default should be INFO and propagation is skipped.
],
)
def test_create_client_logging_propagation(env_vars, expected_logging):
with patch.dict(os.environ, env_vars, clear=True):
assert os.getenv("OPENLINEAGE_CLIENT_LOGGING") is None
OpenLineageAdapter().get_or_create_openlineage_client()
assert os.getenv("OPENLINEAGE_CLIENT_LOGGING") == expected_logging


@patch.dict(
os.environ,
{"OPENLINEAGE_URL": "http://ol-api:5000", "OPENLINEAGE_API_KEY": "api-key"},
Expand Down