ashb commented on code in PR #64523:
URL: https://github.com/apache/airflow/pull/64523#discussion_r3427054250


##########
airflow-core/src/airflow/api_fastapi/common/http_access_log.py:
##########
@@ -32,7 +32,7 @@
 
 logger = structlog.get_logger(logger_name="http.access")
 
-_HEALTH_PATHS = frozenset(["/api/v2/monitor/health"])
+_HEALTH_PATHS = frozenset(("/api/v2/monitor/health",))

Review Comment:
   Otherwise unchanged file. Undo this change to reduce diff surface.



##########
airflow-core/src/airflow/config_templates/config.yml:
##########
@@ -1152,6 +1152,18 @@ metrics:
       type: string
       example: ~
       default: "True"
+    api_path_prefix_to_surface:
+      description: |
+        JSON mapping of HTTP path prefixes to API surface names used for the 
``api_surface`` tag
+        on API metrics. Requests that do not match a configured prefix emit 
metrics without the
+        ``api_surface`` tag.
+
+        Add prefixes to identify additional routes, such as the Execution API 
or routes registered
+        by plugins. When prefixes overlap, the most specific prefix is used.
+      version_added: 3.3.0
+      type: string
+      example: '{"/api/v2": "public", "/ui": "ui", "/execution": "execution", 
"/my-plugin": "plugin"}'

Review Comment:
   I think the question of what form this should take is the major outstanding 
thing here -- I can see the desire to filter this, but I'm still not sure if 
the user should choose the url prefix -> tag mapping, or if they should just be 
able to say "include ui and public API respoonses" (but _not_ be able to 
configure what those url to tag mappings are)



##########
airflow-core/src/airflow/configuration.py:
##########
@@ -407,6 +408,28 @@ def _validate_enums(self):
                         f"{value!r}. Possible values: {', 
'.join(enum_options)}."
                     )
 
+    def _validate_api_path_prefix_to_surface(self):
+        """Validate the mapping used to assign API metrics to surfaces."""
+        section, key = "metrics", "api_path_prefix_to_surface"
+        if not self.has_option(section, key):
+            return
+
+        path_prefix_to_surface = self.getjson(section, key)
+        if not isinstance(path_prefix_to_surface, dict):
+            raise AirflowConfigException(f"[{section}] {key} must be a JSON 
object")

Review Comment:
   ```suggestion
               raise AirflowConfigException(f"[{section}] {key} must be a JSON 
object (got {type(path_prefix_to_surface)}")
   ```



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