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

[CSM O11y test] Filter out time series with no valid data point #32

Merged
Merged
Changes from 1 commit
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
21 changes: 20 additions & 1 deletion tests/gamma/csm_observability_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,10 @@ def query_metrics(
view=monitoring_v3.ListTimeSeriesRequest.TimeSeriesView.FULL,
retry=retry_settings,
)
time_series = list(response)
time_series = []
for series in response:
if self.is_legit_time_series(series):
time_series.append(series)

self.assertLen(
time_series,
Expand All @@ -447,6 +450,22 @@ def query_metrics(
results[metric] = metric_time_series
return results

def is_legit_time_series(
self, series: monitoring_v3.types.TimeSeries
) -> bool:
for point in series.points:
# Test flake: we found some time series with no actual data point
# in prod test runs.
# Here we will only include time series with actual data in it.
if (
point.value.distribution_value.count > 0
or point.value.double_value > 0
):
return True
logger.error("Warning: found time_series with no valid data point")
logger.error(series)
return False

def assertAtLeastOnePointWithinRange(
self,
points: list[monitoring_v3.types.Point],
Expand Down
Loading