-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Move the traces and metrics code under a common observability package #56187
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
Merged
Merged
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
71421c2
move metrics and traces packages under observability
xBis7 a98fc65
rename tracer to base_tracer
xBis7 5460548
fix backwards compatibility issues with providers
xBis7 276a5a1
move observability package under shared
xBis7 e8db75c
change the imports
xBis7 16cca8e
providers get packages from sdk observability
xBis7 3c725eb
fix task-sdk imports for backwards compat
xBis7 288f731
fix providers leftover imports
xBis7 15cef85
moved tests under shared
xBis7 d909eb5
fix failing test
xBis7 37ab2ed
fix observability dependencies
xBis7 9106524
fix errors in ci image checks
xBis7 a535864
fix wrong import in edge_executor
xBis7 0199d05
make dependencies optional
xBis7 f37c57a
fix duplicate dependencies
xBis7 09c9aee
more duplicate dependencies fixed
xBis7 a56287d
fixup! more duplicate dependencies fixed
potiuk 2a8b677
fixup! fixup! more duplicate dependencies fixed
potiuk 704d2ac
reorganize imports
xBis7 346ac14
fix failing tests
xBis7 74e1c79
cleanup airflow.utils and airflow.models imports
xBis7 6a7fcf8
move InvalidStatsNameException under the new package
xBis7 0cf60e4
fix pyproject accidental removal
xBis7 f462e95
add the observability package to the project workspace
xBis7 146949b
metrics
xBis7 d7b43df
traces
xBis7 3f90bfd
fix shared tests
xBis7 5f222f1
fix shared observability tests
xBis7 2e1cc9a
fix stats and traces imports
xBis7 5f0d2dd
fix otel integration tests
xBis7 2fec150
fix ruff error
xBis7 f9a1bf3
remove unused dependencies
xBis7 10b1a78
add sdk stats
xBis7 10dda6b
add observability factory methods under task-sdk
xBis7 8bf750f
remove imports from other shared modules
xBis7 9443906
move stats_class check to the factory method
xBis7 925affb
use relative imports for _shared in observability
xBis7 eaf5882
add Stats imports for providers in common sdk
xBis7 ef3605c
disable ban-relative-imports check
xBis7 7899fba
fix sdk/test_public_api.py
xBis7 80fb034
adjust pyproject toml for relative imports
xBis7 30ce940
fix mypy providers error
xBis7 ddb2e7f
upgrade providers-common-compat version where needed
xBis7 f4f7972
add 'use next version' comment where needed
xBis7 598f938
undo version upgrade for openlineage common-compat
xBis7 bc91ecd
fix observability imports for the task-sdk
xBis7 925122b
remove config import from observability tests
xBis7 bced033
move tests under core where needed
xBis7 dcd6739
fix failing test_pytest_args_for_test_types
xBis7 8465a5b
add observability to the task-sdk public api
xBis7 600b776
add deprecation warning when accessing Stats from the old path
xBis7 e50f3b1
make the factory method params, keywords-only
xBis7 7cd8ac6
use pendulum instead of datetime in otel_tracer
xBis7 8b8168f
finish making the methods keywords-only
xBis7 b67575f
fix mypy errors
xBis7 61c1691
fix imports for otel test dags
xBis7 0d74d25
fix static checks error
xBis7 099cf22
add Trace to the sdk docs
xBis7 88ffc7e
remove test for deprecation warning in test_stats.py
xBis7 912e9bc
remove configuration dependency from shared observability
xBis7 db24c3b
remove leftover dependencies from airflow-core
xBis7 650c995
add deprecation warnings for metrics and traces
xBis7 cd0a464
add methodtools dependency to observability
xBis7 5a90c0b
fix test_docs_inventory failure
xBis7 18a4de9
Merge branch 'main' into observability-refactoring
amoghrajesh 5b715fd
Merge branch 'main' into observability-refactoring
amoghrajesh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../../../shared/observability/src/airflow_shared/observability |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
airflow-core/src/airflow/observability/metrics/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
xBis7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # 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. | ||
40 changes: 40 additions & 0 deletions
40
airflow-core/src/airflow/observability/metrics/datadog_logger.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # 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. | ||
| from __future__ import annotations | ||
potiuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from airflow._shared.observability.metrics import datadog_logger | ||
| from airflow.configuration import conf | ||
|
|
||
| if TYPE_CHECKING: | ||
| from airflow._shared.observability.metrics.datadog_logger import SafeDogStatsdLogger | ||
|
|
||
|
|
||
| def get_dogstatsd_logger(cls) -> SafeDogStatsdLogger: | ||
| return datadog_logger.get_dogstatsd_logger( | ||
| cls, | ||
| host=conf.get("metrics", "statsd_host"), | ||
| port=conf.getint("metrics", "statsd_port"), | ||
| namespace=conf.get("metrics", "statsd_prefix"), | ||
| datadog_metrics_tags=conf.getboolean("metrics", "statsd_datadog_metrics_tags", fallback=True), | ||
| statsd_disabled_tags=conf.get("metrics", "statsd_disabled_tags", fallback=None), | ||
| metrics_allow_list=conf.get("metrics", "metrics_allow_list", fallback=None), | ||
| metrics_block_list=conf.get("metrics", "metrics_block_list", fallback=None), | ||
| stat_name_handler=conf.getimport("metrics", "stat_name_handler"), | ||
| statsd_influxdb_enabled=conf.getboolean("metrics", "statsd_influxdb_enabled", fallback=False), | ||
| ) | ||
43 changes: 43 additions & 0 deletions
43
airflow-core/src/airflow/observability/metrics/otel_logger.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # 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. | ||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from airflow._shared.observability.metrics import otel_logger | ||
| from airflow.configuration import conf | ||
|
|
||
| if TYPE_CHECKING: | ||
| from airflow._shared.observability.metrics.otel_logger import SafeOtelLogger | ||
|
|
||
|
|
||
| def get_otel_logger(cls) -> SafeOtelLogger: | ||
potiuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return otel_logger.get_otel_logger( | ||
| cls, | ||
| host=conf.get("metrics", "otel_host"), # ex: "breeze-otel-collector" | ||
| port=conf.getint("metrics", "otel_port"), # ex: 4318 | ||
| prefix=conf.get("metrics", "otel_prefix"), # ex: "airflow" | ||
| ssl_active=conf.getboolean("metrics", "otel_ssl_active"), | ||
| # PeriodicExportingMetricReader will default to an interval of 60000 millis. | ||
| conf_interval=conf.getfloat("metrics", "otel_interval_milliseconds", fallback=None), # ex: 30000 | ||
| debug=conf.getboolean("metrics", "otel_debugging_on"), | ||
| service_name=conf.get("metrics", "otel_service"), | ||
| metrics_allow_list=conf.get("metrics", "metrics_allow_list", fallback=None), | ||
| metrics_block_list=conf.get("metrics", "metrics_block_list", fallback=None), | ||
| stat_name_handler=conf.getimport("metrics", "stat_name_handler"), | ||
| statsd_influxdb_enabled=conf.getboolean("metrics", "statsd_influxdb_enabled", fallback=False), | ||
| ) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.