Skip to content

Commit

Permalink
🐛 Fix issue with sending metrics that are None to Prometheus (#6951)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrei Neagu <[email protected]>
  • Loading branch information
GitHK and Andrei Neagu authored Dec 12, 2024
1 parent c0df260 commit f29dc89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ async def progress_create_containers(
start_duration = (
scheduler_data.dynamic_sidecar.instrumentation.elapsed_since_start_request()
)
assert start_duration is not None # nosec
get_instrumentation(app).dynamic_sidecar_metrics.start_time_duration.labels(
**get_metrics_labels(scheduler_data)
).observe(start_duration)
if start_duration is not None:
get_instrumentation(app).dynamic_sidecar_metrics.start_time_duration.labels(
**get_metrics_labels(scheduler_data)
).observe(start_duration)

_logger.info("Internal state after creating user services %s", scheduler_data)
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,10 @@ async def attempt_pod_removal_and_data_saving(
stop_duration = (
scheduler_data.dynamic_sidecar.instrumentation.elapsed_since_close_request()
)
assert stop_duration is not None # nosec
get_instrumentation(app).dynamic_sidecar_metrics.stop_time_duration.labels(
**get_metrics_labels(scheduler_data)
).observe(stop_duration)
if stop_duration is not None:
get_instrumentation(app).dynamic_sidecar_metrics.stop_time_duration.labels(
**get_metrics_labels(scheduler_data)
).observe(stop_duration)


async def attach_project_networks(app: FastAPI, scheduler_data: SchedulerData) -> None:
Expand Down

0 comments on commit f29dc89

Please sign in to comment.