xBis7 commented on code in PR #67328:
URL: https://github.com/apache/airflow/pull/67328#discussion_r3294357788
##########
providers/edge3/src/airflow/providers/edge3/models/edge_worker.py:
##########
@@ -179,21 +184,71 @@ def set_metrics(
"free_concurrency",
}
- Stats.gauge(
- "edge_worker.status",
- sysinfo.get("status", logging.NOTSET), # type: ignore
- tags={"worker_name": worker_name},
- )
- Stats.gauge("edge_worker.connected", int(connected), tags={"worker_name":
worker_name})
- Stats.gauge("edge_worker.maintenance", int(maintenance),
tags={"worker_name": worker_name})
- Stats.gauge("edge_worker.jobs_active", jobs_active, tags={"worker_name":
worker_name})
- Stats.gauge("edge_worker.concurrency", concurrency, tags={"worker_name":
worker_name})
- Stats.gauge("edge_worker.free_concurrency", free_concurrency,
tags={"worker_name": worker_name})
- Stats.gauge(
- "edge_worker.num_queues",
- len(queues),
- tags={"worker_name": worker_name, "queues": ",".join(queues)},
- )
+ if DualStatsManager is not None:
+ DualStatsManager.gauge(
+ "edge_worker.status",
+ sysinfo.get("status", logging.NOTSET), # type: ignore
+ tags={},
+ extra_tags={"worker_name": worker_name},
+ )
+
+ DualStatsManager.gauge(
+ "edge_worker.connected",
+ int(connected),
+ tags={},
+ extra_tags={"worker_name": worker_name},
+ )
+
+ DualStatsManager.gauge(
+ "edge_worker.maintenance",
+ int(maintenance),
+ tags={},
+ extra_tags={"worker_name": worker_name},
+ )
+
+ DualStatsManager.gauge(
+ "edge_worker.jobs_active",
+ jobs_active,
+ tags={},
+ extra_tags={"worker_name": worker_name},
+ )
+
+ DualStatsManager.gauge(
+ "edge_worker.concurrency",
+ concurrency,
+ tags={},
+ extra_tags={"worker_name": worker_name},
+ )
+
+ DualStatsManager.gauge(
+ "edge_worker.free_concurrency",
+ free_concurrency,
+ tags={},
+ extra_tags={"worker_name": worker_name},
+ )
+
+ DualStatsManager.gauge(
+ "edge_worker.num_queues",
+ len(queues),
+ tags={},
+ extra_tags={"worker_name": worker_name, "queues":
",".join(queues)},
+ )
+ else:
+ Stats.gauge(
Review Comment:
This includes the `DualStatsManager` logic under the hood. In versions,
prior to 3.2, where the `DualStatsManager` wasn't available, `Stats.X()` didn't
have the dual stat emission logic. In that case, the `else` block will execute
and you still won't get the legacy metrics.
--
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]