Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix issue with sending metrics that are None to Prometheus #6951

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading