xBis7 commented on code in PR #56150:
URL: https://github.com/apache/airflow/pull/56150#discussion_r2395382169
##########
airflow-core/src/airflow/metrics/otel_logger.py:
##########
@@ -371,25 +371,37 @@ def set_gauge_value(self, name: str, value: int | float,
delta: bool, tags: Attr
def get_otel_logger(cls) -> SafeOtelLogger:
+ # Check Airflow config.
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.
- interval = conf.getint("metrics", "otel_interval_milliseconds",
fallback=None) # ex: 30000
- debug = conf.getboolean("metrics", "otel_debugging_on")
- service_name = conf.get("metrics", "otel_service")
- resource = Resource.create(attributes={HOST_NAME: get_hostname(),
SERVICE_NAME: service_name})
+ # If the host or the port hasn't been provided, then check the regular
OTel env vars.
+ if host != "-" and port != "0":
+ ssl_active = conf.getboolean("metrics", "otel_ssl_active")
+ # PeriodicExportingMetricReader will default to an interval of 60000
millis.
+ interval_ms = conf.getint("metrics", "otel_interval_milliseconds",
fallback=None) # ex: 30000
+ debug = conf.getboolean("metrics", "otel_debugging_on")
+ service_name = conf.get("metrics", "otel_service")
+
+ protocol = "https" if ssl_active else "http"
+ endpoint = f"{protocol}://{host}:{port}/v1/metrics"
+ else:
+ otel_config = load_metrics_config()
+ # PeriodicExportingMetricReader will default to an interval of 60000
millis.
Review Comment:
Removed it.
--
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]