szhem opened a new issue, #42492:
URL: https://github.com/apache/airflow/issues/42492

   ### Description
   
   Currently Airflow does not allow to configure path in [OTEL metrics 
exporter](https://github.com/apache/airflow/blob/2.10.2/airflow/metrics/otel_logger.py#L391C1-L403C56)
   ```python
   def get_otel_logger(cls) -> SafeOtelLogger:
       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")
   
       resource = Resource(attributes={SERVICE_NAME: "Airflow"})
   
       protocol = "https" if ssl_active else "http"
       endpoint = f"{protocol}://{host}:{port}/v1/metrics"
   ```
   
   And some of the metrics collectors, e.g. VictoriaMetrics expect the metrics 
to be sent to different path
   - `/opentelemetry/api/v1/push`
   - `/insert/0/opentelemetry/api/v1/push`
   
   It will be great to have the metrics path to be configurable, like the 
following
   
   ```python
   def get_otel_logger(cls) -> SafeOtelLogger:
       host = conf.get("metrics", "otel_host")  # ex: "breeze-otel-collector"
       port = conf.getint("metrics", "otel_port")  # ex: 4318
       path = conf.get("metrics", "otel_path", fallback="/v1/metrics") # ex:  
"/opentelemetry/api/v1/push"
       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")
   
       resource = Resource(attributes={SERVICE_NAME: "Airflow"})
   
       protocol = "https" if ssl_active else "http"
       endpoint = f"{protocol}://{host}:{port}{path}"
   ```
   
   ### Use case/motivation
   
   Ability to send metrics directly into OTEL-compatible metrics collectors, 
e.g. VictoriaMetrics.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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