xBis7 commented on code in PR #68393:
URL: https://github.com/apache/airflow/pull/68393#discussion_r3397514936


##########
airflow-core/src/airflow/observability/metrics/otel_logger.py:
##########
@@ -1,53 +0,0 @@
-# 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() -> SafeOtelLogger:
-    # The config values have been deprecated and therefore,
-    # if the user hasn't added them to the config, the default values won't be 
used.
-    # A fallback is needed to avoid an exception.
-    port = None
-    if conf.has_option("metrics", "otel_port"):
-        port = conf.getint("metrics", "otel_port")
-
-    conf_interval = None
-    if conf.has_option("metrics", "otel_interval_milliseconds"):
-        conf_interval = conf.getfloat("metrics", "otel_interval_milliseconds")
-
-    return otel_logger.get_otel_logger(

Review Comment:
   The code that lives under `shared` initializes the `otel_logger` but 
`airflow-core` and `task-sdk`, both have their own version of `conf`.
   
   This is because these two packages have different versioning and they are 
released separately. Essentially they are independent.
   
   This works as a factory where the caller reads its own instance of 
initialized conf, gets the values and passes them to the `shared` code. That's 
why the code duplication exists.
   
   I don't know if it's a good idea simplifying the factory to just pass `conf` 
as a param. 
   
   * `conf` from `airflow-core`
   
https://github.com/dsuhinin/airflow/blob/dsuhinin/simplify-otel-logger-config/airflow-core/src/airflow/configuration.py#L821
   
   * `conf` from `task-sdk`
   
https://github.com/dsuhinin/airflow/blob/dsuhinin/simplify-otel-logger-config/task-sdk/src/airflow/sdk/configuration.py#L325-L341
   
   These two objects could start deviating in the future and even basic 
functions like `getint` could have different behavior.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to